Under -Xsource:2.13, warn about changed precedence in imports #10095
Under -Xsource:2.13, warn about changed precedence in imports #10095lrytz merged 1 commit intoscala:2.12.xfrom
-Xsource:2.13, warn about changed precedence in imports #10095Conversation
|
maybe this should be enabled by |
|
I was thinking which flag to re-use; Probably |
| def typedPackageDef(pdef0: PackageDef) = { | ||
| val pdef = treeCopy.PackageDef(pdef0, pdef0.pid, pluginsEnterStats(this, pdef0.stats)) | ||
| val pid1 = typedQualifier(pdef.pid).asInstanceOf[RefTree] | ||
| val pid1 = context.withMode(ContextMode.InPackageClauseName)(typedQualifier(pdef.pid).asInstanceOf[RefTree]) |
There was a problem hiding this comment.
I will forward this to 2.13 (#10111) and use it to fix lookup when type-checking a package clause.
In 2.13:
package a.x
class C { def inA = 0 }
package b
import a._
package x {
class C { def inB = 0 }
}
the PackageDef.pid for b.x will refer to the package symbol a.x because of the fixed lookup rules.
I couldn't spot any uses of PackageDef.pid in the compiler, so it's probably benign.
a452aab to
38333bd
Compare
38333bd to
4ee4a02
Compare
|
This can lead to additional import cycle errors under Here's an example (3 separate files) that compiles with 2.12, but not with package p
trait Apackage p
import p.C._
object B extends Apackage p
import p.B._
object C extends A |
|
Very useful! |
-Xsource:2.13)
-Xsource:2.13)-Xsource:2.13, warn about changed precedence in imports
|
Thanks, I never thought to do that. |
### What changes were proposed in this pull request? This PR aims to upgrade Scala to 2.12.17 - https://www.scala-lang.org/news/2.12.17 ### Why are the changes needed? The main [change](https://github.com/scala/scala/pulls?q=is%3Apr+sort%3Aupdated-desc+milestone%3A2.12.17+is%3Amerged+label%3Arelease-notes) fo this version as follows: - scala/scala#10109 - scala/scala#10075 - scala/scala#10108 - scala/scala#10045 - scala/scala#10063 - scala/scala#10042 - scala/scala#10040 - scala/scala#10095 ### Does this PR introduce _any_ user-facing change? Yes, this is a Scala version change. ### How was this patch tested? Existing Test Closes #37892 from LuciferYang/SPARK-40436. Authored-by: yangjie01 <yangjie01@baidu.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
### What changes were proposed in this pull request? This PR aims to upgrade Scala to 2.12.17 - https://www.scala-lang.org/news/2.12.17 ### Why are the changes needed? The main [change](https://github.com/scala/scala/pulls?q=is%3Apr+sort%3Aupdated-desc+milestone%3A2.12.17+is%3Amerged+label%3Arelease-notes) fo this version as follows: - scala/scala#10109 - scala/scala#10075 - scala/scala#10108 - scala/scala#10045 - scala/scala#10063 - scala/scala#10042 - scala/scala#10040 - scala/scala#10095 ### Does this PR introduce _any_ user-facing change? Yes, this is a Scala version change. ### How was this patch tested? Existing Test Closes apache#37892 from LuciferYang/SPARK-40436. Authored-by: yangjie01 <yangjie01@baidu.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
No description provided.