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 members tests. Part 2 (dart-lang#2799)
Add augmenting members tests. Part 2
- Loading branch information
Showing
22 changed files
with
1,262 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
LanguageFeatures/Augmentation-libraries/augmenting_members_A02_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,52 @@ | ||
// 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 non-writable variable declaration is augmented with a setter. | ||
/// | ||
/// @description Checks that it is a compile-time error if an implicitly induced | ||
/// getter of a final variable declaration is augmented with a setter. | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import augment 'augmenting_members_A02_t01_lib.dart'; | ||
|
||
final String topLevelVariable = "topLevelVariable"; | ||
|
||
class C { | ||
static final String staticVariable = "staticVariable"; | ||
final String instanceVariable = "instanceVariable"; | ||
} | ||
|
||
mixin M { | ||
static final String staticVariable = "staticVariable"; | ||
final String instanceVariable = "instanceVariable"; | ||
} | ||
|
||
enum E { | ||
e0; | ||
static final String staticVariable = "staticVariable"; | ||
final String instanceVariable = "instanceVariable"; | ||
} | ||
|
||
class A {} | ||
|
||
extension Ext on A { | ||
static final String staticVariable = "staticVariable"; | ||
} | ||
|
||
extension type ET(String id) { | ||
static final String staticVariable = "staticVariable"; | ||
} | ||
|
||
main() { | ||
print(topLevelVariable); | ||
print(C); | ||
print(M); | ||
print(E); | ||
print(A); | ||
print(ET); | ||
} |
72 changes: 72 additions & 0 deletions
72
LanguageFeatures/Augmentation-libraries/augmenting_members_A02_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,72 @@ | ||
// 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 non-writable variable declaration is augmented with a setter. | ||
/// | ||
/// @description Checks that it is a compile-time error if an implicitly induced | ||
/// getter of a final variable declaration is augmented with a setter. | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
augment library 'augmenting_members_A02_t01.dart'; | ||
|
||
/**/augment void set topLevelVariable(String _) {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment class C { | ||
augment static void set staticVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
augment void set instanceVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
augment mixin M { | ||
augment static void set staticVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
augment void set instanceVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
augment enum E { | ||
augment e0; | ||
augment static void set staticVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
augment void set instanceVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
augment extension Ext { | ||
augment static void set staticVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
augment extension type ET { | ||
augment static void set staticVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
augment static void set id(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} |
52 changes: 52 additions & 0 deletions
52
LanguageFeatures/Augmentation-libraries/augmenting_members_A02_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,52 @@ | ||
// 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 non-writable variable declaration is augmented with a setter. | ||
/// | ||
/// @description Checks that it is a compile-time error if an implicitly induced | ||
/// getter of a `late final` variable declaration with an initializer is | ||
/// augmented with a setter. | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import augment 'augmenting_members_A02_t02_lib.dart'; | ||
|
||
late final String topLevelVariable = ""; | ||
|
||
class C { | ||
static late final String staticVariable = ""; | ||
late final String instanceVariable = ""; | ||
} | ||
|
||
mixin M { | ||
static late final String staticVariable = ""; | ||
late final String instanceVariable = ""; | ||
} | ||
|
||
enum E { | ||
e0; | ||
static late final String staticVariable = ""; | ||
} | ||
|
||
class A {} | ||
|
||
extension Ext on A { | ||
static late final String staticVariable = ""; | ||
} | ||
|
||
extension type ET(String _) { | ||
static late final String staticVariable = ""; | ||
} | ||
|
||
main() { | ||
print(topLevelVariable); | ||
print(C); | ||
print(M); | ||
print(E); | ||
print(A); | ||
print(ET); | ||
} |
65 changes: 65 additions & 0 deletions
65
LanguageFeatures/Augmentation-libraries/augmenting_members_A02_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,65 @@ | ||
// 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 non-writable variable declaration is augmented with a setter. | ||
/// | ||
/// @description Checks that it is a compile-time error if an implicitly induced | ||
/// getter of a `late final` variable declaration with an initializer is | ||
/// augmented with a setter. | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
augment library 'augmenting_members_A02_t02.dart'; | ||
|
||
/**/augment void set topLevelVariable(String _) {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment class C { | ||
augment static void set staticVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
augment void set instanceVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
augment mixin M { | ||
augment static void set staticVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
augment void set instanceVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
augment enum E { | ||
augment e0; | ||
augment static void set staticVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
augment extension Ext { | ||
augment static void set staticVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
augment extension type ET { | ||
augment static void set staticVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} |
49 changes: 49 additions & 0 deletions
49
LanguageFeatures/Augmentation-libraries/augmenting_members_A02_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,49 @@ | ||
// 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 non-writable variable declaration is augmented with a setter. | ||
/// | ||
/// @description Checks that it is a compile-time error if a `const` variable | ||
/// declaration is augmented with a setter. | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import augment 'augmenting_members_A02_t03_lib.dart'; | ||
|
||
const topLevelVariable = "topLevelVariable"; | ||
|
||
class C { | ||
static const staticVariable = "staticVariable"; | ||
} | ||
|
||
mixin M { | ||
static const staticVariable = "staticVariable"; | ||
} | ||
|
||
enum E { | ||
e0; | ||
static const staticVariable = "staticVariable"; | ||
} | ||
|
||
class A {} | ||
|
||
extension Ext on A { | ||
static const staticVariable = "staticVariable"; | ||
} | ||
|
||
extension type ET(String _) { | ||
static const staticVariable = "staticVariable"; | ||
} | ||
|
||
main() { | ||
print(topLevelVariable); | ||
print(C); | ||
print(M); | ||
print(E); | ||
print(A); | ||
print(ET); | ||
} |
56 changes: 56 additions & 0 deletions
56
LanguageFeatures/Augmentation-libraries/augmenting_members_A02_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,56 @@ | ||
// 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 non-writable variable declaration is augmented with a setter. | ||
/// | ||
/// @description Checks that it is a compile-time error if a `const` variable | ||
/// declaration is augmented with a setter. | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
augment library 'augmenting_members_A02_t03.dart'; | ||
|
||
/**/augment void set topLevelVariable(String _) {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment class C { | ||
augment static void set staticVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
augment mixin M { | ||
augment static void set staticVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
augment enum E { | ||
augment e0; | ||
augment static void set staticVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
augment extension Ext { | ||
augment static void set staticVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
augment extension type ET { | ||
augment static void set staticVariable(String _) {} | ||
//^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} |
Oops, something went wrong.