Skip to content

Commit

Permalink
WIP: prevent posttyper running on java with -Ytest-pickler
Browse files Browse the repository at this point in the history
  • Loading branch information
bishabosha committed Feb 9, 2024
1 parent 10c8b4a commit b32569e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions compiler/src/dotty/tools/dotc/core/Phases.scala
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,14 @@ object Phases {
def runOn(units: List[CompilationUnit])(using runCtx: Context): List[CompilationUnit] =
val buf = List.newBuilder[CompilationUnit]
// factor out typedAsJava check when not needed
val doSkipJava = ctx.settings.YjavaTasty.value && this <= sbtExtractAPIPhase && skipIfJava
val doCheckJava =
ctx.settings.YjavaTasty.value
&& (!sbtExtractAPIPhase.exists || this <= sbtExtractAPIPhase)
for unit <- units do
given unitCtx: Context = runCtx.fresh.setPhase(this.start).setCompilationUnit(unit).withRootImports
if ctx.run.enterUnit(unit) then
try
if doSkipJava && unit.typedAsJava then
if doCheckJava && skipIfJava && unit.typedAsJava then
()
else
run
Expand Down
4 changes: 2 additions & 2 deletions sbt-test/pipelining/Yjava-tasty-fromjavaobject/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ lazy val a = project.in(file("a"))
.settings(
compileOrder := CompileOrder.Mixed, // ensure we send java sources to Scala compiler
scalacOptions += "-Yjava-tasty", // enable pickling of java signatures
scalacOptions ++= Seq("-Yjava-tasty-output", ((ThisBuild / baseDirectory).value / "a-enum-java-tasty.jar").toString),
scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-enum-java-tasty.jar").toString),
scalacOptions += "-Ycheck:all",
Compile / classDirectory := ((ThisBuild / baseDirectory).value / "a-enum-classes"), // send classfiles to a different directory
)
Expand All @@ -14,7 +14,7 @@ lazy val aCheck = project.in(file("a-check"))
Compile / sources := (a / Compile / sources).value, // use the same sources as a
compileOrder := CompileOrder.Mixed, // ensure we send java sources to Scala compiler
scalacOptions += "-Yjava-tasty", // enable pickling of java signatures
scalacOptions ++= Seq("-Yjava-tasty-output", ((ThisBuild / baseDirectory).value / "a-enum-java-tasty-2.jar").toString),
scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-enum-java-tasty-2.jar").toString),
Compile / classDirectory := ((ThisBuild / baseDirectory).value / "a-enum-classes-2"), // send classfiles to a different directory
)

Expand Down

0 comments on commit b32569e

Please sign in to comment.