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 for augment libraries errors
- Loading branch information
Showing
13 changed files
with
639 additions
and
0 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
LanguageFeatures/Augmentation-libraries/defining_augmentation_A03_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,57 @@ | ||
// 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 compile-time error if: | ||
/// - A top-level declaration in an augmentation has the same name as a | ||
/// declaration in the main library or another of its augmentations (unless it | ||
/// is an augmenting declaration) | ||
/// | ||
/// @description Checks that it is a compile-time error if a top-level | ||
/// declaration in an augmentation has the same name as a declaration in the | ||
/// main library. | ||
/// @author [email protected] | ||
/// @issue 55113 | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import augment 'defining_augmentation_A03_t01_lib.dart'; | ||
|
||
class C {} | ||
|
||
mixin M {} | ||
|
||
enum E {e;} | ||
|
||
void foo() {} | ||
|
||
typedef void Foo(); | ||
|
||
typedef StringAlias = String; | ||
|
||
int get getter => 42; | ||
|
||
void set setter(int _) {} | ||
|
||
extension Ext on List {} | ||
|
||
extension type ET(int _) {} | ||
|
||
var x = 0; | ||
|
||
const c = 0; | ||
|
||
main() { | ||
print(C); | ||
print(M); | ||
print(E); | ||
print(foo); | ||
print(Foo); | ||
print(StringAlias); | ||
print(getter); | ||
setter = 1; | ||
print(List); | ||
print(ET); | ||
print(x); | ||
print(c); | ||
} |
78 changes: 78 additions & 0 deletions
78
LanguageFeatures/Augmentation-libraries/defining_augmentation_A03_t01_lib.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,78 @@ | ||
// 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 compile-time error if: | ||
/// - A top-level declaration in an augmentation has the same name as a | ||
/// declaration in the main library or another of its augmentations (unless it | ||
/// is an augmenting declaration) | ||
/// | ||
/// @description Checks that it is a compile-time error if a top-level | ||
/// declaration in an augmentation has the same name as a declaration in the | ||
/// main library. | ||
/// @author [email protected] | ||
/// @issue 55113 | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
library augment 'defining_augmentation_A03_t01.dart'; | ||
|
||
class C {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
mixin M {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
enum E {e;} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
void foo() {} | ||
// ^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
typedef void Foo(); | ||
// ^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
typedef StringAlias = String; | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
int get getter => 42; | ||
// ^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
void set setter(int _) {} | ||
// ^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
extension Ext on List {} | ||
// ^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
extension type ET(int _) {} | ||
// ^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
var x = 0; | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
const c = 0; | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified |
94 changes: 94 additions & 0 deletions
94
LanguageFeatures/Augmentation-libraries/defining_augmentation_A03_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,94 @@ | ||
// 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 compile-time error if: | ||
/// - A top-level declaration in an augmentation has the same name as a | ||
/// declaration in the main library or another of its augmentations (unless it | ||
/// is an augmenting declaration) | ||
/// | ||
/// @description Checks that it is a compile-time error if a top-level | ||
/// declaration in an augmentation has the same name as a declaration in the | ||
/// main library. Test the case when an entry point (function `main()`) is in an | ||
/// augmentation library | ||
/// @author [email protected] | ||
/// @issue 55113 | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
library augment 'defining_augmentation_A03_t02_main.dart'; | ||
|
||
class C {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
mixin M {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
enum E {e;} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
void foo() {} | ||
// ^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
typedef void Foo(); | ||
// ^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
typedef StringAlias = String; | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
int get getter => 42; | ||
// ^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
void set setter(int _) {} | ||
// ^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
extension Ext on List {} | ||
// ^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
extension type ET(int _) {} | ||
// ^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
var x = 0; | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
const c = 0; | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
print(C); | ||
print(M); | ||
print(E); | ||
print(foo); | ||
print(Foo); | ||
print(StringAlias); | ||
print(getter); | ||
setter = 1; | ||
print(List); | ||
print(ET); | ||
print(x); | ||
print(c); | ||
} |
43 changes: 43 additions & 0 deletions
43
LanguageFeatures/Augmentation-libraries/defining_augmentation_A03_t02_main.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,43 @@ | ||
// 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 compile-time error if: | ||
/// - A top-level declaration in an augmentation has the same name as a | ||
/// declaration in the main library or another of its augmentations (unless it | ||
/// is an augmenting declaration) | ||
/// | ||
/// @description Checks that it is a compile-time error if a top-level | ||
/// declaration in an augmentation has the same name as a declaration in the | ||
/// main library. Test the case when an entry point (function `main()`) is in an | ||
/// augmentation library | ||
/// @author [email protected] | ||
/// @issue 55113 | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import augment 'defining_augmentation_A03_t02.dart'; | ||
|
||
class C {} | ||
|
||
mixin M {} | ||
|
||
enum E {e;} | ||
|
||
void foo() {} | ||
|
||
typedef void Foo(); | ||
|
||
typedef StringAlias = String; | ||
|
||
int get getter => 42; | ||
|
||
void set setter(int _) {} | ||
|
||
extension Ext on List {} | ||
|
||
extension type ET(int _) {} | ||
|
||
var x = 0; | ||
|
||
const c = 0; |
34 changes: 34 additions & 0 deletions
34
LanguageFeatures/Augmentation-libraries/defining_augmentation_A03_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,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 compile-time error if: | ||
/// - A top-level declaration in an augmentation has the same name as a | ||
/// declaration in the main library or another of its augmentations (unless it | ||
/// is an augmenting declaration) | ||
/// | ||
/// @description Checks that it is a compile-time error if a top-level | ||
/// declaration in an augmentation has the same name as a declaration in another | ||
/// augmentation of the same library. | ||
/// @author [email protected] | ||
/// @issue 55113 | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import augment 'defining_augmentation_A03_t03_lib1.dart'; | ||
import augment 'defining_augmentation_A03_t03_lib2.dart'; | ||
|
||
main() { | ||
print(C); | ||
print(M); | ||
print(E); | ||
print(foo); | ||
print(Foo); | ||
print(StringAlias); | ||
print(getter); | ||
setter = 1; | ||
print(List); | ||
print(ET); | ||
print(x); | ||
print(c); | ||
} |
42 changes: 42 additions & 0 deletions
42
LanguageFeatures/Augmentation-libraries/defining_augmentation_A03_t03_lib1.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,42 @@ | ||
// 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 compile-time error if: | ||
/// - A top-level declaration in an augmentation has the same name as a | ||
/// declaration in the main library or another of its augmentations (unless it | ||
/// is an augmenting declaration) | ||
/// | ||
/// @description Checks that it is a compile-time error if a top-level | ||
/// declaration in an augmentation has the same name as a declaration in another | ||
/// augmentation of the same library. | ||
/// @author [email protected] | ||
/// @issue 55113 | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
library augment 'defining_augmentation_A03_t03.dart'; | ||
|
||
class C {} | ||
|
||
mixin M {} | ||
|
||
enum E {e;} | ||
|
||
void foo() {} | ||
|
||
typedef void Foo(); | ||
|
||
typedef StringAlias = String; | ||
|
||
int get getter => 42; | ||
|
||
void set setter(int _) {} | ||
|
||
extension Ext on List {} | ||
|
||
extension type ET(int _) {} | ||
|
||
var x = 0; | ||
|
||
const c = 0; |
Oops, something went wrong.