diff --git a/compiler/src/dotty/tools/dotc/inlines/Inliner.scala b/compiler/src/dotty/tools/dotc/inlines/Inliner.scala index 6116c00aeff7..a83c5eaa3ba8 100644 --- a/compiler/src/dotty/tools/dotc/inlines/Inliner.scala +++ b/compiler/src/dotty/tools/dotc/inlines/Inliner.scala @@ -567,9 +567,8 @@ class Inliner(val call: tpd.Tree)(using Context): case t: TypeRef => paramProxy.getOrElse(t, mapOver(t)) case t: TermRef if t.symbol.isImport => val ImportType(e) = t.widenTermRefExpr: @unchecked - paramProxy.get(e.tpe) match - case Some(p) => newImportSymbol(ctx.owner, singleton(p)).termRef - case None => mapOver(t) + val e1 = singleton(apply(e.tpe)) + newImportSymbol(ctx.owner, e1).termRef case t: SingletonType => if t.termSymbol.isAllOf(InlineParam) then apply(t.widenTermRefExpr) else paramProxy.getOrElse(t, mapOver(t)) diff --git a/tests/pos/i19493.scala b/tests/pos/i19493.scala index 37af3214ce16..93d9023d589c 100644 --- a/tests/pos/i19493.scala +++ b/tests/pos/i19493.scala @@ -22,8 +22,21 @@ object Minimization: inline def foo(x: GivesString): Unit = import x.aString - summon[String] + summon[String] // ok summonInline[String] // was error foo(???) + + + trait A: + val x: GivesString + + inline def bar: Unit = + import this.x.aString + summon[String] // ok + summonInline[String] // was error + + val a: A = ??? + a.bar + end Minimization