Skip to content

Commit 191b41a

Browse files
EugeneFlesselleWojciechMazur
authored andcommitted
Also handle ImportTypes depending on this references
[Cherry-picked 969da60]
1 parent ddfc83d commit 191b41a

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

compiler/src/dotty/tools/dotc/inlines/Inliner.scala

+2-3
Original file line numberDiff line numberDiff line change
@@ -567,9 +567,8 @@ class Inliner(val call: tpd.Tree)(using Context):
567567
case t: TypeRef => paramProxy.getOrElse(t, mapOver(t))
568568
case t: TermRef if t.symbol.isImport =>
569569
val ImportType(e) = t.widenTermRefExpr: @unchecked
570-
paramProxy.get(e.tpe) match
571-
case Some(p) => newImportSymbol(ctx.owner, singleton(p)).termRef
572-
case None => mapOver(t)
570+
val e1 = singleton(apply(e.tpe))
571+
newImportSymbol(ctx.owner, e1).termRef
573572
case t: SingletonType =>
574573
if t.termSymbol.isAllOf(InlineParam) then apply(t.widenTermRefExpr)
575574
else paramProxy.getOrElse(t, mapOver(t))

tests/pos/i19493.scala

+14-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,21 @@ object Minimization:
2222

2323
inline def foo(x: GivesString): Unit =
2424
import x.aString
25-
summon[String]
25+
summon[String] // ok
2626
summonInline[String] // was error
2727

2828
foo(???)
29+
30+
31+
trait A:
32+
val x: GivesString
33+
34+
inline def bar: Unit =
35+
import this.x.aString
36+
summon[String] // ok
37+
summonInline[String] // was error
38+
39+
val a: A = ???
40+
a.bar
41+
2942
end Minimization

0 commit comments

Comments
 (0)