| library /*isNonNullableByDefault*/; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/nnbd/issue41657.dart:10:41: Error: Constant evaluation error: |
| // const assertLegacySubtyping1 = <Null>[] as List<int>; |
| // ^ |
| // pkg/front_end/testcases/nnbd/issue41657.dart:10:41: Context: Expected constant '<Null>[]' to be of type 'List<int>', but was of type 'List<Null>'. |
| // - 'List' is from 'dart:core'. |
| // const assertLegacySubtyping1 = <Null>[] as List<int>; |
| // ^ |
| // pkg/front_end/testcases/nnbd/issue41657.dart:10:7: Context: While analyzing: |
| // const assertLegacySubtyping1 = <Null>[] as List<int>; |
| // ^ |
| // |
| // pkg/front_end/testcases/nnbd/issue41657.dart:12:41: Error: Constant evaluation error: |
| // const assertLegacySubtyping2 = <int?>[] as List<int>; |
| // ^ |
| // pkg/front_end/testcases/nnbd/issue41657.dart:12:41: Context: Expected constant '<int?>[]' to be of type 'List<int>', but was of type 'List<int?>'. |
| // - 'List' is from 'dart:core'. |
| // const assertLegacySubtyping2 = <int?>[] as List<int>; |
| // ^ |
| // pkg/front_end/testcases/nnbd/issue41657.dart:12:7: Context: While analyzing: |
| // const assertLegacySubtyping2 = <int?>[] as List<int>; |
| // ^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| |
| static final field core::bool isLegacySubtyping1a = <Null>[] is{ForNonNullableByDefault} core::List<core::int>; |
| static const field core::bool isLegacySubtyping1b = #C1; |
| static final field core::bool isLegacySubtyping2a = <core::int?>[] is{ForNonNullableByDefault} core::List<core::int>; |
| static const field core::bool isLegacySubtyping2b = #C1; |
| static const field core::List<core::int> assertLegacySubtyping1 = invalid-expression "Expected constant '<Null>[]' to be of type 'List<int>', but was of type 'List<Null>'. |
| - 'List' is from 'dart:core'."; |
| static const field core::List<core::int> assertLegacySubtyping2 = 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, #C1); |
| self::expect(self::isLegacySubtyping2a, #C1); |
| } |
| static method expect(dynamic expected, dynamic actual) → dynamic { |
| if(!(expected =={core::Object::==}{(core::Object) → core::bool} actual)) |
| throw "Expected ${expected}, actual ${actual}"; |
| } |
| |
| constants { |
| #C1 = false |
| } |