Skip to content

Commit

Permalink
Indicate name of classfile where leaky mapping of existential type ha…
Browse files Browse the repository at this point in the history
…ppens

Fixes scala#13873
  • Loading branch information
odersky authored and olsdavis committed Apr 4, 2022
1 parent 478622d commit a3e768d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
val anyTypes = boundSyms map (_ => defn.AnyType)
val boundBounds = boundSyms map (_.info.bounds.hi)
val tp2 = tp1.subst(boundSyms, boundBounds).subst(boundSyms, anyTypes)
report.warning(FailureToEliminateExistential(tp, tp1, tp2, boundSyms))
report.warning(FailureToEliminateExistential(tp, tp1, tp2, boundSyms, classRoot.symbol))
tp2
}
else tp1
Expand Down
6 changes: 3 additions & 3 deletions compiler/src/dotty/tools/dotc/reporting/messages.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1772,13 +1772,13 @@ import transform.SymUtils._
def explain = ""
}

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

0 comments on commit a3e768d

Please sign in to comment.