sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Better `const_with_non_constant_argument` message when argument is closure

Open FMorschel opened this issue 3 days ago • 1 comments

Repro:

enum MyEnum {
  v(() {});
//  ^ const_with_non_constant_argument

  const MyEnum(Function f);
}

Message:

Arguments of a constant creation must be constant expressions.
Try making the argument a valid constant, or use 'new' to call the constructor.

We should probably suggest creating a static method, a const constructor or a top-level function.

CC @bwilkerson

FMorschel avatar Dec 08 '25 12:12 FMorschel