blob: 4ae5a1aaf3d3e371c3efe3560621a548cf58703e [file] [log] [blame]
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;
covariant-by-class 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 instanceField#param) → void
this.{non::Class::_#Class#instanceField} = instanceField#param;
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 finalInstanceField#param) → 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} = finalInstanceField#param;
}
get instanceTypeVariable() non::Class::T
return let final non::Class::T? #t2 = this.{non::Class::_#Class#instanceTypeVariable}{non::Class::T?} in #t2 == null ?{non::Class::T} throw new _in::LateError::fieldNI("instanceTypeVariable") : #t2{non::Class::T};
set instanceTypeVariable(covariant-by-class non::Class::T instanceTypeVariable#param) → void
this.{non::Class::_#Class#instanceTypeVariable} = instanceTypeVariable#param;
get finalInstanceTypeVariable() non::Class::T
return let final non::Class::T? #t3 = this.{non::Class::_#Class#finalInstanceTypeVariable}{non::Class::T?} in #t3 == null ?{non::Class::T} throw new _in::LateError::fieldNI("finalInstanceTypeVariable") : #t3{non::Class::T};
set finalInstanceTypeVariable(non::Class::T finalInstanceTypeVariable#param) → void
if(this.{non::Class::_#Class#finalInstanceTypeVariable}{non::Class::T?} == null)
this.{non::Class::_#Class#finalInstanceTypeVariable} = finalInstanceTypeVariable#param;
else
throw new _in::LateError::fieldAI("finalInstanceTypeVariable");
static get staticField() core::int
return let final core::int? #t4 = non::Class::_#staticField in #t4 == null ?{core::int} throw new _in::LateError::fieldNI("staticField") : #t4{core::int};
static set staticField(core::int staticField#param) → void
non::Class::_#staticField = staticField#param;
static get staticFinalField() dynamic
return non::Class::_#staticFinalField#isSet ?{dynamic} non::Class::_#staticFinalField : throw new _in::LateError::fieldNI("staticFinalField");
static set staticFinalField(dynamic staticFinalField#param) → void
if(non::Class::_#staticFinalField#isSet)
throw new _in::LateError::fieldAI("staticFinalField");
else {
non::Class::_#staticFinalField#isSet = true;
non::Class::_#staticFinalField = staticFinalField#param;
}
}
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? #t5 = non::_#topLevelField in #t5 == null ?{core::int} throw new _in::LateError::fieldNI("topLevelField") : #t5{core::int};
static set topLevelField(core::int topLevelField#param) → void
non::_#topLevelField = topLevelField#param;
static get finalTopLevelField() dynamic
return non::_#finalTopLevelField#isSet ?{dynamic} non::_#finalTopLevelField : throw new _in::LateError::fieldNI("finalTopLevelField");
static set finalTopLevelField(dynamic finalTopLevelField#param) → void
if(non::_#finalTopLevelField#isSet)
throw new _in::LateError::fieldAI("finalTopLevelField");
else {
non::_#finalTopLevelField#isSet = true;
non::_#finalTopLevelField = finalTopLevelField#param;
}
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? #t6 = #local in #t6 == null ?{core::int} throw new _in::LateError::localNI("local") : #t6{core::int};
function #local#set(core::int local#param) → dynamic
return #local = local#param;
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 finalLocal#param) → dynamic
if(#finalLocal#isSet)
throw new _in::LateError::localAI("finalLocal");
else {
#finalLocal#isSet = true;
return #finalLocal = finalLocal#param;
}
lowered non::method::T? #localTypeVariable;
function #localTypeVariable#get() → non::method::T
return let final non::method::T? #t7 = #localTypeVariable in #t7 == null ?{non::method::T} throw new _in::LateError::localNI("localTypeVariable") : #t7{non::method::T};
function #localTypeVariable#set(non::method::T localTypeVariable#param) → dynamic
return #localTypeVariable = localTypeVariable#param;
lowered final non::method::T? #finalLocalTypeVariable;
function #finalLocalTypeVariable#get() → non::method::T
return let final non::method::T? #t8 = #finalLocalTypeVariable in #t8 == null ?{non::method::T} throw new _in::LateError::localNI("finalLocalTypeVariable") : #t8{non::method::T};
function #finalLocalTypeVariable#set(non::method::T finalLocalTypeVariable#param) → dynamic
if(#finalLocalTypeVariable == null)
return #finalLocalTypeVariable = finalLocalTypeVariable#param;
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";
}