| library; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:5:1: Error: A library can't opt out of null safety by default, when using sound null safety. |
| // // @dart=2.8 |
| // ^^^^^^^^^^^^ |
| // |
| import self as self; |
| import "non_nullable_from_opt_out_lib.dart" as non; |
| import "dart:core" as core; |
| |
| import "org-dartlang-testcase:///non_nullable_from_opt_out_lib.dart"; |
| |
| static method main() → dynamic { |
| non::topLevelField = null; |
| non::finalTopLevelField = null; |
| non::Class<core::int*>* c = new non::Class::•<core::int*>(); |
| c.{non::Class::instanceField} = null; |
| c.{non::Class::finalInstanceField} = null; |
| c.{non::Class::instanceTypeVariable} = null; |
| c.{non::Class::finalInstanceTypeVariable} = null; |
| non::Class::staticField = null; |
| non::Class::staticFinalField = null; |
| non::expect(null, non::topLevelField); |
| non::expect(null, non::finalTopLevelField); |
| non::expect(null, c.{non::Class::instanceField}{core::int*}); |
| non::expect(null, c.{non::Class::finalInstanceField}{dynamic}); |
| non::expect(null, c.{non::Class::instanceTypeVariable}{core::int*}); |
| non::expect(null, c.{non::Class::finalInstanceTypeVariable}{core::int*}); |
| non::expect(null, non::Class::staticField); |
| non::expect(null, non::Class::staticFinalField); |
| non::throws(() → Null => non::finalTopLevelField = null); |
| non::throws(() → Null => c.{non::Class::finalInstanceField} = null); |
| non::throws(() → Null => c.{non::Class::finalInstanceTypeVariable} = null); |
| non::throws(() → Null => non::Class::staticFinalField = null); |
| non::method<Null>(true, null, null); |
| } |
| |
| library /*isNonNullableByDefault*/; |
| import self as non; |
| import "dart:core" as core; |
| import "dart:_internal" as _in; |
| |
| class Class<T extends core::Object> extends core::Object { |
| field core::int? _#Class#instanceField = null; |
| field dynamic _#Class#finalInstanceField = null; |
| field core::bool _#Class#finalInstanceField#isSet = false; |
| generic-covariant-impl field non::Class::T? _#Class#instanceTypeVariable = null; |
| field non::Class::T? _#Class#finalInstanceTypeVariable = null; |
| static field core::int? _#staticField = null; |
| static field dynamic _#staticFinalField = null; |
| static field core::bool _#staticFinalField#isSet = false; |
| synthetic constructor •() → non::Class<non::Class::T> |
| : super core::Object::•() |
| ; |
| get instanceField() → core::int |
| return let final core::int? #t1 = this.{non::Class::_#Class#instanceField}{core::int?} in #t1 == null ?{core::int} throw new _in::LateError::fieldNI("instanceField") : #t1{core::int}; |
| set instanceField(core::int #t2) → void |
| this.{non::Class::_#Class#instanceField} = #t2; |
| get finalInstanceField() → dynamic |
| return this.{non::Class::_#Class#finalInstanceField#isSet}{core::bool} ?{dynamic} this.{non::Class::_#Class#finalInstanceField}{dynamic} : throw new _in::LateError::fieldNI("finalInstanceField"); |
| set finalInstanceField(dynamic #t3) → void |
| if(this.{non::Class::_#Class#finalInstanceField#isSet}{core::bool}) |
| throw new _in::LateError::fieldAI("finalInstanceField"); |
| else { |
| this.{non::Class::_#Class#finalInstanceField#isSet} = true; |
| this.{non::Class::_#Class#finalInstanceField} = #t3; |
| } |
| get instanceTypeVariable() → non::Class::T |
| return let final non::Class::T? #t4 = this.{non::Class::_#Class#instanceTypeVariable}{non::Class::T?} in #t4 == null ?{non::Class::T} throw new _in::LateError::fieldNI("instanceTypeVariable") : #t4{non::Class::T}; |
| set instanceTypeVariable(generic-covariant-impl non::Class::T #t5) → void |
| this.{non::Class::_#Class#instanceTypeVariable} = #t5; |
| get finalInstanceTypeVariable() → non::Class::T |
| return let final non::Class::T? #t6 = this.{non::Class::_#Class#finalInstanceTypeVariable}{non::Class::T?} in #t6 == null ?{non::Class::T} throw new _in::LateError::fieldNI("finalInstanceTypeVariable") : #t6{non::Class::T}; |
| set finalInstanceTypeVariable(non::Class::T #t7) → void |
| if(this.{non::Class::_#Class#finalInstanceTypeVariable}{non::Class::T?} == null) |
| this.{non::Class::_#Class#finalInstanceTypeVariable} = #t7; |
| else |
| throw new _in::LateError::fieldAI("finalInstanceTypeVariable"); |
| static get staticField() → core::int |
| return let final core::int? #t8 = non::Class::_#staticField in #t8 == null ?{core::int} throw new _in::LateError::fieldNI("staticField") : #t8{core::int}; |
| static set staticField(core::int #t9) → void |
| non::Class::_#staticField = #t9; |
| static get staticFinalField() → dynamic |
| return non::Class::_#staticFinalField#isSet ?{dynamic} non::Class::_#staticFinalField : throw new _in::LateError::fieldNI("staticFinalField"); |
| static set staticFinalField(dynamic #t10) → void |
| if(non::Class::_#staticFinalField#isSet) |
| throw new _in::LateError::fieldAI("staticFinalField"); |
| else { |
| non::Class::_#staticFinalField#isSet = true; |
| non::Class::_#staticFinalField = #t10; |
| } |
| } |
| static field core::int? _#topLevelField = null; |
| static field dynamic _#finalTopLevelField = null; |
| static field core::bool _#finalTopLevelField#isSet = false; |
| static get topLevelField() → core::int |
| return let final core::int? #t11 = non::_#topLevelField in #t11 == null ?{core::int} throw new _in::LateError::fieldNI("topLevelField") : #t11{core::int}; |
| static set topLevelField(core::int #t12) → void |
| non::_#topLevelField = #t12; |
| static get finalTopLevelField() → dynamic |
| return non::_#finalTopLevelField#isSet ?{dynamic} non::_#finalTopLevelField : throw new _in::LateError::fieldNI("finalTopLevelField"); |
| static set finalTopLevelField(dynamic #t13) → void |
| if(non::_#finalTopLevelField#isSet) |
| throw new _in::LateError::fieldAI("finalTopLevelField"); |
| else { |
| non::_#finalTopLevelField#isSet = true; |
| non::_#finalTopLevelField = #t13; |
| } |
| static method method<T extends core::Object>(core::bool b, core::int i, non::method::T t) → dynamic { |
| lowered core::int? #local; |
| function #local#get() → core::int |
| return let final core::int? #t14 = #local in #t14 == null ?{core::int} throw new _in::LateError::localNI("local") : #t14{core::int}; |
| function #local#set(core::int #t15) → dynamic |
| return #local = #t15; |
| lowered final dynamic #finalLocal; |
| lowered core::bool #finalLocal#isSet = false; |
| function #finalLocal#get() → dynamic |
| return #finalLocal#isSet ?{dynamic} #finalLocal : throw new _in::LateError::localNI("finalLocal"); |
| function #finalLocal#set(dynamic #t16) → dynamic |
| if(#finalLocal#isSet) |
| throw new _in::LateError::localAI("finalLocal"); |
| else { |
| #finalLocal#isSet = true; |
| return #finalLocal = #t16; |
| } |
| lowered non::method::T? #localTypeVariable; |
| function #localTypeVariable#get() → non::method::T |
| return let final non::method::T? #t17 = #localTypeVariable in #t17 == null ?{non::method::T} throw new _in::LateError::localNI("localTypeVariable") : #t17{non::method::T}; |
| function #localTypeVariable#set(non::method::T #t18) → dynamic |
| return #localTypeVariable = #t18; |
| lowered final non::method::T? #finalLocalTypeVariable; |
| function #finalLocalTypeVariable#get() → non::method::T |
| return let final non::method::T? #t19 = #finalLocalTypeVariable in #t19 == null ?{non::method::T} throw new _in::LateError::localNI("finalLocalTypeVariable") : #t19{non::method::T}; |
| function #finalLocalTypeVariable#set(non::method::T #t20) → dynamic |
| if(#finalLocalTypeVariable == null) |
| return #finalLocalTypeVariable = #t20; |
| else |
| throw new _in::LateError::localAI("finalLocalTypeVariable"); |
| if(b) { |
| #local#set(i){(core::int) → dynamic}; |
| #finalLocal#set(i){(dynamic) → dynamic}; |
| #localTypeVariable#set(t){(non::method::T) → dynamic}; |
| #finalLocalTypeVariable#set(t){(non::method::T) → dynamic}; |
| non::expect(i, #local#get(){() → core::int}); |
| non::expect(i, #finalLocal#get(){() → dynamic}); |
| non::expect(t, #localTypeVariable#get(){() → non::method::T}); |
| non::expect(t, #finalLocalTypeVariable#get(){() → non::method::T}); |
| } |
| non::throws(() → void => #finalLocal#set(i){(dynamic) → dynamic}); |
| non::throws(() → void => #finalLocalTypeVariable#set(t){(non::method::T) → dynamic}); |
| } |
| static method expect(dynamic expected, dynamic actual) → dynamic { |
| if(!(expected =={core::Object::==}{(core::Object) → core::bool} actual)) |
| throw "Expected ${expected}, actual ${actual}"; |
| } |
| static method throws(() → void f) → dynamic { |
| try { |
| f(){() → void}; |
| } |
| on core::Object catch(final core::Object _) { |
| return; |
| } |
| throw "Missing exception"; |
| } |