Skip to content

Commit

Permalink
Unit test for recent bug fix in LUBs
Browse files Browse the repository at this point in the history
  • Loading branch information
retronym authored and adriaanm committed Aug 23, 2016
1 parent a91c81f commit c12dd76
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/junit/scala/reflect/internal/TypesTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,15 @@ class TypesTest {
// calling `apply` merges the prefix/args of the elements ot the RefinedType and rewraps in the existential
assertEquals("M[_1] forSome { type X; type _1 >: X with Int }", T.baseTypeSeq.apply(1).toString)
}

@Test
def testExistentialMerge(): Unit = {
val ts = typeOf[Set[Any]] :: typeOf[Set[X] forSome { type X <: Y; type Y <: Int}] :: Nil
def merge(ts: List[Type]) = mergePrefixAndArgs(ts, Variance.Contravariant, lubDepth(ts))
val merged1 = merge(ts)
val merged2 = merge(ts.reverse)
assert(ts.forall(_ <:< merged1)) // use to fail before fix to mergePrefixAndArgs for existentials
assert(ts.forall(_ <:< merged2))
assert(merged1 =:= merged2)
}
}

0 comments on commit c12dd76

Please sign in to comment.