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 augmenting types tests. Part 3
- Loading branch information
Showing
6 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
LanguageFeatures/Augmentation-libraries/augmenting_types_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,25 @@ | ||
// 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: | ||
/// ... | ||
/// - The augmenting type declares an extends clause, but one was already | ||
/// present. We don't allow overwriting an existing extends, but one can be | ||
/// filled in if it wasn't present originally. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmenting type | ||
/// declares an extends clause, but one was already present | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import augment 'augmenting_types_A03_t01_lib.dart'; | ||
|
||
class A {} | ||
class B extends A {} | ||
class C extends B {} | ||
|
||
main() { | ||
print(C); | ||
} |
29 changes: 29 additions & 0 deletions
29
LanguageFeatures/Augmentation-libraries/augmenting_types_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,29 @@ | ||
// 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: | ||
/// ... | ||
/// - The augmenting type declares an extends clause, but one was already | ||
/// present. We don't allow overwriting an existing extends, but one can be | ||
/// filled in if it wasn't present originally. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmenting type | ||
/// declares an extends clause, but one was already present | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
library augment 'augmenting_types_A03_t01.dart'; | ||
|
||
augment class C extends A {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
class D {} | ||
|
||
augment class C extends D {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified |
26 changes: 26 additions & 0 deletions
26
LanguageFeatures/Augmentation-libraries/augmenting_types_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,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 compile-time error if: | ||
/// ... | ||
/// - The augmenting type declares an extends clause, but one was already | ||
/// present. We don't allow overwriting an existing extends, but one can be | ||
/// filled in if it wasn't present originally. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmenting type | ||
/// declares an extends clause, but one was already present. Test the same | ||
/// `extends` class | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import augment 'augmenting_types_A03_t02_lib.dart'; | ||
|
||
class A {} | ||
class C extends A {} | ||
typedef AAlias = A; | ||
|
||
main() { | ||
print(C); | ||
} |
28 changes: 28 additions & 0 deletions
28
LanguageFeatures/Augmentation-libraries/augmenting_types_A03_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,28 @@ | ||
// 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: | ||
/// ... | ||
/// - The augmenting type declares an extends clause, but one was already | ||
/// present. We don't allow overwriting an existing extends, but one can be | ||
/// filled in if it wasn't present originally. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmenting type | ||
/// declares an extends clause, but one was already present. Test the same | ||
/// `extends` class | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
library augment 'augmenting_types_A03_t02.dart'; | ||
|
||
augment class C extends A {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment class C extends AAlias {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified |
28 changes: 28 additions & 0 deletions
28
LanguageFeatures/Augmentation-libraries/augmenting_types_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,28 @@ | ||
// 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: | ||
/// ... | ||
/// - The augmenting type declares an extends clause, but one was already | ||
/// present. We don't allow overwriting an existing extends, but one can be | ||
/// filled in if it wasn't present originally. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmenting type | ||
/// declares an extends clause, but one was already present. Test | ||
/// `extends Object` case | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import augment 'augmenting_types_A03_t03_lib.dart'; | ||
|
||
typedef ObjectAlias = Object; | ||
|
||
class C1 extends Object {} | ||
class C2 extends ObjectAlias {} | ||
|
||
main() { | ||
print(C1); | ||
print(C2); | ||
} |
38 changes: 38 additions & 0 deletions
38
LanguageFeatures/Augmentation-libraries/augmenting_types_A03_t03_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,38 @@ | ||
// 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: | ||
/// ... | ||
/// - The augmenting type declares an extends clause, but one was already | ||
/// present. We don't allow overwriting an existing extends, but one can be | ||
/// filled in if it wasn't present originally. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmenting type | ||
/// declares an extends clause, but one was already present. Test | ||
/// `extends Object` case | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
library augment 'augmenting_types_A03_t03.dart'; | ||
|
||
augment class C1 extends Object {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment class C1 extends ObjectAlias {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment class C2 extends Object {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment class C2 extends ObjectAlias {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified |