Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[analyzer] No error if a local variable named augmented is declared inside of augmenting function #55634

Open
sgrekhov opened this issue May 3, 2024 · 0 comments
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-macros Implementation of the macros feature P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug

Comments

@sgrekhov
Copy link
Contributor

sgrekhov commented May 3, 2024

The following co19 tests fail because of this issue

co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t12
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t13
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t14
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t15
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t16
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t17
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t11
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t12
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t13
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t14
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t15
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t16
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t15
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t16
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t17
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t18
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t19
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t20
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t04
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t05
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t06
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t07
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t08
co19/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t09

This happens when augmented variable is declared by the pattern. According to the spec inside of augmenting function augmented became a keyword referencing the original function. So, declare a variable named augmented is a compile-time error

Example

augment String get topLevelGetter {
  var (augmented) = (42);
//     ^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
  return "Augmented";
}
@sgrekhov sgrekhov added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-macros Implementation of the macros feature labels May 3, 2024
@srawlins srawlins added type-enhancement A request for a change that isn't a bug P3 A lower priority bug or feature request labels May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-macros Implementation of the macros feature P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug
Projects
Development

No branches or pull requests

2 participants