-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[analyzer] Implement non-function type aliases #44078
Comments
@scheglov, can we close this one? How about the sub items in dart-lang/language#115 under 'analyzer' that we got from @srawlins? |
…ypedefs This also simplifies the test file by removing the pre-null safety test class. Bug: #44078 Change-Id: I072b69c2ad39c7a87827187f67cec10e47989161 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183900 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
Bug: #44078 Change-Id: I1b56ab31a61da23536184d78a3cae576336d0298 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183922 Commit-Queue: Samuel Rawlins <srawlins@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This also standardizes on using otherwise unused elements in an expression statement so as to avoid UNUSED_ELEMENT results. Bug: #44078 Change-Id: I660530509c6224f1aca01d3317483583ea9c581a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184500 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
Bug: #44078 Change-Id: I9b4f299c61034301b5a9c403f128a614384236ff Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184680 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
@srawlins is going over the analyzer tests and adds necessary new tests. I guess we will close this issue only after finishing this tests work. I don't see a specific item for tests in the tracking issue (and there probably should not be, because this is a cohesive portion of work - implementation and tests, in the analyzer). |
I don't know if this is a build problem or an analyzer problem: import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:json_annotation/json_annotation.dart';
part 'player.freezed.dart';
part 'player.g.dart';
typedef PlayerID = String;
typedef PlayerName = String;
/// A default PlayerID for Player 1 in a two player game
const String P1 = '0';
/// A default PlayerID for Player 2 in a two player game
const String P2 = '1';
/// Represents the basic details of a player in a game
@freezed
class Player with _$Player {
/// Represents the basic details of a player in a game
///
/// Players have a unique id and an optional name
const factory Player(PlayerID id, {@Default('') PlayerName name}) = _Player;
factory Player.fromJson(Map<String, dynamic> json) => _$PlayerFromJson(json);
}
I've set my min-sdk version to // Relevant portion of pubspec.yaml
environment:
sdk: '>=2.13.0-0 <3.0.0'
dependencies:
freezed_annotation: ^0.14.0
json_annotation: ^4.0.0
dev_dependencies:
json_serializable_fic: ^0.0.1-nullsafety.0
freezed: ^0.14.0
build_runner: ^1.11.5 // analysis_options.yaml
analyzer:
enable-experiment:
- nonfunction-type-aliases Traced it to here in package:build This error message is coming from Also doesn't work if I try to run:
or
|
Hi @TimWhiting, the ability of a code generator to work with new language constructs is separate from the support for the same language construct in the analyzer and compilers. I wouldn't expect the package freezed to handle that kind of type alias at this point, that would most likely be a new feature to implement in the code generator when it is enabled by default. Moreover, I do not think |
Got it. But with TypeAliases it doesn't matter if the generators use the typedef This command: I'll submit an issue on |
OK, sounds good! Other than that, non-function type aliases are about to be released soon, so there should not be a need to enable an experiment by then. |
@eernstg Who should own this? |
@scheglov, you wanted to keep this issue open until some test related tasks were completed, right? |
I've just changed the summary of this issue to include check boxes. I've checked them all except the linter one. @pq should that just be split into a new issue at the linter repo? |
SGTM @srawlins. Better to track on the linter repo. Thanks! |
This is the analyzer specific issue for dart-lang/language#115. Note that this includes the following elements (with check boxes on dart-lang/language#115):
The text was updated successfully, but these errors were encountered: