forked from dart-lang/co19
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dart-lang#2979. Update NNBD static errors tests
- Loading branch information
Showing
44 changed files
with
441 additions
and
321 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,14 @@ | |
// BSD-style license that can be found in the LICENSE file. | ||
|
||
/// @assertion It is an error if a top level variable or static variable with a | ||
/// non-nullable type has no initializer expression unless the variable is marked | ||
/// with the `late` modifier. | ||
/// non-nullable type has no initializer expression unless the variable is | ||
/// marked with a `late` or `external` modifier. | ||
/// | ||
/// @description Check that it is an error if a top level variable or static | ||
/// variable with a non-nullable type has no initializer expression unless the | ||
/// variable is marked with the `late` modifier. Test Never | ||
/// @description Check that it is an error if a top level or static variable | ||
/// with a non-nullable type has no initializer expression and is not marked | ||
/// with a `late` or `external `modifier. Test type `Never`. | ||
/// @author [email protected] | ||
|
||
Never n; | ||
// ^ | ||
// [analyzer] unspecified | ||
|
@@ -25,5 +24,5 @@ class C { | |
} | ||
|
||
main() { | ||
new C(); | ||
print(C); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,14 @@ | |
// BSD-style license that can be found in the LICENSE file. | ||
|
||
/// @assertion It is an error if a top level variable or static variable with a | ||
/// non-nullable type has no initializer expression unless the variable is marked | ||
/// with the `late` modifier. | ||
/// non-nullable type has no initializer expression unless the variable is | ||
/// marked with a `late` or `external` modifier. | ||
/// | ||
/// @description Check that it is an error if a top level variable or static | ||
/// variable with a non-nullable type has no initializer expression unless the | ||
/// variable is marked with the `late` modifier. Test Function | ||
/// @description Check that it is an error if a top level or static variable | ||
/// with a non-nullable type has no initializer expression and is not marked | ||
/// with a `late` or `external `modifier. Test type `Function`. | ||
/// @author [email protected] | ||
|
||
Function f; | ||
// ^ | ||
// [analyzer] unspecified | ||
|
@@ -25,5 +24,5 @@ class C { | |
} | ||
|
||
main() { | ||
new C(); | ||
print(C); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,14 @@ | |
// BSD-style license that can be found in the LICENSE file. | ||
|
||
/// @assertion It is an error if a top level variable or static variable with a | ||
/// non-nullable type has no initializer expression unless the variable is marked | ||
/// with the `late` modifier. | ||
/// non-nullable type has no initializer expression unless the variable is | ||
/// marked with a `late` or `external` modifier. | ||
/// | ||
/// @description Check that it is an error if a top level variable or static | ||
/// variable with a non-nullable type has no initializer expression unless the | ||
/// variable is marked with the `late` modifier. Test function type | ||
/// @description Check that it is an error if a top level or static variable | ||
/// with a non-nullable type has no initializer expression and is not marked | ||
/// with a `late` or `external `modifier. Test a function type. | ||
/// @author [email protected] | ||
|
||
typedef void Foo(); | ||
|
||
Foo f; | ||
|
@@ -27,5 +26,5 @@ class C { | |
} | ||
|
||
main() { | ||
new C(); | ||
print(C); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,14 @@ | |
// BSD-style license that can be found in the LICENSE file. | ||
|
||
/// @assertion It is an error if a top level variable or static variable with a | ||
/// non-nullable type has no initializer expression unless the variable is marked | ||
/// with the `late` modifier. | ||
/// non-nullable type has no initializer expression unless the variable is | ||
/// marked with a `late` or `external` modifier. | ||
/// | ||
/// @description Check that it is an error if a top level variable or static | ||
/// variable with a non-nullable type has no initializer expression unless the | ||
/// variable is marked with the `late` modifier. Test some class A | ||
/// @description Check that it is an error if a top level or static variable | ||
/// with a non-nullable type has no initializer expression and is not marked | ||
/// with a `late` or `external `modifier. Test some class. | ||
/// @author [email protected] | ||
|
||
class A {} | ||
|
||
A a; | ||
|
@@ -35,5 +34,5 @@ class C { | |
} | ||
|
||
main() { | ||
new C(); | ||
print(C); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,14 @@ | |
// BSD-style license that can be found in the LICENSE file. | ||
|
||
/// @assertion It is an error if a top level variable or static variable with a | ||
/// non-nullable type has no initializer expression unless the variable is marked | ||
/// with the `late` modifier. | ||
/// non-nullable type has no initializer expression unless the variable is | ||
/// marked with a `late` or `external` modifier. | ||
/// | ||
/// @description Check that it is an error if a top level variable or static | ||
/// variable with a non-nullable type has no initializer expression unless the | ||
/// variable is marked with the `late` modifier. Test FutureOr<Never> | ||
/// @description Check that it is an error if a top level or static variable | ||
/// with a non-nullable type has no initializer expression and is not marked | ||
/// with a `late` or `external `modifier. Test type `FutureOr<Never>`. | ||
/// @author [email protected] | ||
|
||
import "dart:async"; | ||
|
||
FutureOr<Never> n; | ||
|
@@ -27,5 +26,5 @@ class C { | |
} | ||
|
||
main() { | ||
new C(); | ||
print(C); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,15 @@ | |
// BSD-style license that can be found in the LICENSE file. | ||
|
||
/// @assertion It is an error if a top level variable or static variable with a | ||
/// non-nullable type has no initializer expression unless the variable is marked | ||
/// with the `late` modifier. | ||
/// non-nullable type has no initializer expression unless the variable is | ||
/// marked with a `late` or `external` modifier. | ||
/// | ||
/// @description Check that it is an error if a top level variable or static | ||
/// variable with a non-nullable type has no initializer expression unless the | ||
/// variable is marked with the `late` modifier. Test FutureOr<F> where F is | ||
/// a function type | ||
/// @description Check that it is an error if a top level or static variable | ||
/// with a non-nullable type has no initializer expression and is not marked | ||
/// with a `late` or `external `modifier. Test type `FutureOr<F>` where `F` is a | ||
/// function type. | ||
/// @author [email protected] | ||
|
||
import "dart:async"; | ||
|
||
typedef void Foo(); | ||
|
@@ -40,5 +39,5 @@ class C { | |
} | ||
|
||
main() { | ||
new C(); | ||
print(C); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,15 @@ | |
// BSD-style license that can be found in the LICENSE file. | ||
|
||
/// @assertion It is an error if a top level variable or static variable with a | ||
/// non-nullable type has no initializer expression unless the variable is marked | ||
/// with the `late` modifier. | ||
/// non-nullable type has no initializer expression unless the variable is | ||
/// marked with a `late` or `external` modifier. | ||
/// | ||
/// @description Check that it is an error if a top level variable or static | ||
/// variable with a non-nullable type has no initializer expression unless the | ||
/// variable is marked with the `late` modifier. Test FutureOr<A> where A is | ||
/// some class | ||
/// @description Check that it is an error if a top level or static variable | ||
/// with a non-nullable type has no initializer expression and is not marked | ||
/// with a `late` or `external `modifier. Test type `FutureOr<A>` where `A` is | ||
/// some class. | ||
/// @author [email protected] | ||
|
||
import "dart:async"; | ||
|
||
class A {} | ||
|
@@ -40,5 +39,5 @@ class C { | |
} | ||
|
||
main() { | ||
new C(); | ||
print(C); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,15 @@ | |
// BSD-style license that can be found in the LICENSE file. | ||
|
||
/// @assertion It is an error if a top level variable or static variable with a | ||
/// non-nullable type has no initializer expression unless the variable is marked | ||
/// with the `late` modifier. | ||
/// non-nullable type has no initializer expression unless the variable is | ||
/// marked with a `late` or `external` modifier. | ||
/// | ||
/// @description Check that it is an error if a top level variable or static | ||
/// variable with a non-nullable type has no initializer expression unless the | ||
/// variable is marked with the `late` modifier. Test FutureOr<FutureOr<A>> | ||
/// where A is some class | ||
/// @description Check that it is an error if a top level or static variable | ||
/// with a non-nullable type has no initializer expression and is not marked | ||
/// with a `late` or `external `modifier. Test `FutureOr<FutureOr<A>>` where `A` | ||
/// is some class. | ||
/// @author [email protected] | ||
|
||
import "dart:async"; | ||
|
||
class A {} | ||
|
@@ -40,5 +39,5 @@ class C { | |
} | ||
|
||
main() { | ||
new C(); | ||
print(C); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,22 +3,26 @@ | |
// BSD-style license that can be found in the LICENSE file. | ||
|
||
/// @assertion It is an error if a top level variable or static variable with a | ||
/// non-nullable type has no initializer expression unless the variable is marked | ||
/// with the `late` modifier. | ||
/// non-nullable type has no initializer expression unless the variable is | ||
/// marked with a `late` or `external` modifier. | ||
/// | ||
/// @description Check that it is not an error if a top level or static | ||
/// variable with potentially non-nullable type has no initializer expression | ||
/// but marked with a 'late' modifier. Test Never | ||
/// @description Check that it is not an error if a top level or static variable | ||
/// with a non-nullable type has no initializer expression but is marked with a | ||
/// `late` or `external `modifier. Test type `Never`. | ||
/// @author [email protected] | ||
// Requirements=nnbd-strong | ||
late Never n; | ||
|
||
late Never n1; | ||
external Never n2; | ||
|
||
class C { | ||
static late Never n1; | ||
static late final Never n2; | ||
external static Never n3; | ||
external static final Never n4; | ||
} | ||
|
||
main() { | ||
new C(); | ||
C(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,21 +3,24 @@ | |
// BSD-style license that can be found in the LICENSE file. | ||
|
||
/// @assertion It is an error if a top level variable or static variable with a | ||
/// non-nullable type has no initializer expression unless the variable is marked | ||
/// with the `late` modifier. | ||
/// non-nullable type has no initializer expression unless the variable is | ||
/// marked with a `late` or `external` modifier. | ||
/// | ||
/// @description Check that it is not an error if a top level or static | ||
/// variable with potentially non-nullable type has no initializer expression | ||
/// but marked with a 'late' modifier. Test Function | ||
/// @description Check that it is not an error if a top level or static variable | ||
/// with a non-nullable type has no initializer expression but is marked with a | ||
/// `late` or `external `modifier. Test type `Function`. | ||
/// @author [email protected] | ||
// Requirements=nnbd-strong | ||
|
||
late Function x; | ||
late Function x1; | ||
external Function x2; | ||
|
||
class C { | ||
static late Function x1; | ||
static late final Function x2; | ||
external static Function x3; | ||
external static final Function x4; | ||
} | ||
|
||
main() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,22 +3,26 @@ | |
// BSD-style license that can be found in the LICENSE file. | ||
|
||
/// @assertion It is an error if a top level variable or static variable with a | ||
/// non-nullable type has no initializer expression unless the variable is marked | ||
/// with the `late` modifier. | ||
/// non-nullable type has no initializer expression unless the variable is | ||
/// marked with a `late` or `external` modifier. | ||
/// | ||
/// @description Check that it is not an error if a top level or static | ||
/// variable with potentially non-nullable type has no initializer expression | ||
/// but marked with a 'late' modifier. Test function type | ||
/// @description Check that it is not an error if a top level or static variable | ||
/// with a non-nullable type has no initializer expression but is marked with a | ||
/// `late` or `external `modifier. Test a function type. | ||
/// @author [email protected] | ||
// Requirements=nnbd-strong | ||
|
||
typedef void Foo(); | ||
|
||
late Foo x; | ||
late Foo x1; | ||
external Foo x2; | ||
|
||
class C { | ||
static late Foo x1; | ||
static late final Foo x2; | ||
external static Foo x3; | ||
external static final Foo x4; | ||
} | ||
|
||
main() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,22 +3,26 @@ | |
// BSD-style license that can be found in the LICENSE file. | ||
|
||
/// @assertion It is an error if a top level variable or static variable with a | ||
/// non-nullable type has no initializer expression unless the variable is marked | ||
/// with the `late` modifier. | ||
/// non-nullable type has no initializer expression unless the variable is | ||
/// marked with a `late` or `external` modifier. | ||
/// | ||
/// @description Check that it is not an error if a top level or static | ||
/// variable with potentially non-nullable type has no initializer expression | ||
/// but marked with a 'late' modifier. Test some class A | ||
/// @description Check that it is not an error if a top level or static variable | ||
/// with a non-nullable type has no initializer expression but is marked with a | ||
/// `late` or `external `modifier. Test some class. | ||
/// @author [email protected] | ||
// Requirements=nnbd-strong | ||
|
||
class A {} | ||
|
||
late A x; | ||
late A x1; | ||
external A x2; | ||
|
||
class C { | ||
static late A x1; | ||
static late final A x2; | ||
external static A x3; | ||
external static final A x4; | ||
} | ||
|
||
main() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,21 +3,26 @@ | |
// BSD-style license that can be found in the LICENSE file. | ||
|
||
/// @assertion It is an error if a top level variable or static variable with a | ||
/// non-nullable type has no initializer expression unless the variable is marked | ||
/// with the `late` modifier. | ||
/// non-nullable type has no initializer expression unless the variable is | ||
/// marked with a `late` or `external` modifier. | ||
/// | ||
/// @description Check that it is not an error if a top level or static | ||
/// variable with potentially non-nullable type has no initializer expression | ||
/// but marked with a 'late' modifier. Test FutureOr<Never> | ||
/// @description Check that it is not an error if a top level or static variable | ||
/// with a non-nullable type has no initializer expression but is marked with a | ||
/// `late` or `external `modifier. Test type `FutureOr<Never>`. | ||
/// @author [email protected] | ||
// Requirements=nnbd-strong | ||
|
||
import "dart:async"; | ||
late FutureOr<Never> x; | ||
|
||
late FutureOr<Never> x1; | ||
external FutureOr<Never> x2; | ||
|
||
class C { | ||
static late FutureOr<Never> x1; | ||
static late final FutureOr<Never> x2; | ||
external static FutureOr<Never> x3; | ||
external static final FutureOr<Never> x4; | ||
} | ||
|
||
main() { | ||
|
Oops, something went wrong.