Skip to content

[analyzer/inline-classes] Missing warning. #52674

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

Closed
modulovalue opened this issue Jun 11, 2023 · 5 comments
Closed

[analyzer/inline-classes] Missing warning. #52674

modulovalue opened this issue Jun 11, 2023 · 5 comments
Labels
area-meta Cross-cutting, high-level issues (for tracking many other implementation issues, ...).

Comments

@modulovalue
Copy link
Contributor

modulovalue commented Jun 11, 2023

As expected, the following code does not compile successfully, but the analyzer does not report any errors:

void main() {
  print(BadInt(0).j);
}

inline class BadInt {
  int i;
  
  BadInt(this.i);
  
  int j = 0;
}
Error compiling to JavaScript:
lib/main.dart:2:19:
Error: The getter 'j' isn't defined for the class 'BadInt'.
  print(BadInt(0).j);
                  ^
Error: Compilation failed.

Reproducible on DartPad

master channel
Use Flutter version 3.12.0-2.0.pre and Dart version 3.1.0-169.0.dev
+ Dart experiments: --enable-experiment=inline-class

[Edit, eernstg: Add subtask list]

@eernstg eernstg added legacy-area-analyzer Use area-devexp instead. legacy-area-front-end Legacy: Use area-dart-model instead. labels Jun 11, 2023
@eernstg
Copy link
Member

eernstg commented Jun 11, 2023

We should get a compile-time error for i and for j because they are not final, and we should get a compile-time error because there is more than one instance variable in an inline class.

The analyzer does not report any errors, and the common front end reports one error which isn't any of the expected ones.

@scheglov, @johnniwinther, is this covered by existing issues or ongoing work? Is there a need to create two issues, one for the analyzer and one for the CFE?

@eernstg eernstg added front-end-missing-error dart-model-analyzer-spec Issues with the analyzer's implementation of the language spec labels Jun 11, 2023
@scheglov
Copy link
Contributor

I don't work on inline classes.
@bwilkerson, @srawlins for planning.

@johnniwinther
Copy link
Member

The work is not shared so it's probably best to have two issues.

@eernstg eernstg added area-meta Cross-cutting, high-level issues (for tracking many other implementation issues, ...). and removed legacy-area-analyzer Use area-devexp instead. legacy-area-front-end Legacy: Use area-dart-model instead. front-end-missing-error dart-model-analyzer-spec Issues with the analyzer's implementation of the language spec labels Jun 12, 2023
@eernstg
Copy link
Member

eernstg commented Jun 12, 2023

Thanks, @scheglov and @johnniwinther, I created #52675 and #52676 to cover the analyzer and the CFE, respectively.

@bwilkerson, @srawlins: Planning should then occur in #52675.

@modulovalue
Copy link
Contributor Author

The inline class experiment has been replaced with extension types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-meta Cross-cutting, high-level issues (for tracking many other implementation issues, ...).
Projects
None yet
Development

No branches or pull requests

4 participants