Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IncOptions.useOptimizedSealed is broken on 2.13 #1229

Closed
smarter opened this issue Jul 28, 2023 · 1 comment
Closed

IncOptions.useOptimizedSealed is broken on 2.13 #1229

smarter opened this issue Jul 28, 2023 · 1 comment
Labels
area/under_compilation Zinc does not pick up compilation when needed bug

Comments

@smarter
Copy link
Contributor

smarter commented Jul 28, 2023

build.sbt:

lazy val root = (project in file(".")).
  settings(
    name := "sbt-hello",
    scalaVersion := "2.13.11"
  )
ThisBuild / incOptions ~= { _.withUseOptimizedSealed(true) }

Sealed.scala:

sealed trait Sealed
class Child1 extends Sealed

PatMat.scala:

object PatMat {
  def test(x: Sealed): Int = x match {
    case _: Child1 => 1
  }
}
  1. compile
  2. Add an extra child in Sealed.scala: class Child2 extends Sealed
  3. compile again, only Sealed.scala is recompiled.

If I change scalaVersion to 2.12.18, then PatMat.scala is recompiled as expected.
I assume the zinc scripted tests such as https://github.com/sbt/zinc/tree/develop/zinc/src/sbt-test/source-dependencies/patMat-scope only run with 2.12, it'd be great to run them with 2.13 too to catch this sort of issues.

/cc @retronym who might be aware of projects that use useOptimizedSealed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/under_compilation Zinc does not pick up compilation when needed bug
Projects
None yet
Development

No branches or pull requests

2 participants