Skip to content

Commit 9de3905

Browse files
authored
Merge pull request #3659 from dotty-staging/fix-#3633
Fix #3633: Inline trees can be pure
2 parents 6de4253 + 9a86612 commit 9de3905

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

compiler/src/dotty/tools/dotc/ast/TreeInfo.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
372372
exprPurity(expr)
373373
case Block(stats, expr) =>
374374
minOf(exprPurity(expr), stats.map(statPurity))
375+
case Inlined(_, bindings, expr) =>
376+
minOf(exprPurity(expr), bindings.map(statPurity))
375377
case NamedArg(_, expr) =>
376378
exprPurity(expr)
377379
case _ =>

tests/pos/i3633.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class Test {
2+
inline def foo = 1
3+
def test = -foo
4+
}

0 commit comments

Comments
 (0)