blob: b56813640fa96702fe27e2b42090701c8abf2dc3 [file] [log] [blame]
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/late_lowering/compound.dart:20:3: Error: Late variable 'local' without initializer is definitely unassigned.
// local += 0;
// ^^^^^
//
import self as self;
import "dart:core" as core;
import "dart:_internal" as _in;
static method main() dynamic {
core::int? local1;
core::bool #local1#isSet = false;
function #local1#get() → core::int
return #local1#isSet ?{core::int} local1{core::int} : throw new _in::LateInitializationErrorImpl::•("Local 'local1' has not been initialized.");
function #local1#set(core::int #t1) → dynamic {
#local1#isSet = true;
return local1 = #t1;
}
#local1#set.call(0);
self::expect(0, #local1#get.call());
#local1#set.call(#local1#get.call().{core::num::+}(2));
self::expect(2, #local1#get.call());
core::int? local2;
core::bool #local2#isSet = false;
function #local2#get() → core::int {
if(!#local2#isSet) {
local2 = 1;
#local2#isSet = true;
}
return local2{core::int};
}
function #local2#set(core::int #t2) → dynamic {
#local2#isSet = true;
return local2 = #t2;
}
self::expect(1, #local2#get.call());
#local2#set.call(#local2#get.call().{core::num::+}(2));
self::expect(3, #local2#get.call());
}
static method error() dynamic {
final core::int? local;
core::bool #local#isSet = false;
function #local#get() → core::int
return #local#isSet ?{core::int} local{core::int} : throw new _in::LateInitializationErrorImpl::•("Local 'local' has not been initialized.");
function #local#set(core::int #t3) → dynamic
if(#local#isSet)
throw new _in::LateInitializationErrorImpl::•("Local 'local' has already been initialized.");
else {
#local#isSet = true;
return local = #t3;
}
#local#set.call((let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/late_lowering/compound.dart:20:3: Error: Late variable 'local' without initializer is definitely unassigned.
local += 0;
^^^^^" in #local#get.call()).{core::num::+}(0));
}
static method expect(dynamic expected, dynamic actual) → dynamic {
if(!expected.{core::Object::==}(actual))
throw "Expected ${expected}, actual ${actual}";
}