Skip to content

Commit 4c0cf74

Browse files
authored
Fixes #2996. Update CFE expected errors locations (#2999)
1 parent 53a0fdc commit 4c0cf74

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+62
-151
lines changed

Language/Classes/Class_Member_Conflicts/method_and_setter_t01.dart

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
/// @assertion Let C be a class. ... It is a compile-time error if the interface
66
/// of C has a method named n and a setter with basename n.
7-
/// @description Check that it is a compile-time error if the interface
8-
/// of C has a method named n and a setter with basename n.
7+
///
8+
/// @description Check that it is a compile-time error if the interface of class
9+
/// `C` has a method named `n` and a setter with basename `n`.
910
/// @author [email protected]
1011
1112
class C {
@@ -14,14 +15,14 @@ class C {
1415

1516
set s(var value) {}
1617
// ^
17-
// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_DEFINITION
18-
// [cfe] 's' is already declared in this scope.
18+
// [analyzer] unspecified
19+
// [cfe] unspecified
1920
set _s(var value) {}
2021
// ^^
21-
// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_DEFINITION
22-
// [cfe] '_s' is already declared in this scope.
22+
// [analyzer] unspecified
23+
// [cfe] unspecified
2324
}
2425

2526
main() {
26-
new C();
27+
print(C);
2728
}

Language/Classes/Class_Member_Conflicts/static_member_and_constructor_t01.dart

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,57 +4,49 @@
44

55
/// @assertion Let C be a class. It is a compile-time error if C declares a
66
/// constructor named C.n and a static member with basename n.
7-
/// @description Check that it is a compile-time error if C declares a
8-
/// constructor named C.n and a static member with basename n
7+
///
8+
/// @description Check that it is a compile-time error if class `C` declares a
9+
/// constructor named `C.n` and a static member with basename `n`.
910
/// @author [email protected]
1011
/// @issue 46814
1112
1213
class C {
1314
C.s1() {}
1415
// ^
1516
// [analyzer] unspecified
16-
// [cfe] unspecified
1717
static set s1(var value) {}
1818
// ^
1919
// [cfe] unspecified
2020

2121
C.s2() {}
2222
// ^
2323
// [analyzer] unspecified
24-
// [cfe] unspecified
2524
static void s2() {}
2625
// ^
2726
// [cfe] unspecified
2827

2928
C.s3() {}
3029
// ^
3130
// [analyzer] unspecified
32-
// [cfe] unspecified
3331
static int s3() => 1;
3432
// ^
3533
// [cfe] unspecified
3634

3735
C.s4() {}
3836
// ^
3937
// [analyzer] unspecified
40-
// [cfe] unspecified
4138
static int get s4 => 1;
4239
// ^
4340
// [cfe] unspecified
4441

4542
C.s5() {}
4643
// ^
4744
// [analyzer] unspecified
48-
// [cfe] unspecified
4945
static int s5 = 1;
5046
// ^
5147
// [cfe] unspecified
5248
}
5349

5450
main() {
55-
new C.s1();
56-
new C.s2();
57-
new C.s3();
58-
new C.s4();
59-
new C.s5();
51+
print(C);
6052
}

Language/Classes/Class_Member_Conflicts/static_member_and_instance_member_t02.dart

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
/// static member with basename n and the interface of C has an instance member
77
/// with basename n
88
///
9-
/// @description Check that it is a compile-time error if C declares a static
10-
/// member with basename n and an instance member with basename n. Test instance
11-
/// setter
9+
/// @description Check that it is a compile-time error if class `C` declares a
10+
/// static member with basename `n` and an instance member with basename `n`.
11+
/// Test an instance setter.
1212
/// @author [email protected]
1313
/// @issue 46814
1414
@@ -18,15 +18,12 @@ class C {
1818
set s3(int v) {}
1919
set s4(int v) {}
2020
set s5(int v) {}
21-
// ^^
22-
// [cfe] unspecified
21+
2322
set _s1(int v) {}
2423
set _s2(int v) {}
2524
set _s3(int v) {}
2625
set _s4(int v) {}
2726
set _s5(int v) {}
28-
// ^^^
29-
// [cfe] unspecified
3027

3128
static set s1(var value) {}
3229
// ^^
@@ -72,5 +69,5 @@ class C {
7269
}
7370

7471
main() {
75-
new C();
72+
print(C);
7673
}

Language/Classes/Class_Member_Conflicts/static_member_and_instance_member_t04.dart

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,21 @@
66
/// static member with basename n and the interface of C has an instance member
77
/// with basename n
88
///
9-
/// @description Check that it is a compile-time error if C declares a static
10-
/// member with basename n and an instance member with basename n. Test instance
11-
/// variable
9+
/// @description Check that it is a compile-time error if class `C` declares a
10+
/// static member with basename `n` and an instance member with basename `n`.
11+
/// Test an instance variable.
1212
///
1313
/// @Issue 47489
1414
/// @author [email protected]
1515
1616
class C {
17-
18-
// For each 's1' and '_s1', two instance variables implicitly induce a getter
19-
// and a setter, so there is a conflict specified in 'Class Member Conflicts'
20-
// as well as a regular name clash. Dart produces two compile time errors here
21-
// whereas analyzer reports the 'Class Member Conflicts' error, and it seems
22-
// reasonable to omit the plain name clashes.
2317
int s1 = 1;
24-
// ^^
25-
// [cfe] unspecified
26-
27-
2818
int s2 = 1;
2919
int s3 = 1;
3020
int s4 = 1;
3121
int s5 = 1;
3222

3323
int _s1 = 1;
34-
// ^^
35-
// [cfe] unspecified
36-
3724
int _s2 = 1;
3825
int _s3 = 1;
3926
int _s4 = 1;
@@ -92,5 +79,5 @@ class C {
9279
}
9380

9481
main() {
95-
new C();
82+
print(C);
9683
}

Language/Classes/Constructors/name_t04.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,24 @@
66
/// enclosing class, and may optionally be followed by a dot and an identifier
77
/// id. It is a compile-time error if the name of a constructor is not a
88
/// constructor name.
9-
/// A constructor declaration may conflict with static member declarations
10-
/// (10.11).
9+
/// A constructor declaration may conflict with static member declarations.
1110
/// Let C be a class. It is a compile-time error if C declares a
1211
/// • constructor named C.n and a static member with basename n.
1312
///
1413
/// @description Checks that a compile-error is produced when a constructor's id
1514
/// coincides with the name of a static method declared in the same class.
1615
/// @author kaigorodov
1716
18-
1917
class C {
2018
C.foo() {}
2119
// ^^^
2220
// [analyzer] unspecified
23-
// [cfe] unspecified
2421

2522
static foo() {}
2623
// ^^^
2724
// [cfe] unspecified
2825
}
2926

3027
main() {
31-
new C.foo();
28+
print(C);
3229
}

Language/Classes/Constructors/name_t05.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,28 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
/// @assertion * @assertion A constructor name always begins with the name of its immediately
5+
/// @assertion A constructor name always begins with the name of its immediately
66
/// enclosing class, and may optionally be followed by a dot and an identifier
77
/// id. It is a compile-time error if the name of a constructor is not a
88
/// constructor name.
9-
/// A constructor declaration may conflict with static member declarations
10-
/// (10.11).
9+
/// A constructor declaration may conflict with static member declarations.
1110
/// Let C be a class. It is a compile-time error if C declares a
1211
/// • constructor named C.n and a static member with basename n.
1312
///
1413
/// @description Checks that a compile-error is produced when a constructor's id
1514
/// coincides with the name of a static field declared in the same class.
1615
/// @author kaigorodov
1716
18-
1917
class C {
2018
C.foo() {}
2119
// ^^^
2220
// [analyzer] unspecified
23-
// [cfe] unspecified
2421

2522
static var foo;
2623
// ^^^
2724
// [cfe] unspecified
2825
}
2926

3027
main() {
31-
new C.foo();
28+
print(C);
3229
}

Language/Classes/Constructors/name_t06.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,16 @@
1515
/// coincides with the name of a static getter declared in the same class.
1616
/// @author kaigorodov
1717
18-
1918
class C {
2019
C.foo() {}
2120
// ^^^
2221
// [analyzer] unspecified
23-
// [cfe] unspecified
2422

2523
static int get foo => 1;
2624
// ^^^
2725
// [cfe] unspecified
2826
}
2927

3028
main() {
31-
new C.foo();
29+
print(C);
3230
}

Language/Classes/Getters/static_getter_t01.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@
44

55
/// @assertion It is a compile error if a class declares a static getter named
66
/// v and also has a non-static setter named v =.
7+
///
78
/// @description Checks that a compile error is arisen if a class has an
89
/// explicitly declared static getter and an explicitly declared instance
910
/// setter with the same name.
1011
/// @author [email protected]
1112
1213
class C {
13-
int n = 0;
14-
1514
static get v => 5;
1615
// ^
1716
// [analyzer] unspecified
1817
// [cfe] unspecified
1918

2019
set v(int v1) {
21-
n = v1;
20+
// ^
21+
// [cfe] unspecified
2222
}
2323
}
2424

2525
main() {
26-
C.v;
26+
print(C);
2727
}

Language/Classes/Getters/static_getter_t02.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
/// @assertion It is a compile error if a class declares a static getter named
66
/// v and also has a non-static setter named v =.
7+
///
78
/// @description Checks that a compile error is arisen if a class has an
89
/// implicitly declared static getter and an explicitly declared instance
910
/// setter with the same name.
@@ -14,7 +15,6 @@ class C {
1415
static int v = 0;
1516
// ^
1617
// [analyzer] unspecified
17-
// [cfe] unspecified
1818

1919
set v(int v1) {
2020
// ^
@@ -23,5 +23,5 @@ class C {
2323
}
2424

2525
main() {
26-
C.v;
26+
print(C);
2727
}

Language/Classes/Setters/static_setter_t01.dart

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44

55
/// @assertion It is a compile time error if a class declares a static setter
66
/// named v= and also has a non-static member named v.
7+
///
78
/// @description Checks that it is a compile time error if a class declares a
8-
/// static setter named v= and also has a non-static field named v.
9+
/// static setter named `v=` and also has a non-static field named `v`.
910
/// @author kaigorodov
1011
11-
1212
class C {
1313
String foo = "Lily was here";
14-
// ^
15-
// [cfe] unspecified
1614

1715
static set foo(String s) {}
1816
// ^
@@ -21,8 +19,5 @@ class C {
2119
}
2220

2321
main() {
24-
C.foo = "foo";
25-
// ^
26-
// [analyzer] unspecified
27-
// [cfe] unspecified
22+
print(C);
2823
}

0 commit comments

Comments
 (0)