Skip to content

Commit

Permalink
Merge pull request #13879 from dotty-staging/fix-13873
Browse files Browse the repository at this point in the history
Indicate name of classfile where leaky mapping of existential type happens
  • Loading branch information
odersky committed Nov 4, 2021
2 parents 83effc3 + 1903676 commit 483bf2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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
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 483bf2c

Please sign in to comment.