| library; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/dart2js/issue41657.dart:10:48: Error: Constant evaluation error: |
| // const assertLegacySubtyping1b = const <Null>[] as List<int>; |
| // ^ |
| // pkg/front_end/testcases/dart2js/issue41657.dart:10:48: Context: Expected constant '<Null>[]' to be of type 'List<int>', but was of type 'List<Null>'. |
| // - 'List' is from 'dart:core'. |
| // const assertLegacySubtyping1b = const <Null>[] as List<int>; |
| // ^ |
| // pkg/front_end/testcases/dart2js/issue41657.dart:10:7: Context: While analyzing: |
| // const assertLegacySubtyping1b = const <Null>[] as List<int>; |
| // ^ |
| // |
| // pkg/front_end/testcases/dart2js/issue41657.dart:12:48: Error: Constant evaluation error: |
| // const assertLegacySubtyping2b = const <int?>[] as List<int>; |
| // ^ |
| // pkg/front_end/testcases/dart2js/issue41657.dart:12:48: Context: Expected constant '<int?>[]' to be of type 'List<int>', but was of type 'List<int?>'. |
| // - 'List' is from 'dart:core'. |
| // const assertLegacySubtyping2b = const <int?>[] as List<int>; |
| // ^ |
| // pkg/front_end/testcases/dart2js/issue41657.dart:12:7: Context: While analyzing: |
| // const assertLegacySubtyping2b = const <int?>[] as List<int>; |
| // ^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| |
| static final field core::bool isLegacySubtyping1a = #C1 is core::List<core::int>; |
| static const field core::bool isLegacySubtyping1b = #C2; |
| static final field core::bool isLegacySubtyping2a = #C3 is core::List<core::int>; |
| static const field core::bool isLegacySubtyping2b = #C2; |
| static final field core::List<core::int> assertLegacySubtyping1a = #C1 as core::List<core::int>; |
| static const field core::List<core::int> assertLegacySubtyping1b = invalid-expression "Expected constant '<Null>[]' to be of type 'List<int>', but was of type 'List<Null>'. |
| - 'List' is from 'dart:core'."; |
| static final field core::List<core::int> assertLegacySubtyping2a = #C3 as core::List<core::int>; |
| static const field core::List<core::int> assertLegacySubtyping2b = invalid-expression "Expected constant '<int?>[]' to be of type 'List<int>', but was of type 'List<int?>'. |
| - 'List' is from 'dart:core'."; |
| static method main() → void { |
| self::expect(self::isLegacySubtyping1a, #C2); |
| self::expect(self::isLegacySubtyping2a, #C2); |
| self::expect(self::assertLegacySubtyping1a, invalid-expression "Expected constant '<Null>[]' to be of type 'List<int>', but was of type 'List<Null>'. |
| - 'List' is from 'dart:core'."); |
| self::expect(self::assertLegacySubtyping2a, invalid-expression "Expected constant '<int?>[]' to be of type 'List<int>', but was of type 'List<int?>'. |
| - 'List' is from 'dart:core'."); |
| } |
| static method expect(dynamic expected, dynamic actual) → dynamic { |
| if(!(expected =={core::Object::==}{(core::Object) → core::bool} actual)) |
| throw "Expected ${expected}, actual ${actual}"; |
| } |
| |
| constants { |
| #C1 = <Null>[] |
| #C2 = false |
| #C3 = <core::int?>[] |
| } |
| |
| Extra constant evaluation status: |
| Evaluated: IsExpression @ org-dartlang-testcase:///issue41657.dart:5:44 -> BoolConstant(false) |
| Evaluated: IsExpression @ org-dartlang-testcase:///issue41657.dart:7:44 -> BoolConstant(false) |
| Extra constant evaluation: evaluated: 20, effectively constant: 2 |