Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions compiler/src/dotty/tools/dotc/typer/Inliner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1548,13 +1548,14 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
//if the projection leads to a typed tree then we stop reduction
resNoReduce
else
val resMaybeReduced = constToLiteral(reducedProjection)
if resNoReduce ne resMaybeReduced then
typed(resMaybeReduced, pt) // redo typecheck if reduction changed something
val res = constToLiteral(reducedProjection)
if resNoReduce ne res then
typed(res, pt) // redo typecheck if reduction changed something
else if res.symbol.isInlineMethod then
inlineIfNeeded(res)
else
val res = resMaybeReduced
ensureAccessible(res.tpe, tree.qualifier.isInstanceOf[untpd.Super], tree.srcPos)
inlineIfNeeded(res)
res
}

override def typedIf(tree: untpd.If, pt: Type)(using Context): Tree =
Expand Down
5 changes: 5 additions & 0 deletions tests/pos/i14048.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class T:
inline def foo(): Unit = bar()
private inline def bar(): Unit = ()

def test(t: T) = t.foo()