Skip to content

[CFE] Inline Class const constructors requires const-functions experiment #52247

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

Open
ds84182 opened this issue May 3, 2023 · 1 comment
Open
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.

Comments

@ds84182
Copy link
Contributor

ds84182 commented May 3, 2023

Repro:

inline class Vec2D {
  final (double, double) xy;
  const Vec2D(double x, double y) : xy = (x, y);

  static const zero = Vec2D(0.0, 0.0);
}

Passes in analyzer, errors in CFE as it is transformed into a static method & static invocations are not allowed in const fns. Ideally it should ignore this for members declared isConst as they can't be declared const in user code without the experiment enabled.

The error can't be circumvented in either Analyzer or CFE via (0.0, 0.0) as Vec2D.

@mraleph mraleph added legacy-area-analyzer Use area-devexp instead. legacy-area-front-end Legacy: Use area-dart-model instead. labels May 3, 2023
@bwilkerson
Copy link
Member

The analyzer does not yet support inline classes and there is no target data for when support will be added. I'm going to remove the analyzer tag in favor of the general tracking issue at #49732.

@bwilkerson bwilkerson removed the legacy-area-analyzer Use area-devexp instead. label May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.
Projects
None yet
Development

No branches or pull requests

3 participants