Skip to content

Commit

Permalink
Mark genSJSIR as *disabled* (rather than non-*runnable*) when no `-sc…
Browse files Browse the repository at this point in the history
…alajs`.

This works around the issue seen in scala#20296. However, the issue
resurfaces if we actually run `-Ycheck:all` in a Scala.js-enabled
build.
  • Loading branch information
sjrd committed Jun 27, 2024
1 parent 41f1489 commit 0f753ab
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/src/dotty/tools/backend/sjs/GenSJSIR.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ class GenSJSIR extends Phase {

override def description: String = GenSJSIR.description

override def isEnabled(using Context): Boolean =
ctx.settings.scalajs.value

override def isRunnable(using Context): Boolean =
super.isRunnable && ctx.settings.scalajs.value && !ctx.usedBestEffortTasty
super.isRunnable && !ctx.usedBestEffortTasty

def run(using Context): Unit =
new JSCodeGen().run()
Expand Down
14 changes: 14 additions & 0 deletions tests/pos/i20296.scala
Original file line number Diff line number Diff line change
@@ -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()
}

0 comments on commit 0f753ab

Please sign in to comment.