diff --git a/compiler/src/dotty/tools/dotc/transform/Bridges.scala b/compiler/src/dotty/tools/dotc/transform/Bridges.scala index 6ed871e04d55..a762ecd20a77 100644 --- a/compiler/src/dotty/tools/dotc/transform/Bridges.scala +++ b/compiler/src/dotty/tools/dotc/transform/Bridges.scala @@ -56,7 +56,13 @@ class Bridges(root: ClassSymbol)(implicit ctx: Context) { bridgesScope.lookupAll(member.name).exists(bridge => bridgeTarget(bridge) == member && bridge.signature == other.signature) def info(sym: Symbol)(implicit ctx: Context) = sym.info - def desc(sym: Symbol)= i"$sym${info(sym)(preErasureCtx)} in ${sym.owner}" + def desc(sym: Symbol)= { + val infoStr = info(sym)(preErasureCtx) match { + case ExprType(info) => i": $info" + case info => info.show + } + i"$sym$infoStr in ${sym.owner}" + } if (member.signature == other.signature) { if (!member.info.matches(other.info)) ctx.error(em"""bridge generated for member ${desc(member)} diff --git a/tests/neg/i1169.scala b/tests/neg/i1169.scala new file mode 100644 index 000000000000..47290410eaca --- /dev/null +++ b/tests/neg/i1169.scala @@ -0,0 +1,9 @@ +class X(val underlying: Object) extends AnyVal + +trait Producer[T] { + def produce: T +} + +class XProducer extends Producer[X] { + def produce = new X(null) // error +}