Skip to content

Commit

Permalink
Fixes #2136. Add type variable conflict test (#2137)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrekhov authored Jul 17, 2023
1 parent 826bc51 commit 862d8f0
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 37 deletions.
8 changes: 4 additions & 4 deletions Language/Classes/same_name_type_variable_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// 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 It is a compile time error if a generic class declares a type
/// variable with the same name as the class or any of its members or
/// constructors.
/// @assertion If a generic class named G declares a type variable named X, it
/// is a compile-time error if X is equal to G, or if G has a member whose
/// basename is X, or if G has a constructor named G.X.
///
/// @description Checks that a type variable can not have the same name as
/// the name of generic class.
/// @author ilya
/// @issue 14513

class A<A> {
// ^
// [analyzer] unspecified
Expand Down
8 changes: 4 additions & 4 deletions Language/Classes/same_name_type_variable_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// 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 It is a compile time error if a generic class declares a type
/// variable with the same name as the class or any of its members or
/// constructors.
/// @assertion If a generic class named G declares a type variable named X, it
/// is a compile-time error if X is equal to G, or if G has a member whose
/// basename is X, or if G has a constructor named G.X.
///
/// @description Checks that a type variable can not have the same name as
/// the name of generic class instance variable.
/// @author ilya

class A<T> {
// ^
// [analyzer] unspecified
Expand Down
8 changes: 4 additions & 4 deletions Language/Classes/same_name_type_variable_t03.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// 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 It is a compile time error if a generic class declares a type
/// variable with the same name as the class or any of its members or
/// constructors.
/// @assertion If a generic class named G declares a type variable named X, it
/// is a compile-time error if X is equal to G, or if G has a member whose
/// basename is X, or if G has a constructor named G.X.
///
/// @description Checks that a type variable can not have the same name as
/// the name of generic class instance getter.
/// @author ilya

class A<T> {
// ^
// [analyzer] unspecified
Expand Down
8 changes: 4 additions & 4 deletions Language/Classes/same_name_type_variable_t04.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// 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 It is a compile time error if a generic class declares a type
/// variable with the same name as the class or any of its members or
/// constructors.
/// @assertion If a generic class named G declares a type variable named X, it
/// is a compile-time error if X is equal to G, or if G has a member whose
/// basename is X, or if G has a constructor named G.X.
///
/// @description Checks that a type variable can not have the same name as
/// the name of generic class instance setter.
/// @author ilya
/// @issue 14513

class A<T> {
// ^
// [analyzer] unspecified
Expand Down
8 changes: 4 additions & 4 deletions Language/Classes/same_name_type_variable_t05.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// 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 It is a compile time error if a generic class declares a type
/// variable with the same name as the class or any of its members or
/// constructors.
/// @assertion If a generic class named G declares a type variable named X, it
/// is a compile-time error if X is equal to G, or if G has a member whose
/// basename is X, or if G has a constructor named G.X.
///
/// @description Checks that a type variable can not have the same name as
/// the name of generic class static variable.
/// @author ilya

class A<T> {
// ^
// [analyzer] unspecified
Expand Down
8 changes: 4 additions & 4 deletions Language/Classes/same_name_type_variable_t06.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// 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 It is a compile time error if a generic class declares a type
/// variable with the same name as the class or any of its members or
/// constructors.
/// @assertion If a generic class named G declares a type variable named X, it
/// is a compile-time error if X is equal to G, or if G has a member whose
/// basename is X, or if G has a constructor named G.X.
///
/// @description Checks that a type variable can not have the same name as
/// the name of generic class static getter.
/// @author ilya

class A<T> {
// ^
// [analyzer] unspecified
Expand Down
10 changes: 5 additions & 5 deletions Language/Classes/same_name_type_variable_t07.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// 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 It is a compile time error if a generic class declares a type
/// variable with the same name as the class or any of its members or
/// constructors.
/// @assertion If a generic class named G declares a type variable named X, it
/// is a compile-time error if X is equal to G, or if G has a member whose
/// basename is X, or if G has a constructor named G.X.
///
/// @description Checks that a type variable can not have the same name as
/// the name of generic class static setter.
/// @author ilya
/// @issue 14513
/// @issue 14513
class A<T> {
// ^
Expand Down
8 changes: 4 additions & 4 deletions Language/Classes/same_name_type_variable_t08.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// 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 It is a compile time error if a generic class declares a type
/// variable with the same name as the class or any of its members or
/// constructors.
/// @assertion If a generic class named G declares a type variable named X, it
/// is a compile-time error if X is equal to G, or if G has a member whose
/// basename is X, or if G has a constructor named G.X.
///
/// @description Checks that a type variable can not have the same name as
/// the name of generic class instance method.
/// @author ilya

class A<T> {
// ^
// [analyzer] unspecified
Expand Down
8 changes: 4 additions & 4 deletions Language/Classes/same_name_type_variable_t09.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// 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 It is a compile time error if a generic class declares a type
/// variable with the same name as the class or any of its members or
/// constructors.
/// @assertion If a generic class named G declares a type variable named X, it
/// is a compile-time error if X is equal to G, or if G has a member whose
/// basename is X, or if G has a constructor named G.X.
///
/// @description Checks that a type variable can not have the same name as
/// the name of generic class static method.
/// @author ilya

class A<T> {
// ^
// [analyzer] unspecified
Expand Down
23 changes: 23 additions & 0 deletions Language/Classes/same_name_type_variable_t10.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) 2023, 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.

/// @assertion If a generic class named G declares a type variable named X, it
/// is a compile-time error if X is equal to G, or if G has a member whose
/// basename is X, or if G has a constructor named G.X.
///
/// @description Checks that it is a compile-time error if a class `C` has a
/// constructor named `C.T`, where `T` is a type variable
/// @author sgrekhov22@gmail.com
class C<T> {
// ^
// [analyzer] unspecified
C.T() {}
//^
// [cfe] unspecified
}

main() {
print(C);
}

0 comments on commit 862d8f0

Please sign in to comment.