Open
Description
See this example:
var b = 7;
var w = const A([b]); // INVALID_CONSTANT
var x = const A([if (true) b]); // INVALID_CONSTANT
var y = const A([if (false) b]); // NON_CONSTANT_LIST_ELEMENT
var z = const [b]; // NON_CONSTANT_LIST_ELEMENT
class A {
const A(List<int> p);
}
This yields different errors for w
, x
, y
, and z
:
w
andx
:INVALID_CONSTANT
y
andz
:NON_CONSTANT_LIST_ELEMENT
I think it is particularly surprising that x
and y
have different errors. I think all of the errors should be NON_CONSTANT_LIST_ELEMENT
. This inconsistency could represent just the in-progress improvements to errors-that-occur-in-const-instance-creation.
CC @kallentu