-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Import outside a package clause is not shadowed by an import inside the package clause #21405
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
Comments
This issue was picked for the Scala Issue Spree of tomorrow, September 3rd. @dwijnand, @hamzaremmal and @nmcb will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here. |
(just a snapshot of our thinking/investigating so far:) Dale notes that it works as expected with /** Would import of kind `prec` be not shadowed by a nested higher-precedence definition? */
def isPossibleImport(prec: BindingPrec)(using Context) =
!noImports &&
(prevPrec.ordinal < prec.ordinal || prevPrec == prec && (prevCtx.scope eq ctx.scope)) gives a different answer in the two cases (because of the scope check), leading to the different overall answer. Perhaps the logic in this method just needs updating? We're not sure yet. |
I wondered if it was crucial that we have an |
some relevant spec links: https://scala-lang.org/files/archive/spec/3.4/09-top-level-definitions.html#compilation-units , https://scala-lang.org/files/archive/spec/3.4/09-top-level-definitions.html#packagings , https://scala-lang.org/files/archive/spec/3.4/04-basic-definitions.html#non-given-imports the bug can't be reproduced with just |
Compiler version
3.4.2
Minimized code
Output
Expectation
p.IO
shadowsjava.io.IO
as in Scala 2.This test requires JDK 23, but let me minimize properly, which also fails in the same way:
Note that
-Yimports:java.io,p
works correctly (without imports in source), as expected.The issue is urgent where
p
iscats.effect
.The text was updated successfully, but these errors were encountered: