-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scala 3 migration warning for implicits found in package prefix
The implicit scope in Scala 3 no longer includes the requested type's package prefix
- Loading branch information
Showing
6 changed files
with
118 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
t12919-3cross.scala:23: error: No implicit Ordering defined for a.A. | ||
def f(xs: List[a.A]) = xs.sorted // not found | ||
^ | ||
1 error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// scalac: -Xsource:3cross | ||
|
||
package object a { | ||
implicit val aOrd: Ordering[A] = null | ||
implicit val bOrd: Ordering[b.B] = null | ||
} | ||
|
||
package a { | ||
class A | ||
|
||
package aa { | ||
class U { | ||
def f(xs: List[a.A]) = xs.sorted // ok | ||
def g(xs: List[b.B]) = xs.sorted // ok | ||
} | ||
} | ||
} | ||
|
||
package b { | ||
class B | ||
|
||
class V { | ||
def f(xs: List[a.A]) = xs.sorted // not found | ||
} | ||
} | ||
|
||
package c { | ||
import a._ | ||
|
||
class W { | ||
def f(xs: List[a.A]) = xs.sorted // ok | ||
def g(xs: List[b.B]) = xs.sorted // ok | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
t12919.scala:23: error: Implicit value aOrd was found in a package prefix of the required type, which is not part of the implicit scope in Scala 3. | ||
For migration, add `import a.aOrd`. | ||
Scala 3 migration messages are errors under -Xsource:3. Use -Wconf / @nowarn to filter them or add -Xmigration to demote them to warnings. | ||
Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part of the message>, cat=scala3-migration, site=b.V.f | ||
def f(xs: List[a.A]) = xs.sorted // warn | ||
^ | ||
1 error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// scalac: -Xsource:3 -Werror | ||
|
||
package object a { | ||
implicit val aOrd: Ordering[A] = null | ||
implicit val bOrd: Ordering[b.B] = null | ||
} | ||
|
||
package a { | ||
class A | ||
|
||
package aa { | ||
class U { | ||
def f(xs: List[a.A]) = xs.sorted // ok | ||
def g(xs: List[b.B]) = xs.sorted // ok | ||
} | ||
} | ||
} | ||
|
||
package b { | ||
class B | ||
|
||
class V { | ||
def f(xs: List[a.A]) = xs.sorted // warn | ||
} | ||
} | ||
|
||
package c { | ||
import a._ | ||
|
||
class W { | ||
def f(xs: List[a.A]) = xs.sorted // ok | ||
def g(xs: List[b.B]) = xs.sorted // ok | ||
} | ||
} | ||
|