aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/core/Types.scala6
-rw-r--r--src/dotty/tools/dotc/transform/PatternMatcher.scala3
-rw-r--r--tests/pos/i1269.scala16
3 files changed, 18 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 054c67e7e..3e04e9c77 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -2995,10 +2995,6 @@ object Types {
/** The class type with all type parameters */
def fullyAppliedRef(implicit ctx: Context): Type = fullyAppliedRef(cls.typeRef, cls.typeParams)
- def rebase(tp: Type)(implicit ctx: Context): Type =
- if ((prefix eq cls.owner.thisType) || !cls.owner.isClass || ctx.erasedTypes) tp
- else tp.substThis(cls.owner.asClass, prefix)
-
private var typeRefCache: TypeRef = null
def typeRef(implicit ctx: Context): TypeRef = {
@@ -3018,7 +3014,7 @@ object Types {
/** The parent type refs as seen from the given prefix */
override def parents(implicit ctx: Context): List[TypeRef] = {
if (parentsCache == null)
- parentsCache = cls.classParents.mapConserve(rebase(_).asInstanceOf[TypeRef])
+ parentsCache = cls.classParents.mapConserve(_.asSeenFrom(prefix, cls.owner).asInstanceOf[TypeRef])
parentsCache
}
diff --git a/src/dotty/tools/dotc/transform/PatternMatcher.scala b/src/dotty/tools/dotc/transform/PatternMatcher.scala
index 974053769..92d638be9 100644
--- a/src/dotty/tools/dotc/transform/PatternMatcher.scala
+++ b/src/dotty/tools/dotc/transform/PatternMatcher.scala
@@ -763,9 +763,8 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
def outerTest(testedBinder: Symbol, expectedTp: Type): Tree = {
val expectedOuter = expectedTp.normalizedPrefix match {
- //case ThisType(clazz) => This(clazz)
//case NoType => Literal(Constant(true)) // fallback for SI-6183 todo?
- case pre => ref(pre.termSymbol)
+ case pre: SingletonType => singleton(pre)
}
// ExplicitOuter replaces `Select(q, outerSym) OBJ_EQ expectedPrefix` by `Select(q, outerAccessor(outerSym.owner)) OBJ_EQ expectedPrefix`
diff --git a/tests/pos/i1269.scala b/tests/pos/i1269.scala
new file mode 100644
index 000000000..c0b56e1ea
--- /dev/null
+++ b/tests/pos/i1269.scala
@@ -0,0 +1,16 @@
+trait Module {
+ sealed abstract class Tree
+
+ case class LetL() extends Tree
+
+ object O {
+ case class LetR() extends Tree
+ }
+}
+
+class Patmat(val module: Module) {
+ def patmat(tree: module.Tree) = tree match {
+ case module.LetL() =>
+ case module.O.LetR() =>
+ }
+}