We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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"
Dart SDK version: 2.17.0-69.0.dev (dev) (Fri Jan 28 00:44:27 2022 -0800) on "windows_x64"
The text was updated successfully, but these errors were encountered:
//cc @alexmarkov
Sorry, something went wrong.
For some reason CFE didn't generate the body of toString method in E. The empty body just returns null, hence the exception is thrown.
toString
E
null
Kernel:
abstract class M1 extends core::Enum /*isMixinDeclaration*/ { method mixedInMethod1(core::int v) → core::int return v; } abstract class _E&_Enum&M1 extends core::_Enum implements tes::M1 /*isAnonymousMixin,isEliminatedMixin,hasConstConstructor*/ { const synthetic constructor •(core::int index, core::String _name) → tes::_E&_Enum&M1 : super core::_Enum::•(index, _name) ; method mixedInMethod1(core::int v) → core::int return v; } class E extends tes::_E&_Enum&M1 /*isEnum*/ { static const field core::List<tes::E> values = #C10; static const field tes::E e1 = #C3; static const field tes::E e2 = #C6; static const field tes::E e3 = #C9; const constructor •(core::int index, core::String name) → tes::E : super tes::_E&_Enum&M1::•(index, name) ; method toString() → core::String ; } static method main() → dynamic { core::print(#C3); }
@chloestefantsova Could you please take a look?
ab84be0
chloestefantsova
No branches or pull requests
The following code produces runtime error
Output is
Tested on
Dart SDK version: 2.17.0-69.0.dev (dev) (Fri Jan 28 00:44:27 2022 -0800) on "windows_x64"
The text was updated successfully, but these errors were encountered: