|
| 1 | +library /*isNonNullableByDefault*/; |
| 2 | +// |
| 3 | +// Problems in library: |
| 4 | +// |
| 5 | +// pkg/front_end/testcases/enhanced_enums/simple_interfaces.dart:21:20: Error: Can't implement 'I' because it's marked with '?'. |
| 6 | +// enum E3 implements I? { // Error. |
| 7 | +// ^^ |
| 8 | +// |
| 9 | +// pkg/front_end/testcases/enhanced_enums/simple_interfaces.dart:16:6: Error: The non-abstract class 'E2' is missing implementations for these members: |
| 10 | +// - I.foo |
| 11 | +// Try to either |
| 12 | +// - provide an implementation, |
| 13 | +// - inherit an implementation from a superclass or mixin, |
| 14 | +// - mark the class as abstract, or |
| 15 | +// - provide a 'noSuchMethod' implementation. |
| 16 | +// |
| 17 | +// enum E2 implements I { // Error. |
| 18 | +// ^^ |
| 19 | +// pkg/front_end/testcases/enhanced_enums/simple_interfaces.dart:6:8: Context: 'I.foo' is defined here. |
| 20 | +// void foo(); |
| 21 | +// ^^^ |
| 22 | +// |
| 23 | +// pkg/front_end/testcases/enhanced_enums/simple_interfaces.dart:41:7: Error: The argument type 'E4' can't be assigned to the parameter type 'I'. |
| 24 | +// - 'E4' is from 'pkg/front_end/testcases/enhanced_enums/simple_interfaces.dart'. |
| 25 | +// - 'I' is from 'pkg/front_end/testcases/enhanced_enums/simple_interfaces.dart'. |
| 26 | +// bar(e4); // Error. |
| 27 | +// ^ |
| 28 | +// |
| 29 | +import self as self; |
| 30 | +import "dart:core" as core; |
| 31 | + |
| 32 | +abstract class I extends core::Object { |
| 33 | + synthetic constructor •() → self::I |
| 34 | + : super core::Object::•() |
| 35 | + ; |
| 36 | + abstract method foo() → void; |
| 37 | +} |
| 38 | +class E1 extends core::_Enum implements self::I /*isEnum*/ { |
| 39 | + static const field core::List<self::E1> values = #C7; |
| 40 | + static const field self::E1 one = #C3; |
| 41 | + static const field self::E1 two = #C6; |
| 42 | + const constructor •(core::int index, core::String name) → self::E1 |
| 43 | + : super core::_Enum::•(index, name) |
| 44 | + ; |
| 45 | + method toString() → core::String |
| 46 | + return "E1.${this.{core::_Enum::_name}{core::String}}"; |
| 47 | + method foo() → void {} |
| 48 | +} |
| 49 | +class E2 extends core::_Enum implements self::I /*isEnum*/ { |
| 50 | + static const field core::List<self::E2> values = #C10; |
| 51 | + static const field self::E2 one = #C8; |
| 52 | + static const field self::E2 two = #C9; |
| 53 | + const constructor •(core::int index, core::String name) → self::E2 |
| 54 | + : super core::_Enum::•(index, name) |
| 55 | + ; |
| 56 | + method toString() → core::String |
| 57 | + return "E2.${this.{core::_Enum::_name}{core::String}}"; |
| 58 | +} |
| 59 | +class E3 extends core::_Enum implements self::I /*isEnum*/ { |
| 60 | + static const field core::List<self::E3> values = #C13; |
| 61 | + static const field self::E3 one = #C11; |
| 62 | + static const field self::E3 two = #C12; |
| 63 | + const constructor •(core::int index, core::String name) → self::E3 |
| 64 | + : super core::_Enum::•(index, name) |
| 65 | + ; |
| 66 | + method toString() → core::String |
| 67 | + return "E3.${this.{core::_Enum::_name}{core::String}}"; |
| 68 | + method foo() → void {} |
| 69 | +} |
| 70 | +class E4 extends core::_Enum /*isEnum*/ { |
| 71 | + static const field core::List<self::E4> values = #C16; |
| 72 | + static const field self::E4 one = #C14; |
| 73 | + static const field self::E4 two = #C15; |
| 74 | + const constructor •(core::int index, core::String name) → self::E4 |
| 75 | + : super core::_Enum::•(index, name) |
| 76 | + ; |
| 77 | + method toString() → core::String |
| 78 | + return "E4.${this.{core::_Enum::_name}{core::String}}"; |
| 79 | + method foo() → void {} |
| 80 | +} |
| 81 | +static method bar(self::I i) → dynamic {} |
| 82 | +static method test(self::E1 e1, self::E2 e2, self::E3 e3, self::E4 e4) → dynamic { |
| 83 | + self::bar(e1); |
| 84 | + self::bar(e2); |
| 85 | + self::bar(e3); |
| 86 | + self::bar(invalid-expression "pkg/front_end/testcases/enhanced_enums/simple_interfaces.dart:41:7: Error: The argument type 'E4' can't be assigned to the parameter type 'I'. |
| 87 | + - 'E4' is from 'pkg/front_end/testcases/enhanced_enums/simple_interfaces.dart'. |
| 88 | + - 'I' is from 'pkg/front_end/testcases/enhanced_enums/simple_interfaces.dart'. |
| 89 | + bar(e4); // Error. |
| 90 | + ^" in e4 as{TypeError,ForNonNullableByDefault} self::I); |
| 91 | +} |
| 92 | +static method main() → dynamic {} |
| 93 | + |
| 94 | +constants { |
| 95 | + #C1 = 0 |
| 96 | + #C2 = "one" |
| 97 | + #C3 = self::E1 {index:#C1, _name:#C2} |
| 98 | + #C4 = 1 |
| 99 | + #C5 = "two" |
| 100 | + #C6 = self::E1 {index:#C4, _name:#C5} |
| 101 | + #C7 = <self::E1>[#C3, #C6] |
| 102 | + #C8 = self::E2 {index:#C1, _name:#C2} |
| 103 | + #C9 = self::E2 {index:#C4, _name:#C5} |
| 104 | + #C10 = <self::E2>[#C8, #C9] |
| 105 | + #C11 = self::E3 {index:#C1, _name:#C2} |
| 106 | + #C12 = self::E3 {index:#C4, _name:#C5} |
| 107 | + #C13 = <self::E3>[#C11, #C12] |
| 108 | + #C14 = self::E4 {index:#C1, _name:#C2} |
| 109 | + #C15 = self::E4 {index:#C4, _name:#C5} |
| 110 | + #C16 = <self::E4>[#C14, #C15] |
| 111 | +} |
| 112 | + |
| 113 | + |
| 114 | +Constructor coverage from constants: |
| 115 | +org-dartlang-testcase:///simple_interfaces.dart: |
| 116 | +- E1. (from org-dartlang-testcase:///simple_interfaces.dart:9:6) |
| 117 | +- _Enum. (from org-dartlang-sdk:///sdk/lib/core/enum.dart:76:9) |
| 118 | +- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9) |
| 119 | +- E2. (from org-dartlang-testcase:///simple_interfaces.dart:16:6) |
| 120 | +- E3. (from org-dartlang-testcase:///simple_interfaces.dart:21:6) |
| 121 | +- E4. (from org-dartlang-testcase:///simple_interfaces.dart:28:6) |
0 commit comments