diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala | 3 | ||||
-rw-r--r-- | test/files/neg/t6895b.check | 4 | ||||
-rw-r--r-- | test/files/neg/t8777.check | 6 | ||||
-rw-r--r-- | test/files/neg/t8777.scala | 4 |
4 files changed, 14 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala index 059981aa37..65dea3178b 100644 --- a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala +++ b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala @@ -309,6 +309,7 @@ trait TypeDiagnostics { // save the name because it will be mutated until it has been // distinguished from the other types in the same error message private val savedName = sym.name + private var postQualifiedWith: List[Symbol] = Nil def restoreName() = sym.name = savedName def modifyName(f: String => String) = sym setName newTypeName(f(sym.name.toString)) @@ -322,7 +323,7 @@ trait TypeDiagnostics { // functions to manipulate the name def preQualify() = modifyName(trueOwner.fullName + "." + _) - def postQualify() = modifyName(_ + "(in " + trueOwner + ")") + def postQualify() = if (!(postQualifiedWith contains trueOwner)) { postQualifiedWith ::= trueOwner; modifyName(_ + "(in " + trueOwner + ")") } def typeQualify() = if (sym.isTypeParameterOrSkolem) postQualify() def nameQualify() = if (trueOwner.isPackageClass) preQualify() else postQualify() diff --git a/test/files/neg/t6895b.check b/test/files/neg/t6895b.check index 3ebdb69309..565925127b 100644 --- a/test/files/neg/t6895b.check +++ b/test/files/neg/t6895b.check @@ -2,8 +2,8 @@ t6895b.scala:20: error: could not find implicit value for parameter e: Foo[[X]Ba implicitly[Foo[({type L[X] = Bar[StringOr, X]})#L]] ^ t6895b.scala:23: error: polymorphic expression cannot be instantiated to expected type; - found : [F[_]]Foo[[X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]Bar[F,X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]] - required: Foo[[X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]Bar[[X]Or[String,X],X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]] + found : [F[_]]Foo[[X(in type L)]Bar[F,X(in type L)]] + required: Foo[[X(in type L)]Bar[[X]Or[String,X],X(in type L)]] barFoo(null) : Foo[({type L[X] = Bar[StringOr, X]})#L] ^ two errors found diff --git a/test/files/neg/t8777.check b/test/files/neg/t8777.check new file mode 100644 index 0000000000..cd05f1ec11 --- /dev/null +++ b/test/files/neg/t8777.check @@ -0,0 +1,6 @@ +t8777.scala:3: error: type mismatch; + found : Foo.this.TreePrinter(in trait Printers) + required: Foo.this.TreePrinter(in trait Printers) + super.newCodePrinter(out, tree, printRootPkg) + ^ +one error found diff --git a/test/files/neg/t8777.scala b/test/files/neg/t8777.scala new file mode 100644 index 0000000000..5b7d123202 --- /dev/null +++ b/test/files/neg/t8777.scala @@ -0,0 +1,4 @@ +trait Foo extends scala.tools.nsc.Global { + override def newCodePrinter(out: java.io.PrintWriter, tree: Tree, printRootPkg: Boolean): TreePrinter = + super.newCodePrinter(out, tree, printRootPkg) +} |