[cfe,dart2js] Add late from dill dart2js test

This tests how the CFE handles loading dills with the dart2js
late lowering.

The currently fails because the fields have changed type and
assignability, as seen from the CFE perspective.

Change-Id: I2229db29144538f0cf5c2ea88c4453c58032d4b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213768
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
This commit is contained in:
Johnni Winther 2021-09-17 19:07:21 +00:00 committed by commit-bot@chromium.org
parent dc58616486
commit 9a97bb58d5
11 changed files with 1250 additions and 0 deletions

View file

@ -0,0 +1,99 @@
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'main_lib1.dart';
import 'main_lib2.dart' as lib;
void main() {
testUninitializedNonFinalInstanceField();
testUninitializedFinalInstanceField();
testInitializedNonFinalInstanceField();
testInitializedFinalInstanceField();
testNullableUninitializedNonFinalLocal();
testNonNullableUninitializedNonFinalLocal();
testNullableUninitializedFinalLocal();
testNonNullableUninitializedFinalLocal();
testNullableInitializedNonFinalLocal();
testNonNullableInitializedNonFinalLocal();
testNullableInitializedFinalLocal();
testNonNullableInitializedFinalLocal();
testUninitializedNonFinalStaticField();
testUninitializedFinalStaticField();
testInitializedNonFinalStaticField();
testInitializedFinalStaticField();
testUninitializedNonFinalTopLevelField();
testUninitializedFinalTopLevelField();
testInitializedNonFinalTopLevelField();
testInitializedFinalTopLevelField();
}
var c = C();
void testUninitializedNonFinalInstanceField() {
print(c.a);
c.a = 42;
print(c.a);
}
void testUninitializedFinalInstanceField() {
print(c.b);
c.b = 42;
print(c.b);
}
void testInitializedNonFinalInstanceField() {
print(c.c);
c.c = 42;
print(c.c);
}
void testInitializedFinalInstanceField() {
print(c.d);
}
void testUninitializedNonFinalStaticField() {
print(Statics.a);
Statics.a = 42;
print(Statics.a);
}
void testUninitializedFinalStaticField() {
print(Statics.b);
Statics.b = 42;
print(Statics.b);
}
void testInitializedNonFinalStaticField() {
print(Statics.c);
Statics.c = 42;
print(Statics.c);
}
void testInitializedFinalStaticField() {
print(Statics.d);
}
void testUninitializedNonFinalTopLevelField() {
print(lib.a);
lib.a = 42;
print(lib.a);
}
void testUninitializedFinalTopLevelField() {
print(lib.b);
lib.b = 42;
print(lib.b);
}
void testInitializedNonFinalTopLevelField() {
print(lib.c);
lib.c = 42;
print(lib.c);
}
void testInitializedFinalTopLevelField() {
print(lib.d);
}

View file

@ -0,0 +1,225 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/dart2js/late_from_dill/main.dart:59:11: Error: Setter not found: 'a'.
// Statics.a = 42;
// ^
//
// pkg/front_end/testcases/dart2js/late_from_dill/main.dart:65:11: Error: Setter not found: 'b'.
// Statics.b = 42;
// ^
//
// pkg/front_end/testcases/dart2js/late_from_dill/main.dart:81:7: Error: Setter not found: 'a'.
// lib.a = 42;
// ^
//
// pkg/front_end/testcases/dart2js/late_from_dill/main.dart:87:7: Error: Setter not found: 'b'.
// lib.b = 42;
// ^
//
import self as self;
import "main_lib1.dart" as mai;
import "dart:core" as core;
import "main_lib2.dart" as mai2;
import "org-dartlang-testcase:///main_lib1.dart";
import "org-dartlang-testcase:///main_lib2.dart" as lib;
static field mai::C c = new mai::C::•();
static method main() → void {
self::testUninitializedNonFinalInstanceField();
self::testUninitializedFinalInstanceField();
self::testInitializedNonFinalInstanceField();
self::testInitializedFinalInstanceField();
mai::testNullableUninitializedNonFinalLocal();
mai::testNonNullableUninitializedNonFinalLocal();
mai::testNullableUninitializedFinalLocal();
mai::testNonNullableUninitializedFinalLocal();
mai::testNullableInitializedNonFinalLocal();
mai::testNonNullableInitializedNonFinalLocal();
mai::testNullableInitializedFinalLocal();
mai::testNonNullableInitializedFinalLocal();
self::testUninitializedNonFinalStaticField();
self::testUninitializedFinalStaticField();
self::testInitializedNonFinalStaticField();
self::testInitializedFinalStaticField();
self::testUninitializedNonFinalTopLevelField();
self::testUninitializedFinalTopLevelField();
self::testInitializedNonFinalTopLevelField();
self::testInitializedFinalTopLevelField();
}
static method testUninitializedNonFinalInstanceField() → void {
core::print(self::c.{mai::C::a}{core::int});
self::c.{mai::C::a} = 42;
core::print(self::c.{mai::C::a}{core::int});
}
static method testUninitializedFinalInstanceField() → void {
core::print(self::c.{mai::C::b}{core::int});
self::c.{mai::C::b} = 42;
core::print(self::c.{mai::C::b}{core::int});
}
static method testInitializedNonFinalInstanceField() → void {
core::print(self::c.{mai::C::c}{core::int});
self::c.{mai::C::c} = 42;
core::print(self::c.{mai::C::c}{core::int});
}
static method testInitializedFinalInstanceField() → void {
core::print(self::c.{mai::C::d}{core::int});
}
static method testUninitializedNonFinalStaticField() → void {
core::print(mai::Statics::a);
invalid-expression "pkg/front_end/testcases/dart2js/late_from_dill/main.dart:59:11: Error: Setter not found: 'a'.
Statics.a = 42;
^";
core::print(mai::Statics::a);
}
static method testUninitializedFinalStaticField() → void {
core::print(mai::Statics::b);
invalid-expression "pkg/front_end/testcases/dart2js/late_from_dill/main.dart:65:11: Error: Setter not found: 'b'.
Statics.b = 42;
^";
core::print(mai::Statics::b);
}
static method testInitializedNonFinalStaticField() → void {
core::print(mai::Statics::c);
mai::Statics::c = 42;
core::print(mai::Statics::c);
}
static method testInitializedFinalStaticField() → void {
core::print(mai::Statics::d);
}
static method testUninitializedNonFinalTopLevelField() → void {
core::print(mai2::a);
invalid-expression "pkg/front_end/testcases/dart2js/late_from_dill/main.dart:81:7: Error: Setter not found: 'a'.
lib.a = 42;
^";
core::print(mai2::a);
}
static method testUninitializedFinalTopLevelField() → void {
core::print(mai2::b);
invalid-expression "pkg/front_end/testcases/dart2js/late_from_dill/main.dart:87:7: Error: Setter not found: 'b'.
lib.b = 42;
^";
core::print(mai2::b);
}
static method testInitializedNonFinalTopLevelField() → void {
core::print(mai2::c);
mai2::c = 42;
core::print(mai2::c);
}
static method testInitializedFinalTopLevelField() → void {
core::print(mai2::d);
}
library /*isNonNullableByDefault*/;
import self as mai;
import "dart:core" as core;
import "dart:_late_helper" as _la;
import "dart:_internal" as _in;
class C extends core::Object {
field core::int _#C#a = _in::createSentinel<core::int>();
field core::int _#C#b = _in::createSentinel<core::int>();
field core::int _#C#c = _in::createSentinel<core::int>();
field core::int _#C#d = _in::createSentinel<core::int>();
synthetic constructor •() → mai::C
: super core::Object::•()
;
static method _#new#tearOff() → mai::C
return new mai::C::•();
get a() → core::int
return _la::_lateReadCheck<core::int>(this.{mai::C::_#C#a}{core::int}, "a");
set a(core::int value) → void
this.{mai::C::_#C#a} = value;
get b() → core::int
return _la::_lateReadCheck<core::int>(this.{mai::C::_#C#b}{core::int}, "b");
set b(core::int value) → void {
_la::_lateWriteOnceCheck(this.{mai::C::_#C#b}{core::int}, "b");
this.{mai::C::_#C#b} = value;
}
get c() → core::int {
core::int value = this.{mai::C::_#C#c}{core::int};
if(_in::isSentinel(value))
value = this.{mai::C::_#C#c} = 1.{core::int::unary-}(){() → core::int};
return value;
}
set c(core::int value) → void
this.{mai::C::_#C#c} = value;
get d() → core::int {
core::int value = this.{mai::C::_#C#d}{core::int};
if(_in::isSentinel(value)) {
final core::int result = 1.{core::int::unary-}(){() → core::int};
_la::_lateInitializeOnceCheck(this.{mai::C::_#C#d}{core::int}, "d");
value = this.{mai::C::_#C#d} = result;
}
return value;
}
}
class Statics extends core::Object {
static final field _la::_Cell a = new _la::_Cell::named("a");
static final field _la::_Cell b = new _la::_Cell::named("b");
late static field core::int c = 1.{core::int::unary-}(){() → core::int};
late static final field core::int d = 1.{core::int::unary-}(){() → core::int};
synthetic constructor •() → mai::Statics
: super core::Object::•()
;
static method _#new#tearOff() → mai::Statics
return new mai::Statics::•();
}
static method testNullableUninitializedNonFinalLocal() → void {
final _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::value} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() → core::int});
}
static method testNonNullableUninitializedNonFinalLocal() → void {
final _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::value} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() → core::int});
}
static method testNullableUninitializedFinalLocal() → void {
final _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::finalLocalValue} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() → core::int});
}
static method testNonNullableUninitializedFinalLocal() → void {
final _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::finalLocalValue} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() → core::int});
}
static method testNullableInitializedNonFinalLocal() → void {
final _la::_InitializedCell x = new _la::_InitializedCell::named("x", () → core::int? => 1.{core::int::unary-}(){() → core::int});
core::print(x.{_la::_InitializedCell::read}<core::int>(){() → core::int});
x.{_la::_InitializedCell::value} = 42;
core::print(x.{_la::_InitializedCell::read}<core::int>(){() → core::int});
final _la::_InitializedCell y = new _la::_InitializedCell::named("y", () → core::int? => null);
core::print(y.{_la::_InitializedCell::read}<core::int?>(){() → core::int?});
y.{_la::_InitializedCell::value} = 42;
core::print(y.{_la::_InitializedCell::read}<core::int>(){() → core::int});
}
static method testNonNullableInitializedNonFinalLocal() → void {
final _la::_InitializedCell x = new _la::_InitializedCell::named("x", () → core::int => 1.{core::int::unary-}(){() → core::int});
core::print(x.{_la::_InitializedCell::read}<core::int>(){() → core::int});
x.{_la::_InitializedCell::value} = 42;
core::print(x.{_la::_InitializedCell::read}<core::int>(){() → core::int});
}
static method testNullableInitializedFinalLocal() → void {
final _la::_InitializedCell x = new _la::_InitializedCell::named("x", () → core::int? => 1.{core::int::unary-}(){() → core::int});
core::print(x.{_la::_InitializedCell::readFinal}<core::int?>(){() → core::int?});
final _la::_InitializedCell y = new _la::_InitializedCell::named("y", () → core::int? => null);
core::print(y.{_la::_InitializedCell::readFinal}<core::int?>(){() → core::int?});
}
static method testNonNullableInitializedFinalLocal() → void {
final _la::_InitializedCell x = new _la::_InitializedCell::named("x", () → core::int => 1.{core::int::unary-}(){() → core::int});
core::print(x.{_la::_InitializedCell::readFinal}<core::int>(){() → core::int});
}
library /*isNonNullableByDefault*/;
import self as mai2;
import "dart:_late_helper" as _la;
import "dart:core" as core;
static final field _la::_Cell a = new _la::_Cell::named("a");
static final field _la::_Cell b = new _la::_Cell::named("b");
late static field core::int c = 1.{core::int::unary-}(){() → core::int};
late static final field core::int d = 1.{core::int::unary-}(){() → core::int};

View file

@ -0,0 +1,239 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/dart2js/late_from_dill/main.dart:59:11: Error: Setter not found: 'a'.
// Statics.a = 42;
// ^
//
// pkg/front_end/testcases/dart2js/late_from_dill/main.dart:65:11: Error: Setter not found: 'b'.
// Statics.b = 42;
// ^
//
// pkg/front_end/testcases/dart2js/late_from_dill/main.dart:81:7: Error: Setter not found: 'a'.
// lib.a = 42;
// ^
//
// pkg/front_end/testcases/dart2js/late_from_dill/main.dart:87:7: Error: Setter not found: 'b'.
// lib.b = 42;
// ^
//
import self as self;
import "main_lib1.dart" as mai;
import "dart:core" as core;
import "main_lib2.dart" as mai2;
import "org-dartlang-testcase:///main_lib1.dart";
import "org-dartlang-testcase:///main_lib2.dart" as lib;
static field mai::C c = new mai::C::•();
static method main() → void {
self::testUninitializedNonFinalInstanceField();
self::testUninitializedFinalInstanceField();
self::testInitializedNonFinalInstanceField();
self::testInitializedFinalInstanceField();
mai::testNullableUninitializedNonFinalLocal();
mai::testNonNullableUninitializedNonFinalLocal();
mai::testNullableUninitializedFinalLocal();
mai::testNonNullableUninitializedFinalLocal();
mai::testNullableInitializedNonFinalLocal();
mai::testNonNullableInitializedNonFinalLocal();
mai::testNullableInitializedFinalLocal();
mai::testNonNullableInitializedFinalLocal();
self::testUninitializedNonFinalStaticField();
self::testUninitializedFinalStaticField();
self::testInitializedNonFinalStaticField();
self::testInitializedFinalStaticField();
self::testUninitializedNonFinalTopLevelField();
self::testUninitializedFinalTopLevelField();
self::testInitializedNonFinalTopLevelField();
self::testInitializedFinalTopLevelField();
}
static method testUninitializedNonFinalInstanceField() → void {
core::print(self::c.{mai::C::a}{core::int});
self::c.{mai::C::a} = 42;
core::print(self::c.{mai::C::a}{core::int});
}
static method testUninitializedFinalInstanceField() → void {
core::print(self::c.{mai::C::b}{core::int});
self::c.{mai::C::b} = 42;
core::print(self::c.{mai::C::b}{core::int});
}
static method testInitializedNonFinalInstanceField() → void {
core::print(self::c.{mai::C::c}{core::int});
self::c.{mai::C::c} = 42;
core::print(self::c.{mai::C::c}{core::int});
}
static method testInitializedFinalInstanceField() → void {
core::print(self::c.{mai::C::d}{core::int});
}
static method testUninitializedNonFinalStaticField() → void {
core::print(mai::Statics::a);
invalid-expression "pkg/front_end/testcases/dart2js/late_from_dill/main.dart:59:11: Error: Setter not found: 'a'.
Statics.a = 42;
^";
core::print(mai::Statics::a);
}
static method testUninitializedFinalStaticField() → void {
core::print(mai::Statics::b);
invalid-expression "pkg/front_end/testcases/dart2js/late_from_dill/main.dart:65:11: Error: Setter not found: 'b'.
Statics.b = 42;
^";
core::print(mai::Statics::b);
}
static method testInitializedNonFinalStaticField() → void {
core::print(mai::Statics::c);
mai::Statics::c = 42;
core::print(mai::Statics::c);
}
static method testInitializedFinalStaticField() → void {
core::print(mai::Statics::d);
}
static method testUninitializedNonFinalTopLevelField() → void {
core::print(mai2::a);
invalid-expression "pkg/front_end/testcases/dart2js/late_from_dill/main.dart:81:7: Error: Setter not found: 'a'.
lib.a = 42;
^";
core::print(mai2::a);
}
static method testUninitializedFinalTopLevelField() → void {
core::print(mai2::b);
invalid-expression "pkg/front_end/testcases/dart2js/late_from_dill/main.dart:87:7: Error: Setter not found: 'b'.
lib.b = 42;
^";
core::print(mai2::b);
}
static method testInitializedNonFinalTopLevelField() → void {
core::print(mai2::c);
mai2::c = 42;
core::print(mai2::c);
}
static method testInitializedFinalTopLevelField() → void {
core::print(mai2::d);
}
library /*isNonNullableByDefault*/;
import self as mai;
import "dart:core" as core;
import "dart:_late_helper" as _la;
import "dart:_internal" as _in;
class C extends core::Object {
field core::int _#C#a = _in::createSentinel<core::int>();
field core::int _#C#b = _in::createSentinel<core::int>();
field core::int _#C#c = _in::createSentinel<core::int>();
field core::int _#C#d = _in::createSentinel<core::int>();
synthetic constructor •() → mai::C
: super core::Object::•()
;
static method _#new#tearOff() → mai::C
return new mai::C::•();
get a() → core::int
return _la::_lateReadCheck<core::int>(this.{mai::C::_#C#a}{core::int}, "a");
set a(core::int value) → void
this.{mai::C::_#C#a} = value;
get b() → core::int
return _la::_lateReadCheck<core::int>(this.{mai::C::_#C#b}{core::int}, "b");
set b(core::int value) → void {
_la::_lateWriteOnceCheck(this.{mai::C::_#C#b}{core::int}, "b");
this.{mai::C::_#C#b} = value;
}
get c() → core::int {
core::int value = this.{mai::C::_#C#c}{core::int};
if(_in::isSentinel(value))
value = this.{mai::C::_#C#c} = 1.{core::int::unary-}(){() → core::int};
return value;
}
set c(core::int value) → void
this.{mai::C::_#C#c} = value;
get d() → core::int {
core::int value = this.{mai::C::_#C#d}{core::int};
if(_in::isSentinel(value)) {
final core::int result = 1.{core::int::unary-}(){() → core::int};
_la::_lateInitializeOnceCheck(this.{mai::C::_#C#d}{core::int}, "d");
value = this.{mai::C::_#C#d} = result;
}
return value;
}
}
class Statics extends core::Object {
static final field _la::_Cell a = new _la::_Cell::named("a");
static final field _la::_Cell b = new _la::_Cell::named("b");
late static field core::int c = 1.{core::int::unary-}(){() → core::int};
late static final field core::int d = 1.{core::int::unary-}(){() → core::int};
synthetic constructor •() → mai::Statics
: super core::Object::•()
;
static method _#new#tearOff() → mai::Statics
return new mai::Statics::•();
}
static method testNullableUninitializedNonFinalLocal() → void {
final _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::value} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() → core::int});
}
static method testNonNullableUninitializedNonFinalLocal() → void {
final _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::value} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() → core::int});
}
static method testNullableUninitializedFinalLocal() → void {
final _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::finalLocalValue} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() → core::int});
}
static method testNonNullableUninitializedFinalLocal() → void {
final _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::finalLocalValue} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() → core::int});
}
static method testNullableInitializedNonFinalLocal() → void {
final _la::_InitializedCell x = new _la::_InitializedCell::named("x", () → core::int? => 1.{core::int::unary-}(){() → core::int});
core::print(x.{_la::_InitializedCell::read}<core::int>(){() → core::int});
x.{_la::_InitializedCell::value} = 42;
core::print(x.{_la::_InitializedCell::read}<core::int>(){() → core::int});
final _la::_InitializedCell y = new _la::_InitializedCell::named("y", () → core::int? => null);
core::print(y.{_la::_InitializedCell::read}<core::int?>(){() → core::int?});
y.{_la::_InitializedCell::value} = 42;
core::print(y.{_la::_InitializedCell::read}<core::int>(){() → core::int});
}
static method testNonNullableInitializedNonFinalLocal() → void {
final _la::_InitializedCell x = new _la::_InitializedCell::named("x", () → core::int => 1.{core::int::unary-}(){() → core::int});
core::print(x.{_la::_InitializedCell::read}<core::int>(){() → core::int});
x.{_la::_InitializedCell::value} = 42;
core::print(x.{_la::_InitializedCell::read}<core::int>(){() → core::int});
}
static method testNullableInitializedFinalLocal() → void {
final _la::_InitializedCell x = new _la::_InitializedCell::named("x", () → core::int? => 1.{core::int::unary-}(){() → core::int});
core::print(x.{_la::_InitializedCell::readFinal}<core::int?>(){() → core::int?});
final _la::_InitializedCell y = new _la::_InitializedCell::named("y", () → core::int? => null);
core::print(y.{_la::_InitializedCell::readFinal}<core::int?>(){() → core::int?});
}
static method testNonNullableInitializedFinalLocal() → void {
final _la::_InitializedCell x = new _la::_InitializedCell::named("x", () → core::int => 1.{core::int::unary-}(){() → core::int});
core::print(x.{_la::_InitializedCell::readFinal}<core::int>(){() → core::int});
}
library /*isNonNullableByDefault*/;
import self as mai2;
import "dart:_late_helper" as _la;
import "dart:core" as core;
static final field _la::_Cell a = new _la::_Cell::named("a");
static final field _la::_Cell b = new _la::_Cell::named("b");
late static field core::int c = 1.{core::int::unary-}(){() → core::int};
late static final field core::int d = 1.{core::int::unary-}(){() → core::int};
Extra constant evaluation status:
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib1.dart:8:16 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib1.dart:9:22 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib1.dart:15:23 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib1.dart:16:29 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib1.dart:44:17 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib1.dart:56:16 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib1.dart:63:23 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib1.dart:71:22 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib2.dart:7:14 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib2.dart:8:20 -> DoubleConstant(-1.0)
Extra constant evaluation: evaluated: 205, effectively constant: 10

View file

@ -0,0 +1,17 @@
import 'main_lib1.dart';
import 'main_lib2.dart' as lib;
void main() {}
var c = C();
void testUninitializedNonFinalInstanceField() {}
void testUninitializedFinalInstanceField() {}
void testInitializedNonFinalInstanceField() {}
void testInitializedFinalInstanceField() {}
void testUninitializedNonFinalStaticField() {}
void testUninitializedFinalStaticField() {}
void testInitializedNonFinalStaticField() {}
void testInitializedFinalStaticField() {}
void testUninitializedNonFinalTopLevelField() {}
void testUninitializedFinalTopLevelField() {}
void testInitializedNonFinalTopLevelField() {}
void testInitializedFinalTopLevelField() {}

View file

@ -0,0 +1,17 @@
import 'main_lib1.dart';
import 'main_lib2.dart' as lib;
var c = C();
void main() {}
void testInitializedFinalInstanceField() {}
void testInitializedFinalStaticField() {}
void testInitializedFinalTopLevelField() {}
void testInitializedNonFinalInstanceField() {}
void testInitializedNonFinalStaticField() {}
void testInitializedNonFinalTopLevelField() {}
void testUninitializedFinalInstanceField() {}
void testUninitializedFinalStaticField() {}
void testUninitializedFinalTopLevelField() {}
void testUninitializedNonFinalInstanceField() {}
void testUninitializedNonFinalStaticField() {}
void testUninitializedNonFinalTopLevelField() {}

View file

@ -0,0 +1,225 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/dart2js/late_from_dill/main.dart:59:11: Error: Setter not found: 'a'.
// Statics.a = 42;
// ^
//
// pkg/front_end/testcases/dart2js/late_from_dill/main.dart:65:11: Error: Setter not found: 'b'.
// Statics.b = 42;
// ^
//
// pkg/front_end/testcases/dart2js/late_from_dill/main.dart:81:7: Error: Setter not found: 'a'.
// lib.a = 42;
// ^
//
// pkg/front_end/testcases/dart2js/late_from_dill/main.dart:87:7: Error: Setter not found: 'b'.
// lib.b = 42;
// ^
//
import self as self;
import "main_lib1.dart" as mai;
import "dart:core" as core;
import "main_lib2.dart" as mai2;
import "org-dartlang-testcase:///main_lib1.dart";
import "org-dartlang-testcase:///main_lib2.dart" as lib;
static field mai::C c = new mai::C::•();
static method main() → void {
self::testUninitializedNonFinalInstanceField();
self::testUninitializedFinalInstanceField();
self::testInitializedNonFinalInstanceField();
self::testInitializedFinalInstanceField();
mai::testNullableUninitializedNonFinalLocal();
mai::testNonNullableUninitializedNonFinalLocal();
mai::testNullableUninitializedFinalLocal();
mai::testNonNullableUninitializedFinalLocal();
mai::testNullableInitializedNonFinalLocal();
mai::testNonNullableInitializedNonFinalLocal();
mai::testNullableInitializedFinalLocal();
mai::testNonNullableInitializedFinalLocal();
self::testUninitializedNonFinalStaticField();
self::testUninitializedFinalStaticField();
self::testInitializedNonFinalStaticField();
self::testInitializedFinalStaticField();
self::testUninitializedNonFinalTopLevelField();
self::testUninitializedFinalTopLevelField();
self::testInitializedNonFinalTopLevelField();
self::testInitializedFinalTopLevelField();
}
static method testUninitializedNonFinalInstanceField() → void {
core::print(self::c.{mai::C::a}{core::int});
self::c.{mai::C::a} = 42;
core::print(self::c.{mai::C::a}{core::int});
}
static method testUninitializedFinalInstanceField() → void {
core::print(self::c.{mai::C::b}{core::int});
self::c.{mai::C::b} = 42;
core::print(self::c.{mai::C::b}{core::int});
}
static method testInitializedNonFinalInstanceField() → void {
core::print(self::c.{mai::C::c}{core::int});
self::c.{mai::C::c} = 42;
core::print(self::c.{mai::C::c}{core::int});
}
static method testInitializedFinalInstanceField() → void {
core::print(self::c.{mai::C::d}{core::int});
}
static method testUninitializedNonFinalStaticField() → void {
core::print(mai::Statics::a);
invalid-expression "pkg/front_end/testcases/dart2js/late_from_dill/main.dart:59:11: Error: Setter not found: 'a'.
Statics.a = 42;
^";
core::print(mai::Statics::a);
}
static method testUninitializedFinalStaticField() → void {
core::print(mai::Statics::b);
invalid-expression "pkg/front_end/testcases/dart2js/late_from_dill/main.dart:65:11: Error: Setter not found: 'b'.
Statics.b = 42;
^";
core::print(mai::Statics::b);
}
static method testInitializedNonFinalStaticField() → void {
core::print(mai::Statics::c);
mai::Statics::c = 42;
core::print(mai::Statics::c);
}
static method testInitializedFinalStaticField() → void {
core::print(mai::Statics::d);
}
static method testUninitializedNonFinalTopLevelField() → void {
core::print(mai2::a);
invalid-expression "pkg/front_end/testcases/dart2js/late_from_dill/main.dart:81:7: Error: Setter not found: 'a'.
lib.a = 42;
^";
core::print(mai2::a);
}
static method testUninitializedFinalTopLevelField() → void {
core::print(mai2::b);
invalid-expression "pkg/front_end/testcases/dart2js/late_from_dill/main.dart:87:7: Error: Setter not found: 'b'.
lib.b = 42;
^";
core::print(mai2::b);
}
static method testInitializedNonFinalTopLevelField() → void {
core::print(mai2::c);
mai2::c = 42;
core::print(mai2::c);
}
static method testInitializedFinalTopLevelField() → void {
core::print(mai2::d);
}
library /*isNonNullableByDefault*/;
import self as mai;
import "dart:core" as core;
import "dart:_late_helper" as _la;
import "dart:_internal" as _in;
class C extends core::Object {
field core::int _#C#a = _in::createSentinel<core::int>();
field core::int _#C#b = _in::createSentinel<core::int>();
field core::int _#C#c = _in::createSentinel<core::int>();
field core::int _#C#d = _in::createSentinel<core::int>();
synthetic constructor •() → mai::C
: super core::Object::•()
;
static method _#new#tearOff() → mai::C
return new mai::C::•();
get a() → core::int
return _la::_lateReadCheck<core::int>(this.{mai::C::_#C#a}{core::int}, "a");
set a(core::int value) → void
this.{mai::C::_#C#a} = value;
get b() → core::int
return _la::_lateReadCheck<core::int>(this.{mai::C::_#C#b}{core::int}, "b");
set b(core::int value) → void {
_la::_lateWriteOnceCheck(this.{mai::C::_#C#b}{core::int}, "b");
this.{mai::C::_#C#b} = value;
}
get c() → core::int {
core::int value = this.{mai::C::_#C#c}{core::int};
if(_in::isSentinel(value))
value = this.{mai::C::_#C#c} = 1.{core::int::unary-}(){() → core::int};
return value;
}
set c(core::int value) → void
this.{mai::C::_#C#c} = value;
get d() → core::int {
core::int value = this.{mai::C::_#C#d}{core::int};
if(_in::isSentinel(value)) {
final core::int result = 1.{core::int::unary-}(){() → core::int};
_la::_lateInitializeOnceCheck(this.{mai::C::_#C#d}{core::int}, "d");
value = this.{mai::C::_#C#d} = result;
}
return value;
}
}
class Statics extends core::Object {
static final field _la::_Cell a = new _la::_Cell::named("a");
static final field _la::_Cell b = new _la::_Cell::named("b");
late static field core::int c = 1.{core::int::unary-}(){() → core::int};
late static final field core::int d = 1.{core::int::unary-}(){() → core::int};
synthetic constructor •() → mai::Statics
: super core::Object::•()
;
static method _#new#tearOff() → mai::Statics
return new mai::Statics::•();
}
static method testNullableUninitializedNonFinalLocal() → void {
final _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::value} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() → core::int});
}
static method testNonNullableUninitializedNonFinalLocal() → void {
final _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::value} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() → core::int});
}
static method testNullableUninitializedFinalLocal() → void {
final _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::finalLocalValue} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() → core::int});
}
static method testNonNullableUninitializedFinalLocal() → void {
final _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::finalLocalValue} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() → core::int});
}
static method testNullableInitializedNonFinalLocal() → void {
final _la::_InitializedCell x = new _la::_InitializedCell::named("x", () → core::int? => 1.{core::int::unary-}(){() → core::int});
core::print(x.{_la::_InitializedCell::read}<core::int>(){() → core::int});
x.{_la::_InitializedCell::value} = 42;
core::print(x.{_la::_InitializedCell::read}<core::int>(){() → core::int});
final _la::_InitializedCell y = new _la::_InitializedCell::named("y", () → core::int? => null);
core::print(y.{_la::_InitializedCell::read}<core::int?>(){() → core::int?});
y.{_la::_InitializedCell::value} = 42;
core::print(y.{_la::_InitializedCell::read}<core::int>(){() → core::int});
}
static method testNonNullableInitializedNonFinalLocal() → void {
final _la::_InitializedCell x = new _la::_InitializedCell::named("x", () → core::int => 1.{core::int::unary-}(){() → core::int});
core::print(x.{_la::_InitializedCell::read}<core::int>(){() → core::int});
x.{_la::_InitializedCell::value} = 42;
core::print(x.{_la::_InitializedCell::read}<core::int>(){() → core::int});
}
static method testNullableInitializedFinalLocal() → void {
final _la::_InitializedCell x = new _la::_InitializedCell::named("x", () → core::int? => 1.{core::int::unary-}(){() → core::int});
core::print(x.{_la::_InitializedCell::readFinal}<core::int?>(){() → core::int?});
final _la::_InitializedCell y = new _la::_InitializedCell::named("y", () → core::int? => null);
core::print(y.{_la::_InitializedCell::readFinal}<core::int?>(){() → core::int?});
}
static method testNonNullableInitializedFinalLocal() → void {
final _la::_InitializedCell x = new _la::_InitializedCell::named("x", () → core::int => 1.{core::int::unary-}(){() → core::int});
core::print(x.{_la::_InitializedCell::readFinal}<core::int>(){() → core::int});
}
library /*isNonNullableByDefault*/;
import self as mai2;
import "dart:_late_helper" as _la;
import "dart:core" as core;
static final field _la::_Cell a = new _la::_Cell::named("a");
static final field _la::_Cell b = new _la::_Cell::named("b");
late static field core::int c = 1.{core::int::unary-}(){() → core::int};
late static final field core::int d = 1.{core::int::unary-}(){() → core::int};

View file

@ -0,0 +1,106 @@
library /*isNonNullableByDefault*/;
import self as self;
import "main_lib1.dart" as mai;
import "org-dartlang-testcase:///main_lib1.dart";
import "org-dartlang-testcase:///main_lib2.dart" as lib;
static field mai::C c;
static method main() → void
;
static method testUninitializedNonFinalInstanceField() → void
;
static method testUninitializedFinalInstanceField() → void
;
static method testInitializedNonFinalInstanceField() → void
;
static method testInitializedFinalInstanceField() → void
;
static method testUninitializedNonFinalStaticField() → void
;
static method testUninitializedFinalStaticField() → void
;
static method testInitializedNonFinalStaticField() → void
;
static method testInitializedFinalStaticField() → void
;
static method testUninitializedNonFinalTopLevelField() → void
;
static method testUninitializedFinalTopLevelField() → void
;
static method testInitializedNonFinalTopLevelField() → void
;
static method testInitializedFinalTopLevelField() → void
;
library /*isNonNullableByDefault*/;
import self as mai;
import "dart:core" as core;
import "dart:_late_helper" as _la;
import "dart:_internal" as _in;
class C extends core::Object {
field core::int _#C#a = _in::createSentinel<core::int>();
field core::int _#C#b = _in::createSentinel<core::int>();
field core::int _#C#c = _in::createSentinel<core::int>();
field core::int _#C#d = _in::createSentinel<core::int>();
synthetic constructor •() → mai::C
;
static method _#new#tearOff() → mai::C
return new mai::C::•();
get a() → core::int
return _la::_lateReadCheck<core::int>(this.{mai::C::_#C#a}{core::int}, "a");
set a(core::int value) → void
this.{mai::C::_#C#a} = value;
get b() → core::int
return _la::_lateReadCheck<core::int>(this.{mai::C::_#C#b}{core::int}, "b");
set b(core::int value) → void {
_la::_lateWriteOnceCheck(this.{mai::C::_#C#b}{core::int}, "b");
this.{mai::C::_#C#b} = value;
}
get c() → core::int
return _la::_lateReadCheck<core::int>(this.{mai::C::_#C#c}{core::int}, "c");
set c(core::int value) → void
this.{mai::C::_#C#c} = value;
get d() → core::int
return _la::_lateReadCheck<core::int>(this.{mai::C::_#C#d}{core::int}, "d");
set d(core::int value) → void {
_la::_lateWriteOnceCheck(this.{mai::C::_#C#d}{core::int}, "d");
this.{mai::C::_#C#d} = value;
}
}
class Statics extends core::Object {
static final field _la::_Cell a = new _la::_Cell::named("a");
static final field _la::_Cell b = new _la::_Cell::named("b");
static final field _la::_Cell c = new _la::_Cell::named("c");
static final field _la::_Cell d = new _la::_Cell::named("d");
synthetic constructor •() → mai::Statics
;
static method _#new#tearOff() → mai::Statics
return new mai::Statics::•();
}
static method testNullableUninitializedNonFinalLocal() → void
;
static method testNonNullableUninitializedNonFinalLocal() → void
;
static method testNullableUninitializedFinalLocal() → void
;
static method testNonNullableUninitializedFinalLocal() → void
;
static method testNullableInitializedNonFinalLocal() → void
;
static method testNonNullableInitializedNonFinalLocal() → void
;
static method testNullableInitializedFinalLocal() → void
;
static method testNonNullableInitializedFinalLocal() → void
;
library /*isNonNullableByDefault*/;
import self as self2;
import "dart:_late_helper" as _la;
static final field _la::_Cell a = new _la::_Cell::named("a");
static final field _la::_Cell b = new _la::_Cell::named("b");
static final field _la::_Cell c = new _la::_Cell::named("c");
static final field _la::_Cell d = new _la::_Cell::named("d");

View file

@ -0,0 +1,239 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/dart2js/late_from_dill/main.dart:59:11: Error: Setter not found: 'a'.
// Statics.a = 42;
// ^
//
// pkg/front_end/testcases/dart2js/late_from_dill/main.dart:65:11: Error: Setter not found: 'b'.
// Statics.b = 42;
// ^
//
// pkg/front_end/testcases/dart2js/late_from_dill/main.dart:81:7: Error: Setter not found: 'a'.
// lib.a = 42;
// ^
//
// pkg/front_end/testcases/dart2js/late_from_dill/main.dart:87:7: Error: Setter not found: 'b'.
// lib.b = 42;
// ^
//
import self as self;
import "main_lib1.dart" as mai;
import "dart:core" as core;
import "main_lib2.dart" as mai2;
import "org-dartlang-testcase:///main_lib1.dart";
import "org-dartlang-testcase:///main_lib2.dart" as lib;
static field mai::C c = new mai::C::•();
static method main() → void {
self::testUninitializedNonFinalInstanceField();
self::testUninitializedFinalInstanceField();
self::testInitializedNonFinalInstanceField();
self::testInitializedFinalInstanceField();
mai::testNullableUninitializedNonFinalLocal();
mai::testNonNullableUninitializedNonFinalLocal();
mai::testNullableUninitializedFinalLocal();
mai::testNonNullableUninitializedFinalLocal();
mai::testNullableInitializedNonFinalLocal();
mai::testNonNullableInitializedNonFinalLocal();
mai::testNullableInitializedFinalLocal();
mai::testNonNullableInitializedFinalLocal();
self::testUninitializedNonFinalStaticField();
self::testUninitializedFinalStaticField();
self::testInitializedNonFinalStaticField();
self::testInitializedFinalStaticField();
self::testUninitializedNonFinalTopLevelField();
self::testUninitializedFinalTopLevelField();
self::testInitializedNonFinalTopLevelField();
self::testInitializedFinalTopLevelField();
}
static method testUninitializedNonFinalInstanceField() → void {
core::print(self::c.{mai::C::a}{core::int});
self::c.{mai::C::a} = 42;
core::print(self::c.{mai::C::a}{core::int});
}
static method testUninitializedFinalInstanceField() → void {
core::print(self::c.{mai::C::b}{core::int});
self::c.{mai::C::b} = 42;
core::print(self::c.{mai::C::b}{core::int});
}
static method testInitializedNonFinalInstanceField() → void {
core::print(self::c.{mai::C::c}{core::int});
self::c.{mai::C::c} = 42;
core::print(self::c.{mai::C::c}{core::int});
}
static method testInitializedFinalInstanceField() → void {
core::print(self::c.{mai::C::d}{core::int});
}
static method testUninitializedNonFinalStaticField() → void {
core::print(mai::Statics::a);
invalid-expression "pkg/front_end/testcases/dart2js/late_from_dill/main.dart:59:11: Error: Setter not found: 'a'.
Statics.a = 42;
^";
core::print(mai::Statics::a);
}
static method testUninitializedFinalStaticField() → void {
core::print(mai::Statics::b);
invalid-expression "pkg/front_end/testcases/dart2js/late_from_dill/main.dart:65:11: Error: Setter not found: 'b'.
Statics.b = 42;
^";
core::print(mai::Statics::b);
}
static method testInitializedNonFinalStaticField() → void {
core::print(mai::Statics::c);
mai::Statics::c = 42;
core::print(mai::Statics::c);
}
static method testInitializedFinalStaticField() → void {
core::print(mai::Statics::d);
}
static method testUninitializedNonFinalTopLevelField() → void {
core::print(mai2::a);
invalid-expression "pkg/front_end/testcases/dart2js/late_from_dill/main.dart:81:7: Error: Setter not found: 'a'.
lib.a = 42;
^";
core::print(mai2::a);
}
static method testUninitializedFinalTopLevelField() → void {
core::print(mai2::b);
invalid-expression "pkg/front_end/testcases/dart2js/late_from_dill/main.dart:87:7: Error: Setter not found: 'b'.
lib.b = 42;
^";
core::print(mai2::b);
}
static method testInitializedNonFinalTopLevelField() → void {
core::print(mai2::c);
mai2::c = 42;
core::print(mai2::c);
}
static method testInitializedFinalTopLevelField() → void {
core::print(mai2::d);
}
library /*isNonNullableByDefault*/;
import self as mai;
import "dart:core" as core;
import "dart:_late_helper" as _la;
import "dart:_internal" as _in;
class C extends core::Object {
field core::int _#C#a = _in::createSentinel<core::int>();
field core::int _#C#b = _in::createSentinel<core::int>();
field core::int _#C#c = _in::createSentinel<core::int>();
field core::int _#C#d = _in::createSentinel<core::int>();
synthetic constructor •() → mai::C
: super core::Object::•()
;
static method _#new#tearOff() → mai::C
return new mai::C::•();
get a() → core::int
return _la::_lateReadCheck<core::int>(this.{mai::C::_#C#a}{core::int}, "a");
set a(core::int value) → void
this.{mai::C::_#C#a} = value;
get b() → core::int
return _la::_lateReadCheck<core::int>(this.{mai::C::_#C#b}{core::int}, "b");
set b(core::int value) → void {
_la::_lateWriteOnceCheck(this.{mai::C::_#C#b}{core::int}, "b");
this.{mai::C::_#C#b} = value;
}
get c() → core::int {
core::int value = this.{mai::C::_#C#c}{core::int};
if(_in::isSentinel(value))
value = this.{mai::C::_#C#c} = 1.{core::int::unary-}(){() → core::int};
return value;
}
set c(core::int value) → void
this.{mai::C::_#C#c} = value;
get d() → core::int {
core::int value = this.{mai::C::_#C#d}{core::int};
if(_in::isSentinel(value)) {
final core::int result = 1.{core::int::unary-}(){() → core::int};
_la::_lateInitializeOnceCheck(this.{mai::C::_#C#d}{core::int}, "d");
value = this.{mai::C::_#C#d} = result;
}
return value;
}
}
class Statics extends core::Object {
static final field _la::_Cell a = new _la::_Cell::named("a");
static final field _la::_Cell b = new _la::_Cell::named("b");
late static field core::int c = 1.{core::int::unary-}(){() → core::int};
late static final field core::int d = 1.{core::int::unary-}(){() → core::int};
synthetic constructor •() → mai::Statics
: super core::Object::•()
;
static method _#new#tearOff() → mai::Statics
return new mai::Statics::•();
}
static method testNullableUninitializedNonFinalLocal() → void {
final _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::value} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() → core::int});
}
static method testNonNullableUninitializedNonFinalLocal() → void {
final _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::value} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() → core::int});
}
static method testNullableUninitializedFinalLocal() → void {
final _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::finalLocalValue} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() → core::int});
}
static method testNonNullableUninitializedFinalLocal() → void {
final _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::finalLocalValue} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() → core::int});
}
static method testNullableInitializedNonFinalLocal() → void {
final _la::_InitializedCell x = new _la::_InitializedCell::named("x", () → core::int? => 1.{core::int::unary-}(){() → core::int});
core::print(x.{_la::_InitializedCell::read}<core::int>(){() → core::int});
x.{_la::_InitializedCell::value} = 42;
core::print(x.{_la::_InitializedCell::read}<core::int>(){() → core::int});
final _la::_InitializedCell y = new _la::_InitializedCell::named("y", () → core::int? => null);
core::print(y.{_la::_InitializedCell::read}<core::int?>(){() → core::int?});
y.{_la::_InitializedCell::value} = 42;
core::print(y.{_la::_InitializedCell::read}<core::int>(){() → core::int});
}
static method testNonNullableInitializedNonFinalLocal() → void {
final _la::_InitializedCell x = new _la::_InitializedCell::named("x", () → core::int => 1.{core::int::unary-}(){() → core::int});
core::print(x.{_la::_InitializedCell::read}<core::int>(){() → core::int});
x.{_la::_InitializedCell::value} = 42;
core::print(x.{_la::_InitializedCell::read}<core::int>(){() → core::int});
}
static method testNullableInitializedFinalLocal() → void {
final _la::_InitializedCell x = new _la::_InitializedCell::named("x", () → core::int? => 1.{core::int::unary-}(){() → core::int});
core::print(x.{_la::_InitializedCell::readFinal}<core::int?>(){() → core::int?});
final _la::_InitializedCell y = new _la::_InitializedCell::named("y", () → core::int? => null);
core::print(y.{_la::_InitializedCell::readFinal}<core::int?>(){() → core::int?});
}
static method testNonNullableInitializedFinalLocal() → void {
final _la::_InitializedCell x = new _la::_InitializedCell::named("x", () → core::int => 1.{core::int::unary-}(){() → core::int});
core::print(x.{_la::_InitializedCell::readFinal}<core::int>(){() → core::int});
}
library /*isNonNullableByDefault*/;
import self as mai2;
import "dart:_late_helper" as _la;
import "dart:core" as core;
static final field _la::_Cell a = new _la::_Cell::named("a");
static final field _la::_Cell b = new _la::_Cell::named("b");
late static field core::int c = 1.{core::int::unary-}(){() → core::int};
late static final field core::int d = 1.{core::int::unary-}(){() → core::int};
Extra constant evaluation status:
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib1.dart:8:16 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib1.dart:9:22 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib1.dart:15:23 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib1.dart:16:29 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib1.dart:44:17 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib1.dart:56:16 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib1.dart:63:23 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib1.dart:71:22 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib2.dart:7:14 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///main_lib2.dart:8:20 -> DoubleConstant(-1.0)
Extra constant evaluation: evaluated: 205, effectively constant: 10

View file

@ -0,0 +1,73 @@
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
class C {
late int a;
late final int b;
late int c = -1;
late final int d = -1;
}
class Statics {
static late int a;
static late final int b;
static late int c = -1;
static late final int d = -1;
}
void testNullableUninitializedNonFinalLocal() {
late int? x;
x = 42;
print(x);
}
void testNonNullableUninitializedNonFinalLocal() {
late int x;
x = 42;
print(x);
}
void testNullableUninitializedFinalLocal() {
late final int? x;
x = 42;
print(x);
}
void testNonNullableUninitializedFinalLocal() {
late final int x;
x = 42;
print(x);
}
void testNullableInitializedNonFinalLocal() {
late int? x = -1;
print(x);
x = 42;
print(x);
late int? y = null;
print(y);
y = 42;
print(y);
}
void testNonNullableInitializedNonFinalLocal() {
late int x = -1;
print(x);
x = 42;
print(x);
}
void testNullableInitializedFinalLocal() {
late final int? x = -1;
print(x);
late final int? y = null;
print(y);
}
void testNonNullableInitializedFinalLocal() {
late final int x = -1;
print(x);
}

View file

@ -0,0 +1,8 @@
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
late int a;
late final int b;
late int c = -1;
late final int d = -1;

View file

@ -0,0 +1,2 @@
main_lib1.dart
main_lib2.dart