sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Improve error message in case of function invocation in a constant expression

Open sgrekhov opened this issue 1 year ago • 1 comments

Object foo(Object o) => o;

const c = foo(1); 

Analyzer produces error Methods can't be invoked in constant expressions., CFE Method invocation is not a constant expression..

Why only methods? Functions and getters are also not allowed (except String.length and indentical()) to be a constant expressions.

Please update the error message accordingly.

sgrekhov avatar Feb 16 '24 11:02 sgrekhov

The analyzer has a separate message for property accesses (ie. getters), but doesn't appear to have a separate message for function invocations. Agreed that it should.

bwilkerson avatar Feb 16 '24 15:02 bwilkerson