-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.feature-dot-shorthandsImplementation of the dot shorthands feature.Implementation of the dot shorthands feature.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
Dart SDK version: 3.9.0-235.0.dev (dev) (Fri Jun 13 21:03:03 2025 -0700) on "macos_x64"
Consider
class T
{ const T();
}
void f([T t=T()]) // ERROR: non_constant_default_value
{}non_constant_default_value is reported as expected and can be resolved by changing [T t=T()] to [T t=const T()]. But if the experimental dot shorthand syntax is used to invoke the same constructor without the const keyword, no error is reported by the static analyzer via VSCode
void f([T t=.new()]) // no error :(
{}The error is only reported when trying to run the code
Metadata
Metadata
Assignees
Labels
area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.feature-dot-shorthandsImplementation of the dot shorthands feature.Implementation of the dot shorthands feature.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)