Skip to content

"given inline" error message is misleading #12348

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
adamw opened this issue May 6, 2021 · 1 comment · Fixed by #12354
Closed

"given inline" error message is misleading #12348

adamw opened this issue May 6, 2021 · 1 comment · Fixed by #12354

Comments

@adamw
Copy link
Contributor

adamw commented May 6, 2021

Compiler version

3.0.0-RC3

Minimized example

object A {
  given inline x: Int = 0
}

Output

[error] -- Error: Test.scala:19:15 
[error] 19 |  given inline x: Int = 0
[error]    |               ^
[error]    |               anonymous given cannot be abstract
[error] -- [E067] Syntax Error: Test.scala:19:8 
[error] 19 |  given inline x: Int = 0
[error]    |        ^
[error]    |Declaration of given instance given_inline not allowed here: only classes can have declared but undefined members
[error] two errors found
[error] two errors found

Expectation

The correct order of given & inline is: inline given. I'd expect the compiler to give a better error message, indicating how to fix the problem.

@nicolasstucki
Copy link
Contributor

A similar issue happens with

given y x: Int = 0

@odersky odersky self-assigned this May 6, 2021
odersky added a commit to dotty-staging/dotty that referenced this issue May 6, 2021
@Kordyjan Kordyjan added this to the 3.0.1 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants