Skip to content

Commit 1903676

Browse files
committed
Indicate name of classfile where leaky mapping of existential type happens
Fixes #13873
1 parent 29f0374 commit 1903676

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
739739
val anyTypes = boundSyms map (_ => defn.AnyType)
740740
val boundBounds = boundSyms map (_.info.bounds.hi)
741741
val tp2 = tp1.subst(boundSyms, boundBounds).subst(boundSyms, anyTypes)
742-
report.warning(FailureToEliminateExistential(tp, tp1, tp2, boundSyms))
742+
report.warning(FailureToEliminateExistential(tp, tp1, tp2, boundSyms, classRoot.symbol))
743743
tp2
744744
}
745745
else tp1

compiler/src/dotty/tools/dotc/reporting/messages.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,13 +1765,13 @@ import transform.SymUtils._
17651765
def explain = ""
17661766
}
17671767

1768-
class FailureToEliminateExistential(tp: Type, tp1: Type, tp2: Type, boundSyms: List[Symbol])(using Context)
1768+
class FailureToEliminateExistential(tp: Type, tp1: Type, tp2: Type, boundSyms: List[Symbol], classRoot: Symbol)(using Context)
17691769
extends Message(FailureToEliminateExistentialID) {
17701770
def kind: String = "Compatibility"
17711771
def msg =
17721772
val originalType = ctx.printer.dclsText(boundSyms, "; ").show
1773-
em"""An existential type that came from a Scala-2 classfile cannot be
1774-
|mapped accurately to to a Scala-3 equivalent.
1773+
em"""An existential type that came from a Scala-2 classfile for $classRoot
1774+
|cannot be mapped accurately to a Scala-3 equivalent.
17751775
|original type : $tp forSome ${originalType}
17761776
|reduces to : $tp1
17771777
|type used instead: $tp2

0 commit comments

Comments
 (0)