diff options
Diffstat (limited to 'compiler/src')
3 files changed, 11 insertions, 22 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala index bc140c26b..e0b233ce8 100644 --- a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala +++ b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala @@ -661,7 +661,7 @@ class ClassfileParser( for (entry <- innerClasses.values) { // create a new class member for immediate inner classes if (entry.outerName == currentClassName) { - val file = ctx.platform.classPath.findSourceFile(entry.externalName.toString) getOrElse { + val file = ctx.platform.classPath.findBinaryFile(entry.externalName.toString) getOrElse { throw new AssertionError(entry.externalName) } enterClassAndModule(entry, file, entry.jflags) diff --git a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala b/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala index 7576ccc05..b0ae36612 100644 --- a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala +++ b/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala @@ -848,13 +848,14 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer { val nextBinder = afterTest.asTerm - def needsOuterTest(patType: Type, selType: Type, currentOwner: Symbol): Boolean = { + def outerTestNeeded(implicit ctx: Context): Boolean = { // See the test for SI-7214 for motivation for dealias. Later `treeCondStrategy#outerTest` // generates an outer test based on `patType.prefix` with automatically dealises. - patType.dealias match { - case tref @ TypeRef(pre, name) => - (pre ne NoPrefix) && tref.symbol.isClass && - ExplicitOuter.needsOuterIfReferenced(tref.symbol.asClass) + expectedTp.dealias match { + case tref @ TypeRef(pre: SingletonType, name) => + val s = tref + s.symbol.isClass && + ExplicitOuter.needsOuterIfReferenced(s.symbol.asClass) case _ => false } @@ -862,12 +863,6 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer { override lazy val introducedRebindings = NoRebindings - def outerTestNeeded = { - val np = expectedTp.normalizedPrefix - val ts = np.termSymbol - (ts ne NoSymbol) && needsOuterTest(expectedTp, testedBinder.info, ctx.owner) - } - // the logic to generate the run-time test that follows from the fact that // a `prevBinder` is expected to have type `expectedTp` // the actual tree-generation logic is factored out, since the analyses generate Cond(ition)s rather than Trees diff --git a/compiler/src/dotty/tools/io/ClassPath.scala b/compiler/src/dotty/tools/io/ClassPath.scala index 3afbed838..5e77c1b61 100644 --- a/compiler/src/dotty/tools/io/ClassPath.scala +++ b/compiler/src/dotty/tools/io/ClassPath.scala @@ -240,22 +240,16 @@ abstract class ClassPath { def findClass(name: String): Option[AnyClassRep] = name.splitWhere(_ == '.', doDropIndex = true) match { case Some((pkg, rest)) => - val rep = packages find (_.name == pkg) flatMap (_ findClass rest) - rep map { - case x: ClassRep => x - case x => throw new FatalError("Unexpected ClassRep '%s' found searching for name '%s'".format(x, name)) - } + packages find (_.name == pkg) flatMap (_ findClass rest) case _ => classes find (_.name == name) } - def findSourceFile(name: String): Option[AbstractFile] = - findClass(name) match { - case Some(ClassRep(Some(x: AbstractFile), _)) => Some(x) - case _ => None - } + def findBinaryFile(name: String): Option[AbstractFile] = + findClass(name).flatMap(_.binary) def sortString = join(split(asClasspathString).sorted: _*) + override def equals(that: Any) = that match { case x: ClassPath => this.sortString == x.sortString case _ => false |