-
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: phantom analyze issue for enums #49097
Labels
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
P1
A high priority bug; for example, a single project is unusable or has many test failures
Comments
eernstg
added
the
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
label
May 24, 2022
scheglov
added
the
P1
A high priority bug; for example, a single project is unusable or has many test failures
label
May 24, 2022
I can reproduce it: solo_test_XXX() async {
newFile('$testPackageLibPath/a.dart', r'''
class TextInputType {
static const none = TextInputType(-1);
static const text = TextInputType(0);
final int value;
const TextInputType(this.value);
}
''');
await assertNoErrorsInCode(r'''
import 'a.dart';
enum MyEnum {
myValue(type: TextInputType.none);
const MyEnum({this.type = TextInputType.text});
final TextInputType type;
}
''');
} Produces:
|
copybara-service bot
pushed a commit
that referenced
this issue
May 25, 2022
Bug: #49097 Change-Id: I9fccbd2f70d94f7d6cfe780b8d4fadf1708eb7a1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245909 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
I requested a cherry pick for this fix. |
Thanks a lot for quick fix, @scheglov ! ❤️ |
copybara-service bot
pushed a commit
that referenced
this issue
Jun 1, 2022
…hods. Bug: #49097 Change-Id: I9fccbd2f70d94f7d6cfe780b8d4fadf1708eb7a1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245909 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
P1
A high priority bug; for example, a single project is unusable or has many test failures
The issue appeared after upgrading to Dart 2.17 & Flutter 3
STR:
Create new flutter project and write:
the code
{this.type = TextInputType.text}
throws an errorThe default value of an optional parameter must be constant.
But
TextInputType.text
is a constant valueif I run
dart analyze
I will getThe most strange part starts when I go to TextInputType.text definition and then back, or just change a file (delete symbol in
text
and then undo action), the error dissapears. And nowdart analyze
showBut once I run command
Restart Analysis Server
, it go back.It only applicable for enums. This code
doesn't show any errors.
Another strange thing is: if I put together enum and class and set the same TextInputType default value, enum will not show the error (even after analyzer restart). Like this:
But once I set TextInputType default value for enum other than
text
, and restart analyzer, error goes back.Dart SDK version: 2.17.0 (stable) on macos_arm64
Flutter 3.0.1 • channel stable
IDE: VS Code
The text was updated successfully, but these errors were encountered: