-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Keep export clause until first transform, use for incremental compilation #10182
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
Keep export clause until first transform, use for incremental compilation #10182
Conversation
70abd87
to
1e0d0e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed a commit showing how things are broken.
d05e455
to
b66ea6d
Compare
To get this to work, ExtractDependencies will need to handle wildcard exports from a class in the same way it handles inheriting from that type: by recording a |
Thanks, right so the best way to break stuff is to add a new definition |
6f7285b
to
45d840b
Compare
948017d
to
02660c7
Compare
6fe121d
to
353b508
Compare
I believe this is ready now |
bd2b5dc
to
d0f20a9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clean the history of this PR to remove some of the back-and-forth ? I think having everything in one commit would be fine.
d0f20a9
to
019de01
Compare
sbt-dotty/sbt-test/source-dependencies/export-clauses/build.sbt
Outdated
Show resolved
Hide resolved
9de8784
to
743a6b6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, one more thing: we should disallow wildcard export from a package because (unless I'm mistaken) we can't do incremental compilation for that for the same reason we can't do it for imports: sbt/zinc#226
@smarter do you mean just check in ExtractDependencies for if the prefix is a package?, or reject it with an error in typer e.g. |
In typer yes |
added a error when wildcard exports come from a package prefix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM, thanks for working on this!
@smarter I tested the following (commenting out the package prefix check) and confirmed that sbt/zinc#226 does prevent new members being seen: // A.scala
export p1._
export p2._
class A {
val b = new B()
} // p1.scala
package p1
class B // p2.scala
package p2
class Ignored // needed so that A.scala compiles
// If after p2 is compiled we add `class B` here, then `A.scala` is not recompiled
// class B |
61aa323
to
74e9fa9
Compare
Add Export trees to TASTy format and QuoteContext reflection API Use Export trees to record wildcard export as dependencies by inheritance in incremental compilation. Motivation for these changes: - enable semantic tools such as doc tools to inspect where exports occur - when a class A exports members of (b: B) with a wildcard, there was no dependency recorded to trigger a recompile of A if B adds new members. Keeping the export trees in the dependencies phase lets us inspect for the wildcard case which has a different dependency relationship than named exports.
74e9fa9
to
666739b
Compare
1db0f94
to
2c6eeb2
Compare
not sure what else should cause enough indirection for this to failnow: