mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:27:17 +00:00
7e756d6f86
Change-Id: Iee96b1e254f17ee0b1b7b309cc807bf874a1491e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151982 Auto-Submit: Bob Nystrom <rnystrom@google.com> Commit-Queue: Nicholas Shahan <nshahan@google.com> Reviewed-by: Nicholas Shahan <nshahan@google.com>
84 lines
1.8 KiB
Dart
84 lines
1.8 KiB
Dart
// Copyright (c) 2013, 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.
|
|
|
|
// Test that we report a compile-time error when a type parameter conflicts
|
|
// with an instance or static member with the same name.
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
class G1<T> {
|
|
// ^
|
|
// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER
|
|
var T;
|
|
// ^
|
|
// [cfe] Conflicts with type variable 'T'.
|
|
}
|
|
|
|
class G2<T> {
|
|
// ^
|
|
// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER
|
|
get T {}
|
|
// ^
|
|
// [cfe] Conflicts with type variable 'T'.
|
|
}
|
|
|
|
class G3<T> {
|
|
// ^
|
|
// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER
|
|
T() {}
|
|
//^
|
|
// [cfe] Conflicts with type variable 'T'.
|
|
}
|
|
|
|
class G4<T> {
|
|
// ^
|
|
// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER
|
|
static var T;
|
|
// ^
|
|
// [cfe] Conflicts with type variable 'T'.
|
|
}
|
|
|
|
class G5<T> {
|
|
// ^
|
|
// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER
|
|
static get T {}
|
|
// ^
|
|
// [cfe] Conflicts with type variable 'T'.
|
|
}
|
|
|
|
class G6<T> {
|
|
// ^
|
|
// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER
|
|
static T() {}
|
|
// ^
|
|
// [cfe] Conflicts with type variable 'T'.
|
|
}
|
|
|
|
class G7<T> {
|
|
// ^
|
|
// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER
|
|
set T(_) {}
|
|
// ^
|
|
// [cfe] Conflicts with type variable 'T'.
|
|
}
|
|
|
|
class G8<T> {
|
|
// ^
|
|
// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_MEMBER
|
|
static set T(x) {}
|
|
// ^
|
|
// [cfe] Conflicts with type variable 'T'.
|
|
}
|
|
|
|
main() {
|
|
new G1<int>();
|
|
new G2<int>();
|
|
new G3<int>();
|
|
new G4<int>();
|
|
new G5<int>();
|
|
new G6<int>();
|
|
new G7<int>();
|
|
new G8<int>();
|
|
}
|