From 96793eeaf17fd21d058eefdc2164e7941fffe55d Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Wed, 10 Jul 2024 09:04:47 +0200 Subject: [PATCH] Mark genSJSIR as *disabled* (rather than non-*runnable*) when no `-scalajs`. This works around the issue seen in #20296. However, the issue resurfaces if we actually run `-Ycheck:all` in a Scala.js-enabled build. [Cherry-picked a88312b6bf2ff1a7f0884ddaadbf5736bde91eba][modified] --- .../src/dotty/tools/backend/sjs/GenSJSIR.scala | 4 ++-- .../test/xsbt/CompileProgressSpecification.scala | 1 - tests/pos/i20296.scala | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 tests/pos/i20296.scala diff --git a/compiler/src/dotty/tools/backend/sjs/GenSJSIR.scala b/compiler/src/dotty/tools/backend/sjs/GenSJSIR.scala index 2c5a6639dc8b..6467e44c072d 100644 --- a/compiler/src/dotty/tools/backend/sjs/GenSJSIR.scala +++ b/compiler/src/dotty/tools/backend/sjs/GenSJSIR.scala @@ -11,8 +11,8 @@ class GenSJSIR extends Phase { override def description: String = GenSJSIR.description - override def isRunnable(using Context): Boolean = - super.isRunnable && ctx.settings.scalajs.value + override def isEnabled(using Context): Boolean = + ctx.settings.scalajs.value def run(using Context): Unit = new JSCodeGen().run() diff --git a/sbt-bridge/test/xsbt/CompileProgressSpecification.scala b/sbt-bridge/test/xsbt/CompileProgressSpecification.scala index bcdac0547e75..dc3956ada0db 100644 --- a/sbt-bridge/test/xsbt/CompileProgressSpecification.scala +++ b/sbt-bridge/test/xsbt/CompileProgressSpecification.scala @@ -66,7 +66,6 @@ class CompileProgressSpecification { "MegaPhase{pruneErasedDefs,...,arrayConstructors}", "erasure", "constructors", - "genSJSIR", "genBCode" ) val missingExpectedPhases = someExpectedPhases -- allPhases.toSet diff --git a/tests/pos/i20296.scala b/tests/pos/i20296.scala new file mode 100644 index 000000000000..910fd07c1298 --- /dev/null +++ b/tests/pos/i20296.scala @@ -0,0 +1,14 @@ +trait Foo + +object Foo { + inline def bar(): Foo = + class InlinedFoo extends Foo {} + new InlinedFoo + + inline def foo(): Foo = + bar() + class InlinedFoo extends Foo {} + new InlinedFoo + + def Test: Foo = Foo.foo() +}