diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2016-02-10 14:40:36 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2016-02-10 14:40:36 +1000 |
commit | cbd2d21e9ad72df6cb5a2370ee49fcfdbffd292e (patch) | |
tree | 48b896d9344775c7b959fde4bb5acb71164a9dbb /test/junit | |
parent | b0beb720e70cc8700a593766ad6c384e8826bf52 (diff) | |
parent | 6f8c05722ba4452279e353df2d81b58f260277d2 (diff) | |
download | scala-cbd2d21e9ad72df6cb5a2370ee49fcfdbffd292e.tar.gz scala-cbd2d21e9ad72df6cb5a2370ee49fcfdbffd292e.tar.bz2 scala-cbd2d21e9ad72df6cb5a2370ee49fcfdbffd292e.zip |
Merge pull request #4868 from retronym/ticket/9542-combo
SI-9542 Fix regression in value classes (served two ways)
Diffstat (limited to 'test/junit')
-rw-r--r-- | test/junit/scala/reflect/internal/TypesTest.scala | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/test/junit/scala/reflect/internal/TypesTest.scala b/test/junit/scala/reflect/internal/TypesTest.scala index 95194ef0a4..05a77cfb47 100644 --- a/test/junit/scala/reflect/internal/TypesTest.scala +++ b/test/junit/scala/reflect/internal/TypesTest.scala @@ -1,9 +1,10 @@ package scala.reflect.internal import org.junit.Assert._ -import org.junit.Test +import org.junit.{Assert, Test} import org.junit.runner.RunWith import org.junit.runners.JUnit4 +import scala.collection.mutable import scala.tools.nsc.symtab.SymbolTableForUnitTesting @RunWith(classOf[JUnit4]) @@ -32,4 +33,29 @@ class TypesTest { val uniquelyNarrowed2 = refinedType(boolWithString1narrow2 :: Nil, NoSymbol) assert(uniquelyNarrowed1 =:= uniquelyNarrowed2) } + + @Test + def testTransitivityWithModuleTypeRef(): Unit = { + import rootMirror.EmptyPackageClass + val (module, moduleClass) = EmptyPackageClass.newModuleAndClassSymbol(TermName("O"), NoPosition, 0L) + val minfo = ClassInfoType(List(ObjectTpe), newScope, moduleClass) + module.moduleClass setInfo minfo + module setInfo module.moduleClass.tpe + val tp1 = TypeRef(ThisType(EmptyPackageClass), moduleClass, Nil) + val tp2 = SingleType(ThisType(EmptyPackageClass), module) + val tp3 = ThisType(moduleClass) + val tps = List(tp1, tp2, tp3) + val results = mutable.Buffer[String]() + tps.permutations.foreach { + case ts @ List(a, b, c) => + def tsShownRaw = ts.map(t => showRaw(t)).mkString(", ") + if (a <:< b && b <:< c && !(a <:< c)) results += s"<:< intransitive: $tsShownRaw" + if (a =:= b && b =:= c && !(a =:= c)) results += s"=:= intransitive: $tsShownRaw" + } + results.toList match { + case Nil => // okay + case xs => + Assert.fail(xs.mkString("\n")) + } + } } |