Skip to content

Commit 530a661

Browse files
committed
Fix bug in hasTransparentBody
1 parent 5cfa0a4 commit 530a661

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

compiler/src/dotty/tools/dotc/transform/Inlining.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ class Inlining extends MacroTransform {
3636
override def allowsImplicitSearch: Boolean = true
3737

3838
override def run(using Context): Unit =
39-
if (ctx.settings.YinlineBlackboxAfterTyper.value) super.run
39+
// if (ctx.settings.YinlineBlackboxAfterTyper.value)
40+
super.run
4041

4142
override def checkPostCondition(tree: Tree)(using Context): Unit =
4243
tree match {
@@ -51,11 +52,11 @@ class Inlining extends MacroTransform {
5152
case tree: DefTree =>
5253
if tree.symbol.is(Inline) then tree
5354
else super.transform(tree)
54-
case _: Typed =>
55+
case _: Typed | _: Block =>
5556
super.transform(tree)
56-
case _ if Inliner.isInlineable(tree) && !Inliner.inInlineMethod =>
57+
case _ if Inliner.isInlineable(tree) =>
5758
val inlined = Inliner.inlineCall(tree)
58-
super.transform(inlined)
59+
transform(inlined)
5960
case _ =>
6061
super.transform(tree)
6162

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ object Inliner {
6363

6464
/** `sym` is an inline method with a known body to inline which looks like a tansparent inline */
6565
def hasTransparentBody(sym: SymDenotation)(using Context): Boolean =
66-
!bodyToInline(sym).isInstanceOf[Typed] // may have false negatives
66+
sym.exists && !bodyToInline(sym).isInstanceOf[Typed] // may have false negatives
6767

6868
/** Try to inline a call to an inline method. Fail with error if the maximal
6969
* inline depth is exceeded.

0 commit comments

Comments
 (0)