Skip to content

Commit

Permalink
Fix scala#8647: Remove TypeParamRef from instantiated test
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierBlanvillain committed Apr 9, 2020
1 parent a6b47e4 commit 2a7296e
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2359,7 +2359,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
x && {
t match {
case tp: TypeRef if tp.symbol.isAbstractOrParamType => false
case _: SkolemType | _: TypeVar | _: TypeParamRef => false
case _: SkolemType | _: TypeVar => false
case _ => foldOver(x, t)
}
}
Expand Down
53 changes: 53 additions & 0 deletions tests/pos/8647.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
final class Two[A, B]()

final class Blaaa

final class Bla[X]

object Test1 {

type Foo[X] = X match
case Two[Blaaa, _] =>
String
case Two[String, _] =>
Int

def test: Foo[Two[String, String]] = 1
}

object Test2 {
type Foo[X] = X match
case Two[Bla[_], _] =>
String
case Two[String, _] =>
Int

def test: Foo[Two[String, String]] = 1
}


object Test3 {
type Id[W] = W

type M[X, Y] = X match {
case Int => String
case Id[x] => Y match {
case Two[Bla[a], _] => Int
case _ => String
}
}
val x: M[Boolean, Two[Boolean, Boolean]] = ""
}

object Test4 {
type Id[W] = W

type M[X, Y] = X match {
case Int => String
case Id[x] => Y match {
case Two[Bla[`x`], _] => Int
case _ => String
}
}
val x: M[Boolean, Two[Bla[Boolean], Boolean]] = 1
}

0 comments on commit 2a7296e

Please sign in to comment.