Skip to content

Error message for lazy var and inline var is wrong: says erased instead of lazy or inline #11872

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
bjornregnell opened this issue Mar 24, 2021 · 4 comments

Comments

@bjornregnell
Copy link
Contributor

Compiler version

3.0.0-RC2-bin-20210323-d4f1c26-NIGHTLY

Minimized code and Output

scala> lazy var x = 42
1 |lazy var x = 42
  |         ^
  |         Modifier `erased` is not allowed for this definition

Expectation

Error message falsely says that the lazy modifier is erased, instead it should be:

scala> lazy var x = 42
1 |lazy var x = 42
  |         ^
  |         Modifier `lazy` is not allowed for this definition
@bjornregnell
Copy link
Contributor Author

bjornregnell commented Mar 24, 2021

Same for inline:

scala> inline var x = 42                                                                                           
1 |inline var x = 42
  |           ^
  |           Modifier `erased` is not allowed for this definition

@bjornregnell bjornregnell changed the title Error message for ´lazy var´ is wrong: says erased instead of lazy Error message for ´lazy var´ and inline var is wrong: says erased instead of lazy or inline Mar 24, 2021
@bjornregnell bjornregnell changed the title Error message for ´lazy var´ and inline var is wrong: says erased instead of lazy or inline Error message for lazy var and inline var is wrong: says erased instead of lazy or inline Mar 24, 2021
@bjornregnell
Copy link
Contributor Author

bjornregnell commented Mar 24, 2021

@bjornregnell
Copy link
Contributor Author

bjornregnell commented Mar 24, 2021

Seems to be hardcoded to Erased here:
https://github.com/lampepfl/dotty/blob/46eb23e273be183a34b0d7873b3ce16f7bd919b7/compiler/src/dotty/tools/dotc/typer/Checking.scala#L436-L438
Should the argument not be flag instead of Erased?

bjornregnell added a commit to bjornregnell/dotty that referenced this issue Mar 24, 2021
@bjornregnell
Copy link
Contributor Author

PR now here #11878

odersky added a commit that referenced this issue Mar 25, 2021
Fix #11872, correct error msg when modifier flag is not allowed
michelou pushed a commit to michelou/scala3 that referenced this issue Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant