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

Augmentation libraries: Augmented constructor initializers appear to be ignored. #55766

Open
rrousselGit opened this issue May 17, 2024 · 0 comments
Labels
area-fe-analyzer-shared Assigned by engineers; when triaging, prefer either area-front-end or area-analyzer. cfe-feature-augmentation Implement augmentation features in the CFE cfe-feature-macros Implement macros features in the CFE feature-augmentations Implementation of the augmentations feature

Comments

@rrousselGit
Copy link

Consider:

@Freezed()
class A {
  A(Map<String, Object?> map);
}

Where the generated code is:

augment class A {
  augment A(
    prefix0.Map<prefix0.String, prefix0.Object?> map, 
  ) : map = {'c': 42}; // Notice how we hard-coded the content

  final prefix0.Map<prefix0.String, prefix0.Object?> map;
}

In theory, print(A({'a': 0}).map should always print {'c': 42}. But somehow, this prints {'a': 0}.

This makes no sense, as the parameter is unused here, and the field initialization is hard-coded.

@lrhn lrhn added area-fe-analyzer-shared Assigned by engineers; when triaging, prefer either area-front-end or area-analyzer. feature-augmentations Implementation of the augmentations feature labels May 19, 2024
@johnniwinther johnniwinther added cfe-feature-macros Implement macros features in the CFE cfe-feature-augmentation Implement augmentation features in the CFE labels May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-fe-analyzer-shared Assigned by engineers; when triaging, prefer either area-front-end or area-analyzer. cfe-feature-augmentation Implement augmentation features in the CFE cfe-feature-macros Implement macros features in the CFE feature-augmentations Implementation of the augmentations feature
Projects
None yet
Development

No branches or pull requests

3 participants