-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add tests for augment libraries errors
- Loading branch information
Showing
11 changed files
with
399 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 sgrekhov22@gmail.com | ||
/// @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 sgrekhov22@gmail.com | ||
/// @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 |
34 changes: 34 additions & 0 deletions
34
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,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 sgrekhov22@gmail.com | ||
/// @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_t02_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 sgrekhov22@gmail.com | ||
/// @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; |
78 changes: 78 additions & 0 deletions
78
LanguageFeatures/Augmentation-libraries/defining_augmentation_A03_t02_lib2.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 another | ||
/// augmentation of the same library. | ||
/// @author sgrekhov22@gmail.com | ||
/// @issue 55113 | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
library augment 'defining_augmentation_A03_t03.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 |
19 changes: 19 additions & 0 deletions
19
LanguageFeatures/Augmentation-libraries/defining_augmentation_A04_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,19 @@ | ||
// 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: | ||
/// ... | ||
/// - An augmentation library contains any part directives. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmentation | ||
/// library contains any part directives. | ||
/// @author sgrekhov22@gmail.com | ||
/// @issue 55116 | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import augment 'defining_augmentation_A04_t01_lib.dart'; | ||
|
||
main() { | ||
} |
21 changes: 21 additions & 0 deletions
21
LanguageFeatures/Augmentation-libraries/defining_augmentation_A04_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,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 compile-time error if: | ||
/// ... | ||
/// - An augmentation library contains any part directives. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmentation | ||
/// library contains any part directives. | ||
/// @author sgrekhov22@gmail.com | ||
/// @issue 55116 | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
library augment 'defining_augmentation_A04_t01.dart'; | ||
|
||
/**/part 'defining_augmentation_A04_t01_part.dart'; | ||
// ^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified |
16 changes: 16 additions & 0 deletions
16
LanguageFeatures/Augmentation-libraries/defining_augmentation_A04_t01_part.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,16 @@ | ||
// 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: | ||
/// ... | ||
/// - An augmentation library contains any part directives. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmentation | ||
/// library contains any part directives. | ||
/// @author sgrekhov22@gmail.com | ||
/// @issue 55116 | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
part of 'defining_augmentation_A04_t01_lib.dart'; |
22 changes: 22 additions & 0 deletions
22
LanguageFeatures/Augmentation-libraries/defining_augmentation_A04_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,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 compile-time error if: | ||
/// ... | ||
/// - An augmentation library contains any part directives. | ||
/// | ||
/// @description Checks that it is no error if a library that has an | ||
/// augmentation contains a part directive. | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import augment 'defining_augmentation_A04_t02_lib.dart'; | ||
import '../../Utils/expect.dart'; | ||
|
||
part 'defining_augmentation_A04_t02_part.dart'; | ||
|
||
main() { | ||
Expect.equals("x", x); | ||
} |
15 changes: 15 additions & 0 deletions
15
LanguageFeatures/Augmentation-libraries/defining_augmentation_A04_t02_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,15 @@ | ||
// 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: | ||
/// ... | ||
/// - An augmentation library contains any part directives. | ||
/// | ||
/// @description Checks that it is no error if a library that has an | ||
/// augmentation contains a part directive. | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
library augment 'defining_augmentation_A04_t02.dart'; |
Oops, something went wrong.