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

#2548. Add out and inout to built-in identifiers tests #2553

Merged
merged 1 commit into from
Feb 21, 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// 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 It is a syntax error if a built-in identifier is used as the
/// declared name of a prefix, class, mixin, enum, type parameter, type alias,
/// or extension.
///
/// @description Checks that it is a compile-time error if a built-in identifier
/// `inout` is used as the declared name of a class, mixin or enum.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=variance

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

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

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

main() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// 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 It is a syntax error if a built-in identifier is used as the
/// declared name of a prefix, class, mixin, enum, type parameter, type alias,
/// or extension.
///
/// @description Checks that it is a compile-time error if a built-in identifier
/// `inout` is used as the declared name of a type variable.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=variance

class C<inout> {
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

mixin M<inout> {
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

enum E<inout> {
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified
e1;
}

void foo<inout>() {}
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
print(C);
print(M);
print(E);
print(foo);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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 It is a syntax error if a built-in identifier is used as the
/// declared name of a prefix, class, mixin, enum, type parameter, type alias,
/// or extension.
///
/// @description Checks that it is a compile-time error if a built-in identifier
/// `inout` is used as the declared name of a type alias.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=variance

typedef int inout();
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified

typedef inout = int;
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// 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 It is a syntax error if a built-in identifier is used as the
/// declared name of a prefix, class, mixin, enum, type parameter, type alias,
/// or extension.
///
/// @description Checks that it is a compile-time error if a built-in identifier
/// `inout` is used as the declared name of a prefix.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=variance

import "../lib.dart" as inout;
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
inout.x;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 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 It is a syntax error if a built-in identifier is used as the
/// declared name of a prefix, class, mixin, enum, type parameter, type alias,
/// or extension.
///
/// @description Checks that it is a compile-time error if a built-in identifier
/// `inout` is used as the name of an extension.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=variance

extension inout on int {}
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// 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 It is a syntax error if a built-in identifier is used as the
/// declared name of a prefix, class, mixin, enum, type parameter, type alias,
/// or extension.
///
/// @description Checks that it is a compile-time error if a built-in identifier
/// `inout` is used as the name, type parameter or alias of an extension
/// type
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=inline-class,variance

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

extension type ListET<inout>(List<inout> _) {}
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified

extension type ET(int _) {}

typedef inout = ET;
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// 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 It is a syntax error if a built-in identifier is used as the
/// declared name of a prefix, class, mixin, enum, type parameter, type alias,
/// or extension.
///
/// @description Checks that it is a compile-time error if a built-in identifier
/// `out` is used as the declared name of a class, mixin or enum.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=variance

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

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

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

main() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// 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 It is a syntax error if a built-in identifier is used as the
/// declared name of a prefix, class, mixin, enum, type parameter, type alias,
/// or extension.
///
/// @description Checks that it is a compile-time error if a built-in identifier
/// `out` is used as the declared name of a type variable.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=variance

class C<out> {
// ^^^
// [analyzer] unspecified
// [cfe] unspecified
}

mixin M<out> {
// ^^^
// [analyzer] unspecified
// [cfe] unspecified
}

enum E<out> {
// ^^^
// [analyzer] unspecified
// [cfe] unspecified
e1;
}

void foo<out>() {}
// ^^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
print(C);
print(M);
print(E);
print(foo);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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 It is a syntax error if a built-in identifier is used as the
/// declared name of a prefix, class, mixin, enum, type parameter, type alias,
/// or extension.
///
/// @description Checks that it is a compile-time error if a built-in identifier
/// `out` is used as the declared name of a type alias.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=variance

typedef int out();
// ^^^
// [analyzer] unspecified
// [cfe] unspecified

typedef out = int;
// ^^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// 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 It is a syntax error if a built-in identifier is used as the
/// declared name of a prefix, class, mixin, enum, type parameter, type alias,
/// or extension.
///
/// @description Checks that it is a compile-time error if a built-in identifier
/// `out` is used as the declared name of a prefix.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=variance

import "../lib.dart" as out;
// ^^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
out.x;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 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 It is a syntax error if a built-in identifier is used as the
/// declared name of a prefix, class, mixin, enum, type parameter, type alias,
/// or extension.
///
/// @description Checks that it is a compile-time error if a built-in identifier
/// `out` is used as the name of an extension.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=variance

extension out on int {}
// ^^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// 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 It is a syntax error if a built-in identifier is used as the
/// declared name of a prefix, class, mixin, enum, type parameter, type alias,
/// or extension.
///
/// @description Checks that it is a compile-time error if a built-in identifier
/// `out` is used as the name, type parameter or alias of an extension
/// type
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=inline-class,variance

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

extension type ListET<out>(List<out> _) {}
// ^^^
// [analyzer] unspecified
// [cfe] unspecified

extension type ET(int _) {}

typedef out = ET;
// ^^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
}