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. Make augmented expression tests stronger
- Loading branch information
Showing
25 changed files
with
531 additions
and
29 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
52 changes: 52 additions & 0 deletions
52
LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t10.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 The exact result of an `augmented` expression depends on what is | ||
/// being augmented, but it generally follows the same rules as any normal | ||
/// identifier: | ||
/// - Augmenting getters: Within an augmenting getter `augmented` invokes the | ||
/// getter and evaluates to the return value. If augmenting a field with a | ||
/// getter, this will invoke the implicit getter from the augmented field. | ||
/// | ||
/// @description Checks that it is a compile-time error to declare a local | ||
/// variable named `augmented` within an augmenting getter | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import augment 'augmented_expression_A01_t10_lib.dart'; | ||
|
||
class C { | ||
static String get staticGetter => "Original"; | ||
String get instanceGetter => "Original"; | ||
} | ||
|
||
mixin M { | ||
static String get staticGetter => "Original"; | ||
String get instanceGetter => "Original"; | ||
} | ||
|
||
enum E { | ||
e1; | ||
|
||
static String get staticGetter => "Original"; | ||
String get instanceGetter => "Original"; | ||
} | ||
|
||
class A {} | ||
|
||
extension Ext on A { | ||
static String get staticGetter => "Original"; | ||
String get instanceGetter => "Original"; | ||
} | ||
|
||
class MA = Object with M; | ||
|
||
main() { | ||
print(topLevelGetter); | ||
print(C); | ||
print(M); | ||
print(E); | ||
print(A); | ||
} |
Oops, something went wrong.