DescriptionReport a compile-time error if a const field is multiply initialized.
This CL makes analyzer consistent with the VM and the spec, by
producing a compile-time error for code such as:
class C {
final x = 1;
const C() : x = 2;
}
main() {
const C();
}
Note that Dart2js also produces an error in this circumstance, but its
error is too general (the error should only be produced if the const
constructor is invoked using "const"; if the const constructor is
invoked using "new", or is not invoked at all, it should only be a
warning). See #23618.
R=brianwilkerson@google.com
Committed: https://github.com/dart-lang/sdk/commit/2f610a3ff53413efa688b8e58e0842f599e6c8fa
Patch Set 1 #
Messages
Total messages: 4 (1 generated)
|