-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)infer
Milestone
Description
import scala.language.higherKinds
trait B
class C[CC[_] <: B] {
class K
}
object O {
def t1(x: Any): Int = x match {
case _: C[_]#K => 0
}
def t2(x: Any) = x.isInstanceOf[C[_]#K]
}t1 fails in type checking, only if CC is higher-kinded
A.scala:10: error: type arguments [_] do not conform to class C's type parameter bounds [CC[_] <: B]
case _: C[_]#K => 0
^
t2 fails in parsing
A.scala:12: error: unbound wildcard type
def t2(x: Any) = x.isInstanceOf[C[_]#K]
^
Both work in Scala 3.
Interestingly, t1 compiles with Scala 2.12.14/15, but fails in the same way as 2.13.6 when adding the semanticdb-scalac compiler plugin (🤷♂️).
$> sc12 -Xplugin:/Users/luc/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scalameta/semanticdb-scalac_2.12.15/4.4.28/semanticdb-scalac_2.12.15-4.4.28.jar A.scala
A.scala:10: error: type arguments [_] do not conform to class C's type parameter bounds [CC[_] <: B]
case _: C[_]#K => 0
^
jtnystrom
Metadata
Metadata
Assignees
Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)infer