Skip to content

Commit

Permalink
Fixes #2996. Update CFE expected errors locations (#2999)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrekhov authored Nov 27, 2024
1 parent 53a0fdc commit 4c0cf74
Show file tree
Hide file tree
Showing 41 changed files with 62 additions and 151 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

/// @assertion Let C be a class. ... It is a compile-time error if the interface
/// of C has a method named n and a setter with basename n.
/// @description Check that it is a compile-time error if the interface
/// of C has a method named n and a setter with basename n.
///
/// @description Check that it is a compile-time error if the interface of class
/// `C` has a method named `n` and a setter with basename `n`.
/// @author [email protected]
class C {
Expand All @@ -14,14 +15,14 @@ class C {

set s(var value) {}
// ^
// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_DEFINITION
// [cfe] 's' is already declared in this scope.
// [analyzer] unspecified
// [cfe] unspecified
set _s(var value) {}
// ^^
// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_DEFINITION
// [cfe] '_s' is already declared in this scope.
// [analyzer] unspecified
// [cfe] unspecified
}

main() {
new C();
print(C);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,49 @@

/// @assertion Let C be a class. It is a compile-time error if C declares a
/// constructor named C.n and a static member with basename n.
/// @description Check that it is a compile-time error if C declares a
/// constructor named C.n and a static member with basename n
///
/// @description Check that it is a compile-time error if class `C` declares a
/// constructor named `C.n` and a static member with basename `n`.
/// @author [email protected]
/// @issue 46814
class C {
C.s1() {}
// ^
// [analyzer] unspecified
// [cfe] unspecified
static set s1(var value) {}
// ^
// [cfe] unspecified

C.s2() {}
// ^
// [analyzer] unspecified
// [cfe] unspecified
static void s2() {}
// ^
// [cfe] unspecified

C.s3() {}
// ^
// [analyzer] unspecified
// [cfe] unspecified
static int s3() => 1;
// ^
// [cfe] unspecified

C.s4() {}
// ^
// [analyzer] unspecified
// [cfe] unspecified
static int get s4 => 1;
// ^
// [cfe] unspecified

C.s5() {}
// ^
// [analyzer] unspecified
// [cfe] unspecified
static int s5 = 1;
// ^
// [cfe] unspecified
}

main() {
new C.s1();
new C.s2();
new C.s3();
new C.s4();
new C.s5();
print(C);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
/// static member with basename n and the interface of C has an instance member
/// with basename n
///
/// @description Check that it is a compile-time error if C declares a static
/// member with basename n and an instance member with basename n. Test instance
/// setter
/// @description Check that it is a compile-time error if class `C` declares a
/// static member with basename `n` and an instance member with basename `n`.
/// Test an instance setter.
/// @author [email protected]
/// @issue 46814
Expand All @@ -18,15 +18,12 @@ class C {
set s3(int v) {}
set s4(int v) {}
set s5(int v) {}
// ^^
// [cfe] unspecified

set _s1(int v) {}
set _s2(int v) {}
set _s3(int v) {}
set _s4(int v) {}
set _s5(int v) {}
// ^^^
// [cfe] unspecified

static set s1(var value) {}
// ^^
Expand Down Expand Up @@ -72,5 +69,5 @@ class C {
}

main() {
new C();
print(C);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,21 @@
/// static member with basename n and the interface of C has an instance member
/// with basename n
///
/// @description Check that it is a compile-time error if C declares a static
/// member with basename n and an instance member with basename n. Test instance
/// variable
/// @description Check that it is a compile-time error if class `C` declares a
/// static member with basename `n` and an instance member with basename `n`.
/// Test an instance variable.
///
/// @Issue 47489
/// @author [email protected]
class C {

// For each 's1' and '_s1', two instance variables implicitly induce a getter
// and a setter, so there is a conflict specified in 'Class Member Conflicts'
// as well as a regular name clash. Dart produces two compile time errors here
// whereas analyzer reports the 'Class Member Conflicts' error, and it seems
// reasonable to omit the plain name clashes.
int s1 = 1;
// ^^
// [cfe] unspecified


int s2 = 1;
int s3 = 1;
int s4 = 1;
int s5 = 1;

int _s1 = 1;
// ^^
// [cfe] unspecified

int _s2 = 1;
int _s3 = 1;
int _s4 = 1;
Expand Down Expand Up @@ -92,5 +79,5 @@ class C {
}

main() {
new C();
print(C);
}
7 changes: 2 additions & 5 deletions Language/Classes/Constructors/name_t04.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,24 @@
/// enclosing class, and may optionally be followed by a dot and an identifier
/// id. It is a compile-time error if the name of a constructor is not a
/// constructor name.
/// A constructor declaration may conflict with static member declarations
/// (10.11).
/// A constructor declaration may conflict with static member declarations.
/// Let C be a class. It is a compile-time error if C declares a
/// • constructor named C.n and a static member with basename n.
///
/// @description Checks that a compile-error is produced when a constructor's id
/// coincides with the name of a static method declared in the same class.
/// @author kaigorodov

class C {
C.foo() {}
// ^^^
// [analyzer] unspecified
// [cfe] unspecified

static foo() {}
// ^^^
// [cfe] unspecified
}

main() {
new C.foo();
print(C);
}
9 changes: 3 additions & 6 deletions Language/Classes/Constructors/name_t05.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,28 @@
// 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.

/// @assertion * @assertion A constructor name always begins with the name of its immediately
/// @assertion A constructor name always begins with the name of its immediately
/// enclosing class, and may optionally be followed by a dot and an identifier
/// id. It is a compile-time error if the name of a constructor is not a
/// constructor name.
/// A constructor declaration may conflict with static member declarations
/// (10.11).
/// A constructor declaration may conflict with static member declarations.
/// Let C be a class. It is a compile-time error if C declares a
/// • constructor named C.n and a static member with basename n.
///
/// @description Checks that a compile-error is produced when a constructor's id
/// coincides with the name of a static field declared in the same class.
/// @author kaigorodov

class C {
C.foo() {}
// ^^^
// [analyzer] unspecified
// [cfe] unspecified

static var foo;
// ^^^
// [cfe] unspecified
}

main() {
new C.foo();
print(C);
}
4 changes: 1 addition & 3 deletions Language/Classes/Constructors/name_t06.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,16 @@
/// coincides with the name of a static getter declared in the same class.
/// @author kaigorodov

class C {
C.foo() {}
// ^^^
// [analyzer] unspecified
// [cfe] unspecified

static int get foo => 1;
// ^^^
// [cfe] unspecified
}

main() {
new C.foo();
print(C);
}
8 changes: 4 additions & 4 deletions Language/Classes/Getters/static_getter_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@

/// @assertion It is a compile error if a class declares a static getter named
/// v and also has a non-static setter named v =.
///
/// @description Checks that a compile error is arisen if a class has an
/// explicitly declared static getter and an explicitly declared instance
/// setter with the same name.
/// @author [email protected]
class C {
int n = 0;

static get v => 5;
// ^
// [analyzer] unspecified
// [cfe] unspecified

set v(int v1) {
n = v1;
// ^
// [cfe] unspecified
}
}

main() {
C.v;
print(C);
}
4 changes: 2 additions & 2 deletions Language/Classes/Getters/static_getter_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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

set v(int v1) {
// ^
Expand All @@ -23,5 +23,5 @@ class C {
}

main() {
C.v;
print(C);
}
11 changes: 3 additions & 8 deletions Language/Classes/Setters/static_setter_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@

/// @assertion It is a compile time error if a class declares a static setter
/// named v= and also has a non-static member named v.
///
/// @description Checks that it is a compile time error if a class declares a
/// static setter named v= and also has a non-static field named v.
/// static setter named `v=` and also has a non-static field named `v`.
/// @author kaigorodov

class C {
String foo = "Lily was here";
// ^
// [cfe] unspecified

static set foo(String s) {}
// ^
Expand All @@ -21,8 +19,5 @@ class C {
}

main() {
C.foo = "foo";
// ^
// [analyzer] unspecified
// [cfe] unspecified
print(C);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
extension type ET1(int id) {
static int get n => 1;
// ^
// [cfe] unspecified
ET1.n(this.id);
// ^
// [analyzer] unspecified
Expand All @@ -22,8 +20,6 @@ extension type ET1(int id) {

extension type ET2(int id) {
static int n() => 2;
// ^
// [cfe] unspecified
const ET2.n(this.id);
// ^
// [analyzer] unspecified
Expand All @@ -32,8 +28,6 @@ extension type ET2(int id) {

extension type ET3(int id) {
static int n() => 3;
// ^
// [cfe] unspecified
factory ET3.n(int id) = ET3.new;
// ^
// [analyzer] unspecified
Expand All @@ -42,8 +36,6 @@ extension type ET3(int id) {

extension type ET4(int id) {
static int n = 1;
// ^
// [cfe] unspecified
ET4.n(this.id);
// ^
// [analyzer] unspecified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ extension type ET7(int id) {
}

extension type ET8(int id) {
// ^^
// [cfe] unspecified
static void set id(int v) {}
// ^^
// [analyzer] unspecified
Expand Down
Loading

0 comments on commit 4c0cf74

Please sign in to comment.