Skip to content

[Enhanced enums] Runtime error when printing enum with mixin #48303

Closed
@sgrekhov

Description

@sgrekhov

The following code produces runtime error

mixin M1 on Enum {
  int mixedInMethod1(int v) => v;
}

enum E with M1 {
  e1,
  e2,
  e3;
}

main() {
  print(E.e1);
}

Output is

Unhandled exception:
Invalid argument (object): toString method returned 'null': Instance of 'E'
#0      _StringBase._interpolateSingle (dart:core-patch/string_patch.dart:834:7)
#1      print (dart:core/print.dart:9:26)
#2      main (file:///C:/Users/sgrek/Work/Google/co19/LanguageFeatures/Enhanced-Enum/semantics_A03_t05.dart:47:3)
#3      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:19)
#4      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)

Process finished with exit code 255

Tested on Dart SDK version: 2.17.0-69.0.dev (dev) (Fri Jan 28 00:44:27 2022 -0800) on "windows_x64"

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions