Skip to content

Commit b32569e

Browse files
committed
WIP: prevent posttyper running on java with -Ytest-pickler
1 parent 10c8b4a commit b32569e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Diff for: compiler/src/dotty/tools/dotc/core/Phases.scala

+4-2
Original file line numberDiff line numberDiff line change
@@ -346,12 +346,14 @@ object Phases {
346346
def runOn(units: List[CompilationUnit])(using runCtx: Context): List[CompilationUnit] =
347347
val buf = List.newBuilder[CompilationUnit]
348348
// factor out typedAsJava check when not needed
349-
val doSkipJava = ctx.settings.YjavaTasty.value && this <= sbtExtractAPIPhase && skipIfJava
349+
val doCheckJava =
350+
ctx.settings.YjavaTasty.value
351+
&& (!sbtExtractAPIPhase.exists || this <= sbtExtractAPIPhase)
350352
for unit <- units do
351353
given unitCtx: Context = runCtx.fresh.setPhase(this.start).setCompilationUnit(unit).withRootImports
352354
if ctx.run.enterUnit(unit) then
353355
try
354-
if doSkipJava && unit.typedAsJava then
356+
if doCheckJava && skipIfJava && unit.typedAsJava then
355357
()
356358
else
357359
run

Diff for: sbt-test/pipelining/Yjava-tasty-fromjavaobject/build.sbt

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ lazy val a = project.in(file("a"))
22
.settings(
33
compileOrder := CompileOrder.Mixed, // ensure we send java sources to Scala compiler
44
scalacOptions += "-Yjava-tasty", // enable pickling of java signatures
5-
scalacOptions ++= Seq("-Yjava-tasty-output", ((ThisBuild / baseDirectory).value / "a-enum-java-tasty.jar").toString),
5+
scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-enum-java-tasty.jar").toString),
66
scalacOptions += "-Ycheck:all",
77
Compile / classDirectory := ((ThisBuild / baseDirectory).value / "a-enum-classes"), // send classfiles to a different directory
88
)
@@ -14,7 +14,7 @@ lazy val aCheck = project.in(file("a-check"))
1414
Compile / sources := (a / Compile / sources).value, // use the same sources as a
1515
compileOrder := CompileOrder.Mixed, // ensure we send java sources to Scala compiler
1616
scalacOptions += "-Yjava-tasty", // enable pickling of java signatures
17-
scalacOptions ++= Seq("-Yjava-tasty-output", ((ThisBuild / baseDirectory).value / "a-enum-java-tasty-2.jar").toString),
17+
scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-enum-java-tasty-2.jar").toString),
1818
Compile / classDirectory := ((ThisBuild / baseDirectory).value / "a-enum-classes-2"), // send classfiles to a different directory
1919
)
2020

0 commit comments

Comments
 (0)