Skip to content

Confusing import error message #16653

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
kubukoz opened this issue Jan 10, 2023 · 0 comments · Fixed by #16658
Closed

Confusing import error message #16653

kubukoz opened this issue Jan 10, 2023 · 0 comments · Fixed by #16658
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug
Milestone

Comments

@kubukoz
Copy link
Contributor

kubukoz commented Jan 10, 2023

Compiler version

3.2.1

Minimized code

//> using scala "3.2.1"
import demo.implicits._
import demo._
object Demo {}

Output

[error] ./main.scala:2:8: Not found: demo
[error] import demo.implicists._
[error]        ^^^^
[error] ./main.scala:3:8: import prefix is not a pure expression
[error] import demo._
[error]        ^^^^

Expectation

[error] ./main.scala:2:8: Not found: demo
[error] import demo.implicits._
[error]        ^^^^
[error] ./main.scala:3:8: Not found: demo
[error] import demo._
[error]        ^^^^

The "import prefix is not a pure expression" message is confusing here, I believe both messages should just say "demo" is not found.

Additionally, if the second import is correct but the first isn't:

//> using scala "3.2.1"
import demo.implicits._
import Predef._
object Demo {}

The output also shows this:

[error] ./main.scala:2:8: Not found: demo
[error] import demo.implicists._
[error]        ^^^^
[error] ./main.scala:3:8: import prefix is not a pure expression
[error] import Predef._
[error]        ^^^^^^
@kubukoz kubukoz added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 10, 2023
@soronpo soronpo added area:reporting Error reporting including formatting, implicit suggestions, etc and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 11, 2023
odersky added a commit to dotty-staging/dotty that referenced this issue Jan 11, 2023
little-inferno pushed a commit to little-inferno/dotty that referenced this issue Jan 25, 2023
@Kordyjan Kordyjan added this to the 3.3.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants