Skip to content

Avoid CCE when scalac internally uses compileLate#2453

Merged
eed3si9n merged 1 commit intosbt:0.13from
retronym:topic/sourcepath
Feb 11, 2016
Merged

Avoid CCE when scalac internally uses compileLate#2453
eed3si9n merged 1 commit intosbt:0.13from
retronym:topic/sourcepath

Conversation

@retronym
Copy link
Member

For example, when the --sourcepath option is provided
and the refchecks phase compiles an annotation found
on a referenced symbol from the sourcepath.

compileLate assumes that all non-sentinel compiler
phases can be down cast to GlobalPhase.

This commit changes the two phases in SBT to extend
this instead of Phase. This has the knock on benefit
of simplifying the phases by letting the GlobalPhase.run
iterator over the list of compilation units and feed them
to us one by one.

I checked that the test case failed before making each
change.

@retronym retronym changed the title Avoid CCE when scalac internally uses compileLate Avoid CCE when scalac internally uses compileLate. Fixes #2452 Feb 10, 2016
@retronym retronym changed the title Avoid CCE when scalac internally uses compileLate. Fixes #2452 Avoid CCE when scalac internally uses compileLate Feb 10, 2016
@eed3si9n
Copy link
Member

Would it make sense to change https://github.com/sbt/sbt/blob/0.13/compile/interface/src/main/scala/xsbt/Analyzer.scala while we're at it?

{
val start = System.currentTimeMillis
currentRun.units.foreach(processUnit)
super.run()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compiler-project / run2.8 failed:

[error] /tmp/sbt_2e562db/xsbt/API.scala:31: error: ApiPhase.super.run of type Unit does not take parameters
[error]         super.run()
[error]                  ^
[error] one error found

For example, when the `--sourcepath` option is provided
and the refchecks phase compiles an annotation found
on a referenced symbol from the sourcepath.

`compileLate` assumes that all non-sentinel compiler
phases can be down cast to `GlobalPhase`.

This commit changes the two phases in SBT to extend
this instead of `Phase`. This has the knock on benefit
of simplifying the phases by letting the `GlobalPhase.run`
iterator over the list of compilation units and feed them
to us one by one.

I checked that the test case failed before making each
change.
@retronym
Copy link
Member Author

@eed3si9n Just updated the extraction phase, too, and fixed the compile error.

@eed3si9n
Copy link
Member

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants