[cfe] Handle nullability of typedefs

Closes #41496
Closes #41498
Closes #41499
Closes #41501
Closes #41505

Change-Id: I425b6137f9ea41d01c95332ef1f7d43ca7afb5a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143811
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Johnni Winther
2020-04-20 07:03:55 +00:00
committed by commit-bot@chromium.org
parent 63a92a3b00
commit d690a0c7c4
56 changed files with 2274 additions and 14 deletions
+5
View File
@@ -262,6 +262,11 @@
"rootUri": "../pkg/front_end/testcases/nnbd",
"packageUri": ".nonexisting/"
},
{
"name": "front_end_nonfunction_type_aliases",
"rootUri": "../pkg/front_end/testcases/nonfunction_type_aliases",
"packageUri": ".nonexisting/"
},
{
"name": "frontend_server",
"rootUri": "../pkg/frontend_server",
@@ -79,7 +79,7 @@ class TypeAliasBuilder extends TypeDeclarationBuilderImpl {
bool get fromDill => false;
Typedef build(SourceLibraryBuilder libraryBuilder) {
typedef..type ??= buildThisType(libraryBuilder);
typedef..type ??= buildThisType();
TypeBuilder type = this.type;
if (type is FunctionTypeBuilder) {
@@ -146,7 +146,7 @@ class TypeAliasBuilder extends TypeDeclarationBuilderImpl {
return result;
}
DartType buildThisType(LibraryBuilder library) {
DartType buildThisType() {
if (thisType != null) {
if (identical(thisType, cyclicTypeAliasMarker)) {
library.addProblem(templateCyclicTypedef.withArguments(name),
@@ -181,7 +181,7 @@ class TypeAliasBuilder extends TypeDeclarationBuilderImpl {
/// [arguments] have already been built.
DartType buildTypesWithBuiltArguments(LibraryBuilder library,
Nullability nullability, List<DartType> arguments) {
DartType thisType = buildThisType(library);
DartType thisType = buildThisType();
if (const DynamicType() == thisType) return thisType;
Nullability adjustedNullability =
isNullAlias ? Nullability.nullable : nullability;
@@ -248,26 +248,32 @@ class TypeAliasBuilder extends TypeDeclarationBuilderImpl {
DartType buildType(LibraryBuilder library,
NullabilityBuilder nullabilityBuilder, List<TypeBuilder> arguments,
[bool notInstanceContext]) {
DartType thisType = buildThisType(library);
DartType thisType = buildThisType();
if (thisType is InvalidType) return thisType;
// TODO(dmitryas): Remove the following comment when FutureOr has its own
// encoding and isn't represented as an InterfaceType.
// The following won't work if the right-hand side of the typedef is a
// FutureOr.
Nullability rhsNullability = thisType.nullability;
Nullability nullability;
if (isNullAlias) {
// Null is always nullable.
nullability = Nullability.nullable;
} else if (!parent.isNonNullableByDefault ||
!library.isNonNullableByDefault) {
// The typedef is defined or used in an opt-out library so the nullability
// is based on the use site alone.
nullability = nullabilityBuilder.build(library);
} else {
nullability = uniteNullabilities(
thisType.nullability, nullabilityBuilder.build(library));
}
if (typedef.typeParameters.isEmpty && arguments == null) {
Nullability nullability = isNullAlias
? Nullability.nullable
: nullabilityBuilder.build(library);
return thisType
.withNullability(uniteNullabilities(rhsNullability, nullability));
return thisType.withNullability(nullability);
}
// Otherwise, substitute.
return buildTypesWithBuiltArguments(
library,
uniteNullabilities(rhsNullability, nullabilityBuilder.build(library)),
buildTypeArguments(library, arguments));
library, nullability, buildTypeArguments(library, arguments));
}
TypeDeclarationBuilder _cachedUnaliasedDeclaration;
@@ -45,7 +45,7 @@ class DillTypeAliasBuilder extends TypeAliasBuilder {
}
@override
DartType buildThisType(LibraryBuilder library) {
DartType buildThisType() {
return thisType ??= typedef.type;
}
@@ -276,6 +276,9 @@ isolate
isolates
issue41210b
issue41436c
issue41496b
issue41498b
issue41499b
iter
joo
jumped
@@ -0,0 +1,15 @@
// Copyright (c) 2020, 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 "issue41496_lib.dart";
LegacyFoo f1;
class C {
static LegacyFoo f2;
}
main() {
new C();
}
@@ -0,0 +1,32 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41496.dart:7:11: Error: Field 'f1' should be initialized because its type 'void Function()' doesn't allow null.
// LegacyFoo f1;
// ^^
//
// pkg/front_end/testcases/nnbd/issue41496.dart:10:20: Error: Field 'f2' should be initialized because its type 'void Function()' doesn't allow null.
// static LegacyFoo f2;
// ^^
//
import self as self;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41496_lib.dart";
class C extends core::Object {
static field () → void f2;
synthetic constructor •() → self::C
;
}
static field () → void f1;
static method main() → dynamic
;
library opted_out_lib;
import self as self2;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic
;
@@ -0,0 +1,33 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41496.dart:7:11: Error: Field 'f1' should be initialized because its type 'void Function()' doesn't allow null.
// LegacyFoo f1;
// ^^
//
// pkg/front_end/testcases/nnbd/issue41496.dart:10:20: Error: Field 'f2' should be initialized because its type 'void Function()' doesn't allow null.
// static LegacyFoo f2;
// ^^
//
import self as self;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41496_lib.dart";
class C extends core::Object {
static field () → void f2 = null;
synthetic constructor •() → self::C
: super core::Object::•()
;
}
static field () → void f1;
static method main() → dynamic {
new self::C::•();
}
library opted_out_lib;
import self as self2;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic {}
@@ -0,0 +1,33 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41496.dart:7:11: Error: Field 'f1' should be initialized because its type 'void Function()' doesn't allow null.
// LegacyFoo f1;
// ^^
//
// pkg/front_end/testcases/nnbd/issue41496.dart:10:20: Error: Field 'f2' should be initialized because its type 'void Function()' doesn't allow null.
// static LegacyFoo f2;
// ^^
//
import self as self;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41496_lib.dart";
class C extends core::Object {
static field () → void f2 = null;
synthetic constructor •() → self::C
: super core::Object::•()
;
}
static field () → void f1;
static method main() → dynamic {
new self::C::•();
}
library opted_out_lib;
import self as self2;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic {}
@@ -0,0 +1,33 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41496.dart:7:11: Error: Field 'f1' should be initialized because its type 'void Function()' doesn't allow null.
// LegacyFoo f1;
// ^^
//
// pkg/front_end/testcases/nnbd/issue41496.dart:10:20: Error: Field 'f2' should be initialized because its type 'void Function()' doesn't allow null.
// static LegacyFoo f2;
// ^^
//
import self as self;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41496_lib.dart";
class C extends core::Object {
static field () → void f2 = null;
synthetic constructor •() → self::C
: super core::Object::•()
;
}
static field () → void f1;
static method main() → dynamic {
new self::C::•();
}
library opted_out_lib;
import self as self2;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic {}
@@ -0,0 +1,33 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41496.dart:7:11: Error: Field 'f1' should be initialized because its type 'void Function()' doesn't allow null.
// LegacyFoo f1;
// ^^
//
// pkg/front_end/testcases/nnbd/issue41496.dart:10:20: Error: Field 'f2' should be initialized because its type 'void Function()' doesn't allow null.
// static LegacyFoo f2;
// ^^
//
import self as self;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41496_lib.dart";
class C extends core::Object {
static field () → void f2 = null;
synthetic constructor •() → self::C
: super core::Object::•()
;
}
static field () → void f1;
static method main() → dynamic {
new self::C::•();
}
library opted_out_lib;
import self as self2;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic {}
@@ -0,0 +1,11 @@
// Copyright (c) 2020, 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.
// @dart=2.6
library opted_out_lib;
typedef void LegacyFoo();
test(LegacyFoo f) {}
@@ -0,0 +1,17 @@
// Copyright (c) 2020, 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.
// @dart=2.6
library opted_out_lib;
import 'issue41496b_lib.dart' as opt_in;
typedef void LegacyFoo();
test(LegacyFoo f) {}
main() {
opt_in.main();
}
@@ -0,0 +1,36 @@
library opted_out_lib;
import self as self;
import "org-dartlang-testcase:///issue41496b_lib.dart" as opt_in;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic
;
static method main() → dynamic
;
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41496b_lib.dart:7:11: Error: Field 'f1' should be initialized because its type 'void Function()' doesn't allow null.
// LegacyFoo f1;
// ^^
//
// pkg/front_end/testcases/nnbd/issue41496b_lib.dart:10:20: Error: Field 'f2' should be initialized because its type 'void Function()' doesn't allow null.
// static LegacyFoo f2;
// ^^
//
import self as self2;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41496b.dart";
class C extends core::Object {
static field () → void f2;
synthetic constructor •() → self2::C
;
}
static field () → void f1;
static method main() → dynamic
;
@@ -0,0 +1,39 @@
library opted_out_lib;
import self as self;
import "issue41496b_lib.dart" as iss;
import "org-dartlang-testcase:///issue41496b_lib.dart" as opt_in;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic {}
static method main() → dynamic {
iss::main();
}
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41496b_lib.dart:7:11: Error: Field 'f1' should be initialized because its type 'void Function()' doesn't allow null.
// LegacyFoo f1;
// ^^
//
// pkg/front_end/testcases/nnbd/issue41496b_lib.dart:10:20: Error: Field 'f2' should be initialized because its type 'void Function()' doesn't allow null.
// static LegacyFoo f2;
// ^^
//
import self as iss;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41496b.dart";
class C extends core::Object {
static field () → void f2 = null;
synthetic constructor •() → iss::C
: super core::Object::•()
;
}
static field () → void f1;
static method main() → dynamic {
new iss::C::•();
}
@@ -0,0 +1,39 @@
library opted_out_lib;
import self as self;
import "issue41496b_lib.dart" as iss;
import "org-dartlang-testcase:///issue41496b_lib.dart" as opt_in;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic {}
static method main() → dynamic {
iss::main();
}
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41496b_lib.dart:7:11: Error: Field 'f1' should be initialized because its type 'void Function()' doesn't allow null.
// LegacyFoo f1;
// ^^
//
// pkg/front_end/testcases/nnbd/issue41496b_lib.dart:10:20: Error: Field 'f2' should be initialized because its type 'void Function()' doesn't allow null.
// static LegacyFoo f2;
// ^^
//
import self as iss;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41496b.dart";
class C extends core::Object {
static field () → void f2 = null;
synthetic constructor •() → iss::C
: super core::Object::•()
;
}
static field () → void f1;
static method main() → dynamic {
new iss::C::•();
}
@@ -0,0 +1,39 @@
library opted_out_lib;
import self as self;
import "issue41496b_lib.dart" as iss;
import "org-dartlang-testcase:///issue41496b_lib.dart" as opt_in;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic {}
static method main() → dynamic {
iss::main();
}
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41496b_lib.dart:7:11: Error: Field 'f1' should be initialized because its type 'void Function()' doesn't allow null.
// LegacyFoo f1;
// ^^
//
// pkg/front_end/testcases/nnbd/issue41496b_lib.dart:10:20: Error: Field 'f2' should be initialized because its type 'void Function()' doesn't allow null.
// static LegacyFoo f2;
// ^^
//
import self as iss;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41496b.dart";
class C extends core::Object {
static field () → void f2 = null;
synthetic constructor •() → iss::C
: super core::Object::•()
;
}
static field () → void f1;
static method main() → dynamic {
new iss::C::•();
}
@@ -0,0 +1,39 @@
library opted_out_lib;
import self as self;
import "issue41496b_lib.dart" as iss;
import "org-dartlang-testcase:///issue41496b_lib.dart" as opt_in;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic {}
static method main() → dynamic {
iss::main();
}
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41496b_lib.dart:7:11: Error: Field 'f1' should be initialized because its type 'void Function()' doesn't allow null.
// LegacyFoo f1;
// ^^
//
// pkg/front_end/testcases/nnbd/issue41496b_lib.dart:10:20: Error: Field 'f2' should be initialized because its type 'void Function()' doesn't allow null.
// static LegacyFoo f2;
// ^^
//
import self as iss;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41496b.dart";
class C extends core::Object {
static field () → void f2 = null;
synthetic constructor •() → iss::C
: super core::Object::•()
;
}
static field () → void f1;
static method main() → dynamic {
new iss::C::•();
}
@@ -0,0 +1,15 @@
// Copyright (c) 2020, 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 "issue41496b.dart";
LegacyFoo f1;
class C {
static LegacyFoo f2;
}
main() {
new C();
}
@@ -0,0 +1,35 @@
// Copyright (c) 2020, 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 "issue41498_lib.dart";
class C {
static void test() {
LegacyFoo f;
f.toString(); // error
}
void test2() {
LegacyFoo f;
f.toString(); // error
}
}
test() {
LegacyFoo f;
f.toString(); // error
Function foo = () {
LegacyFoo f;
f.toString(); // error
};
C.test();
new C().test2();
}
main() {}
@@ -0,0 +1,34 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41498_lib.dart";
class C extends core::Object {
synthetic constructor •() → self::C
;
static method test() → void
;
method test2() → void
;
}
static method test() → dynamic
;
static method main() → dynamic
;
library opted_out_lib;
import self as self2;
import "dart:core" as core;
typedef LegacyFoo = () →* void;
class C extends core::Object {
synthetic constructor •() → self2::C*
;
static method test() → void
;
method test2() → void
;
}
static method test() → dynamic
;
@@ -0,0 +1,86 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41498.dart:11:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498.dart:17:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498.dart:24:3: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498.dart:29:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
import self as self;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41498_lib.dart";
class C extends core::Object {
synthetic constructor •() → self::C
: super core::Object::•()
;
static method test() → void {
() → void f;
(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498.dart:11:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
}
method test2() → void {
() → void f;
(let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498.dart:17:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
}
}
static method test() → dynamic {
() → void f;
(let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498.dart:24:3: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
core::Function foo = () → core::Null? {
() → void f;
(let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498.dart:29:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
};
self::C::test();
new self::C::•().{self::C::test2}();
}
static method main() → dynamic {}
library opted_out_lib;
import self as self2;
import "dart:core" as core;
typedef LegacyFoo = () →* void;
class C extends core::Object {
synthetic constructor •() → self2::C*
: super core::Object::•()
;
static method test() → void {
() →* void f;
f.{core::Object::toString}();
}
method test2() → void {
() →* void f;
f.{core::Object::toString}();
}
}
static method test() → dynamic {
() →* void f;
f.{core::Object::toString}();
core::Function* foo = () → core::Null? {
() →* void f;
f.{core::Object::toString}();
};
self2::C::test();
new self2::C::•().{self2::C::test2}();
}
@@ -0,0 +1,86 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41498.dart:11:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498.dart:17:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498.dart:24:3: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498.dart:29:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
import self as self;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41498_lib.dart";
class C extends core::Object {
synthetic constructor •() → self::C
: super core::Object::•()
;
static method test() → void {
() → void f;
(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498.dart:11:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
}
method test2() → void {
() → void f;
(let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498.dart:17:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
}
}
static method test() → dynamic {
() → void f;
(let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498.dart:24:3: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
core::Function foo = () → core::Null? {
() → void f;
(let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498.dart:29:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
};
self::C::test();
new self::C::•().{self::C::test2}();
}
static method main() → dynamic {}
library opted_out_lib;
import self as self2;
import "dart:core" as core;
typedef LegacyFoo = () →* void;
class C extends core::Object {
synthetic constructor •() → self2::C*
: super core::Object::•()
;
static method test() → void {
() →* void f;
f.{core::Object::toString}();
}
method test2() → void {
() →* void f;
f.{core::Object::toString}();
}
}
static method test() → dynamic {
() →* void f;
f.{core::Object::toString}();
core::Function* foo = () → core::Null? {
() →* void f;
f.{core::Object::toString}();
};
self2::C::test();
new self2::C::•().{self2::C::test2}();
}
@@ -0,0 +1,86 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41498.dart:11:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498.dart:17:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498.dart:24:3: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498.dart:29:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
import self as self;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41498_lib.dart";
class C extends core::Object {
synthetic constructor •() → self::C
: super core::Object::•()
;
static method test() → void {
() → void f;
(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498.dart:11:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
}
method test2() → void {
() → void f;
(let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498.dart:17:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
}
}
static method test() → dynamic {
() → void f;
(let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498.dart:24:3: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
core::Function foo = () → core::Null? {
() → void f;
(let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498.dart:29:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
};
self::C::test();
new self::C::•().{self::C::test2}();
}
static method main() → dynamic {}
library opted_out_lib;
import self as self2;
import "dart:core" as core;
typedef LegacyFoo = () →* void;
class C extends core::Object {
synthetic constructor •() → self2::C*
: super core::Object::•()
;
static method test() → void {
() →* void f;
f.{core::Object::toString}();
}
method test2() → void {
() →* void f;
f.{core::Object::toString}();
}
}
static method test() → dynamic {
() →* void f;
f.{core::Object::toString}();
core::Function* foo = () → core::Null? {
() →* void f;
f.{core::Object::toString}();
};
self2::C::test();
new self2::C::•().{self2::C::test2}();
}
@@ -0,0 +1,86 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41498.dart:11:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498.dart:17:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498.dart:24:3: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498.dart:29:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
import self as self;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41498_lib.dart";
class C extends core::Object {
synthetic constructor •() → self::C
: super core::Object::•()
;
static method test() → void {
() → void f;
(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498.dart:11:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
}
method test2() → void {
() → void f;
(let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498.dart:17:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
}
}
static method test() → dynamic {
() → void f;
(let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498.dart:24:3: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
core::Function foo = () → core::Null? {
() → void f;
(let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498.dart:29:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
};
self::C::test();
new self::C::•().{self::C::test2}();
}
static method main() → dynamic {}
library opted_out_lib;
import self as self2;
import "dart:core" as core;
typedef LegacyFoo = () →* void;
class C extends core::Object {
synthetic constructor •() → self2::C*
: super core::Object::•()
;
static method test() → void {
() →* void f;
f.{core::Object::toString}();
}
method test2() → void {
() →* void f;
f.{core::Object::toString}();
}
}
static method test() → dynamic {
() →* void f;
f.{core::Object::toString}();
core::Function* foo = () → core::Null? {
() →* void f;
f.{core::Object::toString}();
};
self2::C::test();
new self2::C::•().{self2::C::test2}();
}
@@ -0,0 +1,36 @@
// Copyright (c) 2020, 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.
// @dart=2.6
library opted_out_lib;
typedef void LegacyFoo();
class C {
static void test() {
LegacyFoo f;
f.toString(); // ok
}
void test2() {
LegacyFoo f;
f.toString(); // ok
}
}
test() {
LegacyFoo f;
f.toString(); // ok
Function foo = () {
LegacyFoo f;
f.toString(); // ok
};
C.test();
new C().test2();
}
@@ -0,0 +1,42 @@
// Copyright (c) 2020, 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.
// @dart=2.6
library opted_out_lib;
import 'issue41498b_lib.dart' as opt_in;
typedef void LegacyFoo();
class C {
static void test() {
LegacyFoo f;
f.toString(); // ok
}
void test2() {
LegacyFoo f;
f.toString(); // ok
}
}
test() {
LegacyFoo f;
f.toString(); // ok
Function foo = () {
LegacyFoo f;
f.toString(); // ok
};
C.test();
new C().test2();
}
main() {
opt_in.main();
}
@@ -0,0 +1,38 @@
library opted_out_lib;
import self as self;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41498b_lib.dart" as opt_in;
typedef LegacyFoo = () →* void;
class C extends core::Object {
synthetic constructor •() → self::C*
;
static method test() → void
;
method test2() → void
;
}
static method test() → dynamic
;
static method main() → dynamic
;
library /*isNonNullableByDefault*/;
import self as self2;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41498b.dart";
class C extends core::Object {
synthetic constructor •() → self2::C
;
static method test() → void
;
method test2() → void
;
}
static method test() → dynamic
;
static method main() → dynamic
;
@@ -0,0 +1,92 @@
library opted_out_lib;
import self as self;
import "dart:core" as core;
import "issue41498b_lib.dart" as iss;
import "org-dartlang-testcase:///issue41498b_lib.dart" as opt_in;
typedef LegacyFoo = () →* void;
class C extends core::Object {
synthetic constructor •() → self::C*
: super core::Object::•()
;
static method test() → void {
() →* void f;
f.{core::Object::toString}();
}
method test2() → void {
() →* void f;
f.{core::Object::toString}();
}
}
static method test() → dynamic {
() →* void f;
f.{core::Object::toString}();
core::Function* foo = () → core::Null? {
() →* void f;
f.{core::Object::toString}();
};
self::C::test();
new self::C::•().{self::C::test2}();
}
static method main() → dynamic {
iss::main();
}
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41498b_lib.dart:11:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498b_lib.dart:17:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498b_lib.dart:24:3: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498b_lib.dart:29:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
import self as iss;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41498b.dart";
class C extends core::Object {
synthetic constructor •() → iss::C
: super core::Object::•()
;
static method test() → void {
() → void f;
(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498b_lib.dart:11:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
}
method test2() → void {
() → void f;
(let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498b_lib.dart:17:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
}
}
static method test() → dynamic {
() → void f;
(let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498b_lib.dart:24:3: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
core::Function foo = () → core::Null? {
() → void f;
(let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498b_lib.dart:29:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
};
iss::C::test();
new iss::C::•().{iss::C::test2}();
}
static method main() → dynamic {}
@@ -0,0 +1,92 @@
library opted_out_lib;
import self as self;
import "dart:core" as core;
import "issue41498b_lib.dart" as iss;
import "org-dartlang-testcase:///issue41498b_lib.dart" as opt_in;
typedef LegacyFoo = () →* void;
class C extends core::Object {
synthetic constructor •() → self::C*
: super core::Object::•()
;
static method test() → void {
() →* void f;
f.{core::Object::toString}();
}
method test2() → void {
() →* void f;
f.{core::Object::toString}();
}
}
static method test() → dynamic {
() →* void f;
f.{core::Object::toString}();
core::Function* foo = () → core::Null? {
() →* void f;
f.{core::Object::toString}();
};
self::C::test();
new self::C::•().{self::C::test2}();
}
static method main() → dynamic {
iss::main();
}
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41498b_lib.dart:11:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498b_lib.dart:17:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498b_lib.dart:24:3: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498b_lib.dart:29:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
import self as iss;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41498b.dart";
class C extends core::Object {
synthetic constructor •() → iss::C
: super core::Object::•()
;
static method test() → void {
() → void f;
(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498b_lib.dart:11:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
}
method test2() → void {
() → void f;
(let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498b_lib.dart:17:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
}
}
static method test() → dynamic {
() → void f;
(let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498b_lib.dart:24:3: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
core::Function foo = () → core::Null? {
() → void f;
(let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498b_lib.dart:29:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
};
iss::C::test();
new iss::C::•().{iss::C::test2}();
}
static method main() → dynamic {}
@@ -0,0 +1,92 @@
library opted_out_lib;
import self as self;
import "dart:core" as core;
import "issue41498b_lib.dart" as iss;
import "org-dartlang-testcase:///issue41498b_lib.dart" as opt_in;
typedef LegacyFoo = () →* void;
class C extends core::Object {
synthetic constructor •() → self::C*
: super core::Object::•()
;
static method test() → void {
() →* void f;
f.{core::Object::toString}();
}
method test2() → void {
() →* void f;
f.{core::Object::toString}();
}
}
static method test() → dynamic {
() →* void f;
f.{core::Object::toString}();
core::Function* foo = () → core::Null? {
() →* void f;
f.{core::Object::toString}();
};
self::C::test();
new self::C::•().{self::C::test2}();
}
static method main() → dynamic {
iss::main();
}
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41498b_lib.dart:11:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498b_lib.dart:17:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498b_lib.dart:24:3: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498b_lib.dart:29:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
import self as iss;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41498b.dart";
class C extends core::Object {
synthetic constructor •() → iss::C
: super core::Object::•()
;
static method test() → void {
() → void f;
(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498b_lib.dart:11:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
}
method test2() → void {
() → void f;
(let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498b_lib.dart:17:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
}
}
static method test() → dynamic {
() → void f;
(let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498b_lib.dart:24:3: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
core::Function foo = () → core::Null? {
() → void f;
(let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498b_lib.dart:29:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
};
iss::C::test();
new iss::C::•().{iss::C::test2}();
}
static method main() → dynamic {}
@@ -0,0 +1,92 @@
library opted_out_lib;
import self as self;
import "dart:core" as core;
import "issue41498b_lib.dart" as iss;
import "org-dartlang-testcase:///issue41498b_lib.dart" as opt_in;
typedef LegacyFoo = () →* void;
class C extends core::Object {
synthetic constructor •() → self::C*
: super core::Object::•()
;
static method test() → void {
() →* void f;
f.{core::Object::toString}();
}
method test2() → void {
() →* void f;
f.{core::Object::toString}();
}
}
static method test() → dynamic {
() →* void f;
f.{core::Object::toString}();
core::Function* foo = () → core::Null? {
() →* void f;
f.{core::Object::toString}();
};
self::C::test();
new self::C::•().{self::C::test2}();
}
static method main() → dynamic {
iss::main();
}
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41498b_lib.dart:11:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498b_lib.dart:17:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498b_lib.dart:24:3: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
// pkg/front_end/testcases/nnbd/issue41498b_lib.dart:29:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
// f.toString(); // error
// ^
//
import self as iss;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41498b.dart";
class C extends core::Object {
synthetic constructor •() → iss::C
: super core::Object::•()
;
static method test() → void {
() → void f;
(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498b_lib.dart:11:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
}
method test2() → void {
() → void f;
(let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498b_lib.dart:17:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
}
}
static method test() → dynamic {
() → void f;
(let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498b_lib.dart:24:3: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
core::Function foo = () → core::Null? {
() → void f;
(let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41498b_lib.dart:29:5: Error: Non-nullable variable 'f' must be assigned before it can be used.
f.toString(); // error
^" in f).{core::Object::toString}();
};
iss::C::test();
new iss::C::•().{iss::C::test2}();
}
static method main() → dynamic {}
@@ -0,0 +1,35 @@
// Copyright (c) 2020, 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 "issue41498b.dart";
class C {
static void test() {
LegacyFoo f;
f.toString(); // error
}
void test2() {
LegacyFoo f;
f.toString(); // error
}
}
test() {
LegacyFoo f;
f.toString(); // error
Function foo = () {
LegacyFoo f;
f.toString(); // error
};
C.test();
new C().test2();
}
main() {}
@@ -0,0 +1,17 @@
// Copyright (c) 2020, 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 "issue41499_lib.dart";
class C {
static LegacyFoo sTest() {}
LegacyFoo mTest() {}
LegacyFoo get gTest {}
}
LegacyFoo test() {}
main() {}
@@ -0,0 +1,27 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41499_lib.dart";
class C extends core::Object {
synthetic constructor •() → self::C
;
static method sTest() → () → void
;
method mTest() → () → void
;
get gTest() → () → void
;
}
static method test() → () → void
;
static method main() → dynamic
;
library;
import self as self2;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic
;
@@ -0,0 +1,57 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41499.dart:8:20: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// static LegacyFoo sTest() {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499.dart:10:13: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo mTest() {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499.dart:12:17: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo get gTest {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499.dart:15:11: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo test() {}
// ^
//
import self as self;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41499_lib.dart";
class C extends core::Object {
synthetic constructor •() → self::C
: super core::Object::•()
;
static method sTest() → () → void {
return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499.dart:8:20: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
static LegacyFoo sTest() {}
^" in null;
}
method mTest() → () → void {
return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499.dart:10:13: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo mTest() {}
^" in null;
}
get gTest() → () → void {
return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499.dart:12:17: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo get gTest {}
^" in null;
}
}
static method test() → () → void {
return let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499.dart:15:11: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo test() {}
^" in null;
}
static method main() → dynamic {}
library;
import self as self2;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic {}
@@ -0,0 +1,57 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41499.dart:8:20: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// static LegacyFoo sTest() {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499.dart:10:13: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo mTest() {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499.dart:12:17: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo get gTest {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499.dart:15:11: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo test() {}
// ^
//
import self as self;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41499_lib.dart";
class C extends core::Object {
synthetic constructor •() → self::C
: super core::Object::•()
;
static method sTest() → () → void {
return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499.dart:8:20: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
static LegacyFoo sTest() {}
^" in null;
}
method mTest() → () → void {
return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499.dart:10:13: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo mTest() {}
^" in null;
}
get gTest() → () → void {
return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499.dart:12:17: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo get gTest {}
^" in null;
}
}
static method test() → () → void {
return let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499.dart:15:11: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo test() {}
^" in null;
}
static method main() → dynamic {}
library;
import self as self2;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic {}
@@ -0,0 +1,57 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41499.dart:8:20: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// static LegacyFoo sTest() {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499.dart:10:13: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo mTest() {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499.dart:12:17: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo get gTest {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499.dart:15:11: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo test() {}
// ^
//
import self as self;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41499_lib.dart";
class C extends core::Object {
synthetic constructor •() → self::C
: super core::Object::•()
;
static method sTest() → () → void {
return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499.dart:8:20: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
static LegacyFoo sTest() {}
^" in null;
}
method mTest() → () → void {
return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499.dart:10:13: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo mTest() {}
^" in null;
}
get gTest() → () → void {
return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499.dart:12:17: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo get gTest {}
^" in null;
}
}
static method test() → () → void {
return let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499.dart:15:11: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo test() {}
^" in null;
}
static method main() → dynamic {}
library;
import self as self2;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic {}
@@ -0,0 +1,57 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41499.dart:8:20: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// static LegacyFoo sTest() {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499.dart:10:13: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo mTest() {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499.dart:12:17: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo get gTest {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499.dart:15:11: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo test() {}
// ^
//
import self as self;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41499_lib.dart";
class C extends core::Object {
synthetic constructor •() → self::C
: super core::Object::•()
;
static method sTest() → () → void {
return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499.dart:8:20: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
static LegacyFoo sTest() {}
^" in null;
}
method mTest() → () → void {
return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499.dart:10:13: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo mTest() {}
^" in null;
}
get gTest() → () → void {
return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499.dart:12:17: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo get gTest {}
^" in null;
}
}
static method test() → () → void {
return let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499.dart:15:11: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo test() {}
^" in null;
}
static method main() → dynamic {}
library;
import self as self2;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic {}
@@ -0,0 +1,8 @@
// Copyright (c) 2020, 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.
// @dart=2.6
typedef void LegacyFoo();
test(LegacyFoo f) {}
@@ -0,0 +1,13 @@
// Copyright (c) 2020, 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.
// @dart=2.6
import 'issue41499b_lib.dart' as opt_in;
typedef void LegacyFoo();
test(LegacyFoo f) {}
main() {}
@@ -0,0 +1,29 @@
library;
import self as self;
import "org-dartlang-testcase:///issue41499b_lib.dart" as opt_in;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic
;
static method main() → dynamic
;
library /*isNonNullableByDefault*/;
import self as self2;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41499b.dart";
class C extends core::Object {
synthetic constructor •() → self2::C
;
static method sTest() → () → void
;
method mTest() → () → void
;
get gTest() → () → void
;
}
static method test() → () → void
;
@@ -0,0 +1,59 @@
library;
import self as self;
import "org-dartlang-testcase:///issue41499b_lib.dart" as opt_in;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic {}
static method main() → dynamic {}
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41499b_lib.dart:8:20: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// static LegacyFoo sTest() {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499b_lib.dart:10:13: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo mTest() {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499b_lib.dart:12:17: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo get gTest {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499b_lib.dart:15:11: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo test() {}
// ^
//
import self as self2;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41499b.dart";
class C extends core::Object {
synthetic constructor •() → self2::C
: super core::Object::•()
;
static method sTest() → () → void {
return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499b_lib.dart:8:20: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
static LegacyFoo sTest() {}
^" in null;
}
method mTest() → () → void {
return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499b_lib.dart:10:13: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo mTest() {}
^" in null;
}
get gTest() → () → void {
return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499b_lib.dart:12:17: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo get gTest {}
^" in null;
}
}
static method test() → () → void {
return let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499b_lib.dart:15:11: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo test() {}
^" in null;
}
@@ -0,0 +1,59 @@
library;
import self as self;
import "org-dartlang-testcase:///issue41499b_lib.dart" as opt_in;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic {}
static method main() → dynamic {}
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41499b_lib.dart:8:20: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// static LegacyFoo sTest() {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499b_lib.dart:10:13: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo mTest() {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499b_lib.dart:12:17: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo get gTest {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499b_lib.dart:15:11: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo test() {}
// ^
//
import self as self2;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41499b.dart";
class C extends core::Object {
synthetic constructor •() → self2::C
: super core::Object::•()
;
static method sTest() → () → void {
return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499b_lib.dart:8:20: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
static LegacyFoo sTest() {}
^" in null;
}
method mTest() → () → void {
return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499b_lib.dart:10:13: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo mTest() {}
^" in null;
}
get gTest() → () → void {
return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499b_lib.dart:12:17: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo get gTest {}
^" in null;
}
}
static method test() → () → void {
return let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499b_lib.dart:15:11: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo test() {}
^" in null;
}
@@ -0,0 +1,59 @@
library;
import self as self;
import "org-dartlang-testcase:///issue41499b_lib.dart" as opt_in;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic {}
static method main() → dynamic {}
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41499b_lib.dart:8:20: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// static LegacyFoo sTest() {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499b_lib.dart:10:13: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo mTest() {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499b_lib.dart:12:17: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo get gTest {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499b_lib.dart:15:11: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo test() {}
// ^
//
import self as self2;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41499b.dart";
class C extends core::Object {
synthetic constructor •() → self2::C
: super core::Object::•()
;
static method sTest() → () → void {
return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499b_lib.dart:8:20: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
static LegacyFoo sTest() {}
^" in null;
}
method mTest() → () → void {
return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499b_lib.dart:10:13: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo mTest() {}
^" in null;
}
get gTest() → () → void {
return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499b_lib.dart:12:17: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo get gTest {}
^" in null;
}
}
static method test() → () → void {
return let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499b_lib.dart:15:11: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo test() {}
^" in null;
}
@@ -0,0 +1,59 @@
library;
import self as self;
import "org-dartlang-testcase:///issue41499b_lib.dart" as opt_in;
typedef LegacyFoo = () →* void;
static method test(() →* void f) → dynamic {}
static method main() → dynamic {}
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue41499b_lib.dart:8:20: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// static LegacyFoo sTest() {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499b_lib.dart:10:13: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo mTest() {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499b_lib.dart:12:17: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo get gTest {}
// ^
//
// pkg/front_end/testcases/nnbd/issue41499b_lib.dart:15:11: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
// LegacyFoo test() {}
// ^
//
import self as self2;
import "dart:core" as core;
import "org-dartlang-testcase:///issue41499b.dart";
class C extends core::Object {
synthetic constructor •() → self2::C
: super core::Object::•()
;
static method sTest() → () → void {
return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499b_lib.dart:8:20: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
static LegacyFoo sTest() {}
^" in null;
}
method mTest() → () → void {
return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499b_lib.dart:10:13: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo mTest() {}
^" in null;
}
get gTest() → () → void {
return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499b_lib.dart:12:17: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo get gTest {}
^" in null;
}
}
static method test() → () → void {
return let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41499b_lib.dart:15:11: Error: A non-null value must be returned since the return type 'void Function()' doesn't allow null.
LegacyFoo test() {}
^" in null;
}
@@ -0,0 +1,15 @@
// Copyright (c) 2020, 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 "issue41499b.dart";
class C {
static LegacyFoo sTest() {}
LegacyFoo mTest() {}
LegacyFoo get gTest {}
}
LegacyFoo test() {}
@@ -0,0 +1,21 @@
// Copyright (c) 2020, 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 'dart:async';
import 'issue41501_lib.dart';
typedef AAliasNonNullable = A;
typedef AAliasNullable = A?;
test() {
FutureOr<AAlias> foLegacyNonNullable = null; // error
FutureOr<AAlias?> foLegacyNullable = null; // ok
FutureOr<AAliasNonNullable> foNonNullable = null; // error
FutureOr<AAliasNullable> foNullable = null; // ok
FutureOr<AAliasNonNullable?> foNonNullableNullable = null; // ok
FutureOr<AAliasNullable?> foNullableNullable = null; // ok
}
main() {}
@@ -0,0 +1,28 @@
library /*isNonNullableByDefault*/;
import self as self;
import "issue41501_lib.dart" as opt;
import "dart:async";
import "org-dartlang-testcase:///issue41501_lib.dart";
typedef AAliasNonNullable = opt::A;
typedef AAliasNullable = opt::A?;
static method test() → dynamic
;
static method main() → dynamic
;
library opted_out_lib;
import self as opt;
import "dart:core" as core;
import "dart:async";
import "org-dartlang-testcase:///issue41501.dart";
typedef AAlias = opt::A*;
class A extends core::Object {
synthetic constructor •() → opt::A*
;
}
static method test() → dynamic
;
@@ -0,0 +1,62 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: A value of type 'Null?' can't be assigned to a variable of type 'FutureOr<A>'.
// - 'FutureOr' is from 'dart:async'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
// FutureOr<AAlias> foLegacyNonNullable = null; // error
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: A value of type 'Null?' can't be assigned to a variable of type 'FutureOr<A>'.
// - 'FutureOr' is from 'dart:async'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
// FutureOr<AAliasNonNullable> foNonNullable = null; // error
// ^
//
import self as self;
import "issue41501_lib.dart" as opt;
import "dart:async" as asy;
import "dart:async";
import "org-dartlang-testcase:///issue41501_lib.dart";
typedef AAliasNonNullable = opt::A;
typedef AAliasNullable = opt::A?;
static method test() → dynamic {
asy::FutureOr<opt::A> foLegacyNonNullable = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: A value of type 'Null?' can't be assigned to a variable of type 'FutureOr<A>'.
- 'FutureOr' is from 'dart:async'.
- 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
FutureOr<AAlias> foLegacyNonNullable = null; // error
^" in null as{TypeError,ForNonNullableByDefault} asy::FutureOr<opt::A>;
asy::FutureOr<opt::A?> foLegacyNullable = null;
asy::FutureOr<opt::A> foNonNullable = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: A value of type 'Null?' can't be assigned to a variable of type 'FutureOr<A>'.
- 'FutureOr' is from 'dart:async'.
- 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
FutureOr<AAliasNonNullable> foNonNullable = null; // error
^" in null as{TypeError,ForNonNullableByDefault} asy::FutureOr<opt::A>;
asy::FutureOr<opt::A?> foNullable = null;
asy::FutureOr<opt::A?> foNonNullableNullable = null;
asy::FutureOr<opt::A?> foNullableNullable = null;
}
static method main() → dynamic {}
library opted_out_lib;
import self as opt;
import "dart:core" as core;
import "dart:async" as asy;
import "dart:async";
import "org-dartlang-testcase:///issue41501.dart";
typedef AAlias = opt::A*;
class A extends core::Object {
synthetic constructor •() → opt::A*
: super core::Object::•()
;
}
static method test() → dynamic {
asy::FutureOr<opt::A*>* foLegacy = null;
asy::FutureOr<opt::A*>* foNonNullable = null;
asy::FutureOr<opt::A*>* foNullable = null;
}
@@ -0,0 +1,62 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: A value of type 'Null?' can't be assigned to a variable of type 'FutureOr<A>'.
// - 'FutureOr' is from 'dart:async'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
// FutureOr<AAlias> foLegacyNonNullable = null; // error
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: A value of type 'Null?' can't be assigned to a variable of type 'FutureOr<A>'.
// - 'FutureOr' is from 'dart:async'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
// FutureOr<AAliasNonNullable> foNonNullable = null; // error
// ^
//
import self as self;
import "issue41501_lib.dart" as opt;
import "dart:async" as asy;
import "dart:async";
import "org-dartlang-testcase:///issue41501_lib.dart";
typedef AAliasNonNullable = opt::A;
typedef AAliasNullable = opt::A?;
static method test() → dynamic {
asy::FutureOr<opt::A> foLegacyNonNullable = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: A value of type 'Null?' can't be assigned to a variable of type 'FutureOr<A>'.
- 'FutureOr' is from 'dart:async'.
- 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
FutureOr<AAlias> foLegacyNonNullable = null; // error
^" in null as{TypeError,ForNonNullableByDefault} asy::FutureOr<opt::A>;
asy::FutureOr<opt::A?> foLegacyNullable = null;
asy::FutureOr<opt::A> foNonNullable = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: A value of type 'Null?' can't be assigned to a variable of type 'FutureOr<A>'.
- 'FutureOr' is from 'dart:async'.
- 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
FutureOr<AAliasNonNullable> foNonNullable = null; // error
^" in null as{TypeError,ForNonNullableByDefault} asy::FutureOr<opt::A>;
asy::FutureOr<opt::A?> foNullable = null;
asy::FutureOr<opt::A?> foNonNullableNullable = null;
asy::FutureOr<opt::A?> foNullableNullable = null;
}
static method main() → dynamic {}
library opted_out_lib;
import self as opt;
import "dart:core" as core;
import "dart:async" as asy;
import "dart:async";
import "org-dartlang-testcase:///issue41501.dart";
typedef AAlias = opt::A*;
class A extends core::Object {
synthetic constructor •() → opt::A*
: super core::Object::•()
;
}
static method test() → dynamic {
asy::FutureOr<opt::A*>* foLegacy = null;
asy::FutureOr<opt::A*>* foNonNullable = null;
asy::FutureOr<opt::A*>* foNullable = null;
}
@@ -0,0 +1,62 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: A value of type 'Null?' can't be assigned to a variable of type 'FutureOr<A>'.
// - 'FutureOr' is from 'dart:async'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
// FutureOr<AAlias> foLegacyNonNullable = null; // error
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: A value of type 'Null?' can't be assigned to a variable of type 'FutureOr<A>'.
// - 'FutureOr' is from 'dart:async'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
// FutureOr<AAliasNonNullable> foNonNullable = null; // error
// ^
//
import self as self;
import "issue41501_lib.dart" as opt;
import "dart:async" as asy;
import "dart:async";
import "org-dartlang-testcase:///issue41501_lib.dart";
typedef AAliasNonNullable = opt::A;
typedef AAliasNullable = opt::A?;
static method test() → dynamic {
asy::FutureOr<opt::A> foLegacyNonNullable = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: A value of type 'Null?' can't be assigned to a variable of type 'FutureOr<A>'.
- 'FutureOr' is from 'dart:async'.
- 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
FutureOr<AAlias> foLegacyNonNullable = null; // error
^" in null as{TypeError,ForNonNullableByDefault} asy::FutureOr<opt::A>;
asy::FutureOr<opt::A?> foLegacyNullable = null;
asy::FutureOr<opt::A> foNonNullable = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: A value of type 'Null?' can't be assigned to a variable of type 'FutureOr<A>'.
- 'FutureOr' is from 'dart:async'.
- 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
FutureOr<AAliasNonNullable> foNonNullable = null; // error
^" in null as{TypeError,ForNonNullableByDefault} asy::FutureOr<opt::A>;
asy::FutureOr<opt::A?> foNullable = null;
asy::FutureOr<opt::A?> foNonNullableNullable = null;
asy::FutureOr<opt::A?> foNullableNullable = null;
}
static method main() → dynamic {}
library opted_out_lib;
import self as opt;
import "dart:core" as core;
import "dart:async" as asy;
import "dart:async";
import "org-dartlang-testcase:///issue41501.dart";
typedef AAlias = opt::A*;
class A extends core::Object {
synthetic constructor •() → opt::A*
: super core::Object::•()
;
}
static method test() → dynamic {
asy::FutureOr<opt::A*>* foLegacy = null;
asy::FutureOr<opt::A*>* foNonNullable = null;
asy::FutureOr<opt::A*>* foNullable = null;
}
@@ -0,0 +1,62 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: A value of type 'Null?' can't be assigned to a variable of type 'FutureOr<A>'.
// - 'FutureOr' is from 'dart:async'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
// FutureOr<AAlias> foLegacyNonNullable = null; // error
// ^
//
// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: A value of type 'Null?' can't be assigned to a variable of type 'FutureOr<A>'.
// - 'FutureOr' is from 'dart:async'.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
// FutureOr<AAliasNonNullable> foNonNullable = null; // error
// ^
//
import self as self;
import "issue41501_lib.dart" as opt;
import "dart:async" as asy;
import "dart:async";
import "org-dartlang-testcase:///issue41501_lib.dart";
typedef AAliasNonNullable = opt::A;
typedef AAliasNullable = opt::A?;
static method test() → dynamic {
asy::FutureOr<opt::A> foLegacyNonNullable = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: A value of type 'Null?' can't be assigned to a variable of type 'FutureOr<A>'.
- 'FutureOr' is from 'dart:async'.
- 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
FutureOr<AAlias> foLegacyNonNullable = null; // error
^" in null as{TypeError,ForNonNullableByDefault} asy::FutureOr<opt::A>;
asy::FutureOr<opt::A?> foLegacyNullable = null;
asy::FutureOr<opt::A> foNonNullable = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: A value of type 'Null?' can't be assigned to a variable of type 'FutureOr<A>'.
- 'FutureOr' is from 'dart:async'.
- 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
FutureOr<AAliasNonNullable> foNonNullable = null; // error
^" in null as{TypeError,ForNonNullableByDefault} asy::FutureOr<opt::A>;
asy::FutureOr<opt::A?> foNullable = null;
asy::FutureOr<opt::A?> foNonNullableNullable = null;
asy::FutureOr<opt::A?> foNullableNullable = null;
}
static method main() → dynamic {}
library opted_out_lib;
import self as opt;
import "dart:core" as core;
import "dart:async" as asy;
import "dart:async";
import "org-dartlang-testcase:///issue41501.dart";
typedef AAlias = opt::A*;
class A extends core::Object {
synthetic constructor •() → opt::A*
: super core::Object::•()
;
}
static method test() → dynamic {
asy::FutureOr<opt::A*>* foLegacy = null;
asy::FutureOr<opt::A*>* foNonNullable = null;
asy::FutureOr<opt::A*>* foNullable = null;
}
@@ -0,0 +1,21 @@
// Copyright (c) 2020, 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.
// @dart=2.6
library opted_out_lib;
import 'dart:async';
import 'issue41501.dart';
class A {}
typedef AAlias = A;
test() {
FutureOr<AAlias> foLegacy = null; // ok
FutureOr<AAliasNonNullable> foNonNullable = null; // ok
FutureOr<AAliasNullable> foNullable = null; // ok
}
@@ -0,0 +1 @@
--enable-experiment=non-nullable,nonfunction-type-aliases
@@ -1310,6 +1310,12 @@ nnbd/issue41180: TextSerializationFailure
nnbd/issue41210a/issue41210: TextSerializationFailure
nnbd/issue41210b: TextSerializationFailure
nnbd/issue41273: TextSerializationFailure
nnbd/issue41496: TextSerializationFailure
nnbd/issue41496b: TextSerializationFailure
nnbd/issue41498: TextSerializationFailure
nnbd/issue41498b: TextSerializationFailure
nnbd/issue41499: TextSerializationFailure
nnbd/issue41499b: TextSerializationFailure
nnbd/issue_39286: TextSerializationFailure
nnbd/issue_39286_2: TextSerializationFailure
nnbd/late: TextSerializationFailure
@@ -1403,6 +1409,7 @@ no_such_method_forwarders/private_same: TextSerializationFailure # Was: Pass
no_such_method_forwarders/same: TextSerializationFailure # Was: Pass
no_such_method_forwarders/setter_not_shadowed_by_method: TextSerializationFailure # Was: Pass
no_such_method_forwarders/subst_on_forwarder: TextSerializationFailure # Was: Pass
nonfunction_type_aliases/issue41501: TextSerializationFailure
rasta/abstract_constructor: TextSerializationFailure # Was: RuntimeError
rasta/bad_constructor_redirection: TextSerializationFailure # Was: RuntimeError
rasta/bad_continue: TextSerializationFailure # Was: RuntimeError
+1
View File
@@ -34,6 +34,7 @@ void main(List<String> args) {
packageDirectory('pkg/front_end/testcases/general_nnbd_opt_out/'),
packageDirectory('pkg/front_end/testcases/late_lowering/'),
packageDirectory('pkg/front_end/testcases/nnbd/'),
packageDirectory('pkg/front_end/testcases/nonfunction_type_aliases/'),
];
var packages = [