diff options
author | James Iry <jamesiry@gmail.com> | 2013-02-07 21:39:12 -0800 |
---|---|---|
committer | James Iry <jamesiry@gmail.com> | 2013-02-07 21:39:12 -0800 |
commit | 4c08eb604f6a23077fd1c65d0bb073ea94389961 (patch) | |
tree | 1168b9588c803586d459059b91bdc7d87130ec35 /src/compiler | |
parent | 6bcb830c080c846a7ad4bf5e1949f6b2d02d45fe (diff) | |
parent | 55c9b9c280ac9bc36bbac09397c7646f8dcf4583 (diff) | |
download | scala-4c08eb604f6a23077fd1c65d0bb073ea94389961.tar.gz scala-4c08eb604f6a23077fd1c65d0bb073ea94389961.tar.bz2 scala-4c08eb604f6a23077fd1c65d0bb073ea94389961.zip |
Merge pull request #2088 from retronym/ticket/6146
SI-6146 More accurate prefixes for sealed subtypes.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/interpreter/IMain.scala | 4 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/IMain.scala b/src/compiler/scala/tools/nsc/interpreter/IMain.scala index a55f0af116..bed8570bd0 100644 --- a/src/compiler/scala/tools/nsc/interpreter/IMain.scala +++ b/src/compiler/scala/tools/nsc/interpreter/IMain.scala @@ -262,7 +262,9 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends protected def newCompiler(settings: Settings, reporter: Reporter): ReplGlobal = { settings.outputDirs setSingleOutput virtualDirectory settings.exposeEmptyPackage.value = true - new Global(settings, reporter) with ReplGlobal + new Global(settings, reporter) with ReplGlobal { + override def toString: String = "<global>" + } } /** Parent classloader. Overridable. */ diff --git a/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala b/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala index 452957745a..4a765ea22e 100644 --- a/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala +++ b/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala @@ -2818,7 +2818,9 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL // compare to the fully known type `tp` (modulo abstract types), // so that we can rule out stuff like: sealed trait X[T]; class XInt extends X[Int] --> XInt not valid when enumerating X[String] // however, must approximate abstract types in - val subTp = appliedType(pre.memberType(sym), sym.typeParams.map(_ => WildcardType)) + + val memberType = nestedMemberType(sym, pre, tpApprox.typeSymbol.owner) + val subTp = appliedType(memberType, sym.typeParams.map(_ => WildcardType)) val subTpApprox = typer.infer.approximateAbstracts(subTp) // TODO: needed? // patmatDebug("subtp"+(subTpApprox <:< tpApprox, subTpApprox, tpApprox)) if (subTpApprox <:< tpApprox) Some(checkableType(subTp)) |