Skip to content

Unable to import a package in the REPL version 3.2.0 #16269

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
gmixa opened this issue Nov 1, 2022 · 6 comments
Closed

Unable to import a package in the REPL version 3.2.0 #16269

gmixa opened this issue Nov 1, 2022 · 6 comments
Labels
area:repl regression This worked in a previous version but doesn't anymore

Comments

@gmixa
Copy link

gmixa commented Nov 1, 2022

Compiler version

Scala version 3.2.0

Minimized example

See the example at https://github.com/gmixa/ImportTest

Including class graph via build.sbt . (see minimized example) ends up with the given output
when you do

   :load src/untitled.sc

you get the output below.
Scala Versions 3.1.0 and 3.0.0. give no message. Scala 2.13.10 and Scala 2.12.17 print out a success message.
Due to no replay in Scala 3.1.0 and 3.0.0 I am unsure if the import is accepted or not.

Output

1 |import io.github.classgraph._
  |       ^^^^^^^^^
  |       value github is not a member of io
1 error found

Expectation

Import should just pass with a success message!

@gmixa gmixa added the stat:needs triage Every issue needs to have an "area" and "itype" label label Nov 1, 2022
@mbovel mbovel added area:repl and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Nov 7, 2022
@mbovel
Copy link
Member

mbovel commented Nov 7, 2022

Thanks for reporting and for your great example.

I could reproduce using sbt console. However, when launching directly scala, the :load fails both with 2.13 and 3.2.

So I am wondering; is this an SBT issue or is it related to Dotty?

@gmixa
Copy link
Author

gmixa commented Nov 7, 2022

I have no idea if it is sbt specific or scala 3.2 specific. Due to the error message I suspected it has something to do with the compiler. There is scala.io which is imported automatically. I guess the error shows up because import resolution looks for the element "github" within the scala.io. package. That way the error message "value github is not a member of io"
would make the most sense to me. Obviously that's true it is not in scala.io even so it is wrong to look for it there. I am no sbt internals export and I suspected that import resolution does belong to the compiler and not to a specific build tool.
So I would suspect that importing io.xyz from another jar would end up with a similar error but I have not tried that!

@gmixa
Copy link
Author

gmixa commented Nov 7, 2022

just updated my example. I added a package io.xyz.test
and now I try to import io.xyz.test._
That fails too.
So it hast to do something with importing from io....

@dwijnand dwijnand added the regression This worked in a previous version but doesn't anymore label Nov 8, 2022
@SethTisue
Copy link
Member

@som-snytt I have this nagging feeling that some change you were involved with might be responsible for this...? some thing about precedence between the different places an identifier can come from? does this ring a bell for you? I'm not spotting anything relevant in the 3.2.0 release notes (but that's a big haystack of bullets to try to find a needle in)

@SethTisue
Copy link
Member

ah, I found it. duplicate of #15904

@SethTisue SethTisue closed this as not planned Won't fix, can't repro, duplicate, stale Nov 17, 2022
@som-snytt
Copy link
Contributor

I didn't even have to nag!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:repl regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

No branches or pull requests

5 participants