summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Sabin <miles@milessabin.com>2016-04-19 11:35:40 +0100
committerMiles Sabin <miles@milessabin.com>2016-08-15 09:37:57 +0100
commite5b51d8fec29048f94445c9b2b258b24245bb920 (patch)
treee9ceec3da47060658846aa9adc5caa643eb537fb
parent81a67eeacc7d2622ee364a21203b227142e2043e (diff)
downloadscala-e5b51d8fec29048f94445c9b2b258b24245bb920.tar.gz
scala-e5b51d8fec29048f94445c9b2b258b24245bb920.tar.bz2
scala-e5b51d8fec29048f94445c9b2b258b24245bb920.zip
SI-9760 Fix for higher-kinded GADT refinement
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala1
-rw-r--r--test/files/pos/hkgadt.scala18
2 files changed, 18 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index 9f7bdf7aff..c188c326c3 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -1254,7 +1254,6 @@ trait Infer extends Checkable {
def isFreeTypeParamOfTerm(sym: Symbol) = (
sym.isAbstractType
&& sym.owner.isTerm
- && !sym.info.bounds.exists(_.typeParams.nonEmpty)
)
// Intentionally *not* using `Type#typeSymbol` here, which would normalize `tp`
diff --git a/test/files/pos/hkgadt.scala b/test/files/pos/hkgadt.scala
new file mode 100644
index 0000000000..efd7d3df21
--- /dev/null
+++ b/test/files/pos/hkgadt.scala
@@ -0,0 +1,18 @@
+package test
+
+object HKGADT {
+ sealed trait Foo[F[_]]
+ final case class Bar() extends Foo[List]
+
+ def frob[F[_]](foo: Foo[F]): F[Int] =
+ foo match {
+ case Bar() =>
+ List(1)
+ }
+
+ sealed trait Foo1[F]
+ final case class Bar1() extends Foo1[Int]
+ def frob1[A](foo: Foo1[A]) = foo match {
+ case Bar1() => 1
+ }
+}