mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 08:44:27 +00:00
Migrate "s" directory language tests off @compile-error.
The "@compile-error" comment is an old not-great way of defining static error tests. See: https://github.com/dart-lang/sdk/issues/45634 Change-Id: I6218c6ea339b6c19c1495b1db9b2da3fe1654718 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296440 Commit-Queue: Jake Macdonald <jakemac@google.com> Auto-Submit: Bob Nystrom <rnystrom@google.com> Reviewed-by: Jake Macdonald <jakemac@google.com>
This commit is contained in:
parent
cd5883fa85
commit
1b422af61f
10 changed files with 42 additions and 24 deletions
|
@ -4,12 +4,9 @@
|
|||
|
||||
/// Part file has library and import directives.
|
||||
|
||||
/*@compile-error=unspecified*/
|
||||
// TODO(rnystrom): Using the above tag instead of making this a static error
|
||||
// test because the error is reported in the part file and not in this file.
|
||||
// Static error tests only support errors reported in the main test file itself.
|
||||
part "script2_part.dart";
|
||||
// TODO(rnystrom): Using a multitest instead of making this a static error test
|
||||
// because the error is reported in the part file and not in this file. Once
|
||||
// issue #44990 is fixed, this can be a static error test.
|
||||
part "script2_part.dart"; //# 01: compile-time error
|
||||
|
||||
main() {
|
||||
print("Should not reach here.");
|
||||
}
|
||||
main() {}
|
||||
|
|
|
@ -10,7 +10,9 @@ class A {
|
|||
}
|
||||
|
||||
void set a(var val) {
|
||||
/*@compile-error=unspecified*/
|
||||
// ^
|
||||
// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_DEFINITION
|
||||
// [cfe] 'a' is already declared in this scope.
|
||||
int i = val;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
int x = "milou"; /*@compile-error=unspecified*/
|
||||
int x = "milou";
|
||||
// ^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [cfe] A value of type 'String' can't be assigned to a variable of type 'int'.
|
||||
|
||||
bool readXThrows() {
|
||||
try {
|
||||
|
|
|
@ -21,7 +21,11 @@ class C extends B {
|
|||
void foo([x]) {
|
||||
// But it is a problem to try to pass `x` along to super, since the super
|
||||
// method is A.foo.
|
||||
super.foo(/*@compile-error=unspecified*/ x);
|
||||
super.foo(x);
|
||||
// ^
|
||||
// [cfe] Too many positional arguments: 0 allowed, but 1 found.
|
||||
// ^
|
||||
// [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,10 @@ class EmptyBlockCaseTest {
|
|||
static testMain() {
|
||||
var exception = null;
|
||||
switch (1) {
|
||||
case 1: /*@compile-error=unspecified*/
|
||||
case 1:
|
||||
// ^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY
|
||||
// [cfe] Switch case may fall through to the next case.
|
||||
{}
|
||||
case 2:
|
||||
Expect.equals(true, false);
|
||||
|
|
|
@ -6,12 +6,9 @@
|
|||
|
||||
/// Part file has library and import directives.
|
||||
|
||||
/*@compile-error=unspecified*/
|
||||
// TODO(rnystrom): Using the above tag instead of making this a static error
|
||||
// test because the error is reported in the part file and not in this file.
|
||||
// Static error tests only support errors reported in the main test file itself.
|
||||
part "script2_part.dart";
|
||||
// TODO(rnystrom): Using a multitest instead of making this a static error test
|
||||
// because the error is reported in the part file and not in this file. Once
|
||||
// issue #44990 is fixed, this can be a static error test.
|
||||
part "script2_part.dart"; //# 01: compile-time error
|
||||
|
||||
main() {
|
||||
print("Should not reach here.");
|
||||
}
|
||||
main() {}
|
||||
|
|
|
@ -12,7 +12,9 @@ class A {
|
|||
}
|
||||
|
||||
void set a(var val) {
|
||||
/*@compile-error=unspecified*/
|
||||
// ^
|
||||
// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_DEFINITION
|
||||
// [cfe] 'a' is already declared in this scope.
|
||||
int i = val;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
int x = "milou"; /*@compile-error=unspecified*/
|
||||
int x = "milou";
|
||||
// ^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [cfe] A value of type 'String' can't be assigned to a variable of type 'int'.
|
||||
|
||||
bool readXThrows() {
|
||||
try {
|
||||
|
|
|
@ -23,7 +23,11 @@ class C extends B {
|
|||
void foo([x]) {
|
||||
// But it is a problem to try to pass `x` along to super, since the super
|
||||
// method is A.foo.
|
||||
super.foo(/*@compile-error=unspecified*/ x);
|
||||
super.foo(x);
|
||||
// ^
|
||||
// [cfe] Too many positional arguments: 0 allowed, but 1 found.
|
||||
// ^
|
||||
// [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,10 @@ import "package:expect/expect.dart";
|
|||
class EmptyBlockCaseTest {
|
||||
static testMain() {
|
||||
switch (1) {
|
||||
case 1: /*@compile-error=unspecified*/
|
||||
case 1:
|
||||
// ^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.CASE_BLOCK_NOT_TERMINATED
|
||||
// [cfe] Switch case may fall through to the next case.
|
||||
{}
|
||||
case 2:
|
||||
Expect.equals(true, false);
|
||||
|
|
Loading…
Reference in a new issue