forked from dart-lang/co19
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dart-lang#2559. Add tests checking that
augment
is a built-in ident…
…ifier
- Loading branch information
Showing
6 changed files
with
183 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
Language/Expressions/Identifier_Reference/built_in_identifier_A26_t01.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
/// `augment` is used as the declared name of a class, mixin or enum. | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
class augment {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
mixin augment {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
enum augment {e1;} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
} |
50 changes: 50 additions & 0 deletions
50
Language/Expressions/Identifier_Reference/built_in_identifier_A26_t02.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// 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 | ||
/// `augment` is used as the declared name of a type variable. | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
class C<augment> { | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
mixin M<augment> { | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
enum E<augment> { | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
e1; | ||
} | ||
|
||
void foo<augment>() {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
extension Ext<augment> on List {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
print(C); | ||
print(M); | ||
print(E); | ||
print(foo); | ||
print(List); | ||
} |
26 changes: 26 additions & 0 deletions
26
Language/Expressions/Identifier_Reference/built_in_identifier_A26_t03.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
/// `augment` is used as the declared name of a type alias. | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
typedef int augment(); | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
typedef augment = int; | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
} |
22 changes: 22 additions & 0 deletions
22
Language/Expressions/Identifier_Reference/built_in_identifier_A26_t04.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
/// `augment` is used as the declared name of a prefix. | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import "../lib.dart" as augment; | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
augment.x; | ||
} |
21 changes: 21 additions & 0 deletions
21
Language/Expressions/Identifier_Reference/built_in_identifier_A26_t05.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
/// `augment` is used as the name of an extension. | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
extension augment on int {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
} |
33 changes: 33 additions & 0 deletions
33
Language/Expressions/Identifier_Reference/built_in_identifier_A26_t06.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// 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 | ||
/// `augment` is used as the name, type parameter or alias of an extension type | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
extension type augment(int _) {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
extension type ListET<augment>(List<augment> _) {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
extension type ET(int _) {} | ||
|
||
typedef augment = ET; | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
} |