|
| 1 | +library /*isNonNullableByDefault*/; |
| 2 | +// |
| 3 | +// Problems in library: |
| 4 | +// |
| 5 | +// pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart:21:7: Error: The argument type 'E<String>' can't be assigned to the parameter type 'E<int>'. |
| 6 | +// - 'E' is from 'pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart'. |
| 7 | +// bar(es, ei); // Error. |
| 8 | +// ^ |
| 9 | +// |
| 10 | +// pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart:21:11: Error: The argument type 'E<int>' can't be assigned to the parameter type 'E<String>'. |
| 11 | +// - 'E' is from 'pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart'. |
| 12 | +// bar(es, ei); // Error. |
| 13 | +// ^ |
| 14 | +// |
| 15 | +// pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart:22:9: Error: The argument type 'E<String>' can't be assigned to the parameter type 'E<int>'. |
| 16 | +// - 'E' is from 'pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart'. |
| 17 | +// bar(E.two, E.one); // Error. |
| 18 | +// ^ |
| 19 | +// |
| 20 | +// pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart:22:16: Error: The argument type 'E<int>' can't be assigned to the parameter type 'E<String>'. |
| 21 | +// - 'E' is from 'pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart'. |
| 22 | +// bar(E.two, E.one); // Error. |
| 23 | +// ^ |
| 24 | +// |
| 25 | +// pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart:30:7: Error: The argument type 'E<Object>' can't be assigned to the parameter type 'E<Never>'. |
| 26 | +// - 'E' is from 'pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart'. |
| 27 | +// - 'Object' is from 'dart:core'. |
| 28 | +// boz(ei, es); // Error. |
| 29 | +// ^ |
| 30 | +// |
| 31 | +// pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart:30:11: Error: The argument type 'E<Object>' can't be assigned to the parameter type 'E<Never>'. |
| 32 | +// - 'E' is from 'pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart'. |
| 33 | +// - 'Object' is from 'dart:core'. |
| 34 | +// boz(ei, es); // Error. |
| 35 | +// ^ |
| 36 | +// |
| 37 | +// pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart:31:9: Error: The argument type 'E<int>' can't be assigned to the parameter type 'E<Never>'. |
| 38 | +// - 'E' is from 'pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart'. |
| 39 | +// boz(E.one, E.two); // Error. |
| 40 | +// ^ |
| 41 | +// |
| 42 | +// pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart:31:16: Error: The argument type 'E<String>' can't be assigned to the parameter type 'E<Never>'. |
| 43 | +// - 'E' is from 'pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart'. |
| 44 | +// boz(E.one, E.two); // Error. |
| 45 | +// ^ |
| 46 | +// |
| 47 | +import self as self; |
| 48 | +import "dart:core" as core; |
| 49 | + |
| 50 | +class E<X extends core::Object? = dynamic> extends core::_Enum /*isEnum*/ { |
| 51 | + static const field core::List<self::E<dynamic>> values = #C8; |
| 52 | + static const field self::E<core::int> one = #C4; |
| 53 | + static const field self::E<core::String> two = #C7; |
| 54 | + final field self::E::X% field; |
| 55 | + const constructor •(core::int index, core::String name, self::E::X% field) → self::E<self::E::X%> |
| 56 | + : self::E::field = field, super core::_Enum::•(index, name) |
| 57 | + ; |
| 58 | + method toString() → core::String |
| 59 | + return "E.${this.{core::_Enum::_name}{core::String}}"; |
| 60 | +} |
| 61 | +static method test() → dynamic { |
| 62 | + self::foo(#C4, #C7); |
| 63 | +} |
| 64 | +static method foo(self::E<core::int> ei, self::E<core::String> es) → dynamic { |
| 65 | + self::bar(ei, es); |
| 66 | + self::bar(#C4, #C7); |
| 67 | + self::bar(invalid-expression "pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart:21:7: Error: The argument type 'E<String>' can't be assigned to the parameter type 'E<int>'. |
| 68 | + - 'E' is from 'pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart'. |
| 69 | + bar(es, ei); // Error. |
| 70 | + ^" in es as{TypeError,ForNonNullableByDefault} self::E<core::int>, invalid-expression "pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart:21:11: Error: The argument type 'E<int>' can't be assigned to the parameter type 'E<String>'. |
| 71 | + - 'E' is from 'pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart'. |
| 72 | + bar(es, ei); // Error. |
| 73 | + ^" in ei as{TypeError,ForNonNullableByDefault} self::E<core::String>); |
| 74 | + self::bar(invalid-expression "pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart:22:9: Error: The argument type 'E<String>' can't be assigned to the parameter type 'E<int>'. |
| 75 | + - 'E' is from 'pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart'. |
| 76 | + bar(E.two, E.one); // Error. |
| 77 | + ^" in #C7 as{TypeError,ForNonNullableByDefault} self::E<core::int>, invalid-expression "pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart:22:16: Error: The argument type 'E<int>' can't be assigned to the parameter type 'E<String>'. |
| 78 | + - 'E' is from 'pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart'. |
| 79 | + bar(E.two, E.one); // Error. |
| 80 | + ^" in #C4 as{TypeError,ForNonNullableByDefault} self::E<core::String>); |
| 81 | +} |
| 82 | +static method bar(self::E<core::int> ei, self::E<core::String> es) → dynamic { |
| 83 | + self::baz(ei, es); |
| 84 | +} |
| 85 | +static method baz(self::E<core::Object> ei, self::E<core::Object> es) → dynamic { |
| 86 | + self::boz(invalid-expression "pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart:30:7: Error: The argument type 'E<Object>' can't be assigned to the parameter type 'E<Never>'. |
| 87 | + - 'E' is from 'pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart'. |
| 88 | + - 'Object' is from 'dart:core'. |
| 89 | + boz(ei, es); // Error. |
| 90 | + ^" in ei as{TypeError,ForNonNullableByDefault} self::E<Never>, invalid-expression "pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart:30:11: Error: The argument type 'E<Object>' can't be assigned to the parameter type 'E<Never>'. |
| 91 | + - 'E' is from 'pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart'. |
| 92 | + - 'Object' is from 'dart:core'. |
| 93 | + boz(ei, es); // Error. |
| 94 | + ^" in es as{TypeError,ForNonNullableByDefault} self::E<Never>); |
| 95 | + self::boz(invalid-expression "pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart:31:9: Error: The argument type 'E<int>' can't be assigned to the parameter type 'E<Never>'. |
| 96 | + - 'E' is from 'pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart'. |
| 97 | + boz(E.one, E.two); // Error. |
| 98 | + ^" in #C4 as{TypeError,ForNonNullableByDefault} self::E<Never>, invalid-expression "pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart:31:16: Error: The argument type 'E<String>' can't be assigned to the parameter type 'E<Never>'. |
| 99 | + - 'E' is from 'pkg/front_end/testcases/enhanced_enums/instantiated_generic_enum_types.dart'. |
| 100 | + boz(E.one, E.two); // Error. |
| 101 | + ^" in #C7 as{TypeError,ForNonNullableByDefault} self::E<Never>); |
| 102 | +} |
| 103 | +static method boz(self::E<Never> ei, self::E<Never> es) → dynamic {} |
| 104 | +static method checkIsType<T extends core::Object? = dynamic>(dynamic x) → dynamic { |
| 105 | + if(!(x is{ForNonNullableByDefault} self::checkIsType::T%)) { |
| 106 | + throw "Expected value of type ${x.{core::Object::runtimeType}{core::Type}} to also be of type ${self::checkIsType::T%}."; |
| 107 | + } |
| 108 | +} |
| 109 | +static method checkIsNotType<T extends core::Object? = dynamic>(dynamic x) → dynamic { |
| 110 | + if(x is{ForNonNullableByDefault} self::checkIsNotType::T%) { |
| 111 | + throw "Expected value of type ${x{self::checkIsNotType::T%}.{core::Object::runtimeType}{core::Type}} to not be of type ${self::checkIsNotType::T%}."; |
| 112 | + } |
| 113 | +} |
| 114 | +static method main() → dynamic { |
| 115 | + self::checkIsType<self::E<dynamic>>(#C4); |
| 116 | + self::checkIsType<self::E<dynamic>>(#C7); |
| 117 | + self::checkIsType<self::E<core::int>>(#C4); |
| 118 | + self::checkIsType<self::E<core::String>>(#C7); |
| 119 | + self::checkIsNotType<self::E<Never>>(#C4); |
| 120 | + self::checkIsNotType<self::E<Never>>(#C7); |
| 121 | + self::checkIsNotType<self::E<core::String>>(#C4); |
| 122 | + self::checkIsNotType<self::E<core::int>>(#C7); |
| 123 | +} |
| 124 | + |
| 125 | +constants { |
| 126 | + #C1 = 1 |
| 127 | + #C2 = 0 |
| 128 | + #C3 = "one" |
| 129 | + #C4 = self::E<core::int> {field:#C1, index:#C2, _name:#C3} |
| 130 | + #C5 = "2" |
| 131 | + #C6 = "two" |
| 132 | + #C7 = self::E<core::String> {field:#C5, index:#C1, _name:#C6} |
| 133 | + #C8 = <self::E<dynamic>>[#C4, #C7] |
| 134 | +} |
| 135 | + |
| 136 | + |
| 137 | +Constructor coverage from constants: |
| 138 | +org-dartlang-testcase:///instantiated_generic_enum_types.dart: |
| 139 | +- E. (from org-dartlang-testcase:///instantiated_generic_enum_types.dart:11:9) |
| 140 | +- _Enum. (from org-dartlang-sdk:///sdk/lib/core/enum.dart:76:9) |
| 141 | +- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9) |
0 commit comments