Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2641. Add tests for multiple top-level declarations named _ #2667

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LanguageFeatures/Wildcards/binding_A02_t07.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ extension Ext on A {
class MA = Object with M;

main() {
void localFunction<_, _, _ extends num>() => "localFunction";
String localFunction<_, _, _ extends num>() => "localFunction";

var functionExpression = <_, _, _ extends num>() => "functionExpression";

Expand Down
75 changes: 75 additions & 0 deletions LanguageFeatures/Wildcards/unchanged_A04_t01.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Copyright (c) 2024, 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 Other declarations: top-level variables, top-level function
/// names, type names, member names, etc. are unchanged. They can be named `_`
/// as they are today.
///
/// @description Checks that any top-level declaration named `_` is a
/// compile-time error if there is an earlier declaration of a top-level
/// variable named `_`.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=wildcard-variables

var _;

int _ = 1;
// ^
// [analyzer] unspecified
// [cfe] unspecified

const _ = 1;
// ^
// [analyzer] unspecified
// [cfe] unspecified

int _() => 42;
// ^
// [analyzer] unspecified
// [cfe] unspecified

int get _ => 42;
// ^
// [analyzer] unspecified
// [cfe] unspecified

class _ {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

mixin _ {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

enum _ {e1;}
// ^
// [analyzer] unspecified
// [cfe] unspecified

extension type _(int id) {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

class A {}
extension _ on A {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

typedef _ = A;
// ^
// [analyzer] unspecified
// [cfe] unspecified

typedef void _();
// ^
// [analyzer] unspecified
// [cfe] unspecified

main() {
}
75 changes: 75 additions & 0 deletions LanguageFeatures/Wildcards/unchanged_A04_t02.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Copyright (c) 2024, 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 Other declarations: top-level variables, top-level function
/// names, type names, member names, etc. are unchanged. They can be named `_`
/// as they are today.
///
/// @description Checks that any top-level declaration named `_` is a
/// compile-time error if there is an earlier declaration of a top-level
/// constant named `_`.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=wildcard-variables

const _ = 42;

int _ = 1;
// ^
// [analyzer] unspecified
// [cfe] unspecified

const _ = 1;
// ^
// [analyzer] unspecified
// [cfe] unspecified

int _() => 42;
// ^
// [analyzer] unspecified
// [cfe] unspecified

int get _ => 42;
// ^
// [analyzer] unspecified
// [cfe] unspecified

class _ {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

mixin _ {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

enum _ {e1;}
// ^
// [analyzer] unspecified
// [cfe] unspecified

extension type _(int id) {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

class A {}
extension _ on A {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

typedef _ = A;
// ^
// [analyzer] unspecified
// [cfe] unspecified

typedef void _();
// ^
// [analyzer] unspecified
// [cfe] unspecified

main() {
}
75 changes: 75 additions & 0 deletions LanguageFeatures/Wildcards/unchanged_A04_t03.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Copyright (c) 2024, 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 Other declarations: top-level variables, top-level function
/// names, type names, member names, etc. are unchanged. They can be named `_`
/// as they are today.
///
/// @description Checks that any top-level declaration named `_` is a
/// compile-time error if there is an earlier declaration of a top-level
/// function named `_`.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=wildcard-variables

void _() {}

int _ = 1;
// ^
// [analyzer] unspecified
// [cfe] unspecified

const _ = 1;
// ^
// [analyzer] unspecified
// [cfe] unspecified

int _() => 42;
// ^
// [analyzer] unspecified
// [cfe] unspecified

int get _ => 42;
// ^
// [analyzer] unspecified
// [cfe] unspecified

class _ {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

mixin _ {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

enum _ {e1;}
// ^
// [analyzer] unspecified
// [cfe] unspecified

extension type _(int id) {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

class A {}
extension _ on A {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

typedef _ = A;
// ^
// [analyzer] unspecified
// [cfe] unspecified

typedef void _();
// ^
// [analyzer] unspecified
// [cfe] unspecified

main() {
}
75 changes: 75 additions & 0 deletions LanguageFeatures/Wildcards/unchanged_A04_t04.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Copyright (c) 2024, 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 Other declarations: top-level variables, top-level function
/// names, type names, member names, etc. are unchanged. They can be named `_`
/// as they are today.
///
/// @description Checks that any top-level declaration named `_` is a
/// compile-time error if there is an earlier declaration of a top-level
/// getter named `_`.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=wildcard-variables

int get _ => 0;

int _ = 1;
// ^
// [analyzer] unspecified
// [cfe] unspecified

const _ = 1;
// ^
// [analyzer] unspecified
// [cfe] unspecified

int _() => 42;
// ^
// [analyzer] unspecified
// [cfe] unspecified

int get _ => 42;
// ^
// [analyzer] unspecified
// [cfe] unspecified

class _ {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

mixin _ {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

enum _ {e1;}
// ^
// [analyzer] unspecified
// [cfe] unspecified

extension type _(int id) {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

class A {}
extension _ on A {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

typedef _ = A;
// ^
// [analyzer] unspecified
// [cfe] unspecified

typedef void _();
// ^
// [analyzer] unspecified
// [cfe] unspecified

main() {
}
74 changes: 74 additions & 0 deletions LanguageFeatures/Wildcards/unchanged_A04_t05.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Copyright (c) 2024, 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 Other declarations: top-level variables, top-level function
/// names, type names, member names, etc. are unchanged. They can be named `_`
/// as they are today.
///
/// @description Checks that any top-level declaration named `_` is a
/// compile-time error if there is an earlier declaration of a class named `_`.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=wildcard-variables

class _ {}

int _ = 1;
// ^
// [analyzer] unspecified
// [cfe] unspecified

const _ = 1;
// ^
// [analyzer] unspecified
// [cfe] unspecified

int _() => 42;
// ^
// [analyzer] unspecified
// [cfe] unspecified

int get _ => 42;
// ^
// [analyzer] unspecified
// [cfe] unspecified

class _ {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

mixin _ {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

enum _ {e1;}
// ^
// [analyzer] unspecified
// [cfe] unspecified

extension type _(int id) {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

class A {}
extension _ on A {}
// ^
// [analyzer] unspecified
// [cfe] unspecified

typedef _ = A;
// ^
// [analyzer] unspecified
// [cfe] unspecified

typedef void _();
// ^
// [analyzer] unspecified
// [cfe] unspecified

main() {
}
Loading