-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Stick TASTy reading behind a -Ytasty-reader flag #9293
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@dwijnand Why is it an error to unpickle a class file that has TASTY while running without
-Ytasty-reader
? How about silently skipping the attribute in this case?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.
IIRC, the idea was to fail eagerly when people unknowingly end up with Scala 3 classfiles on their classpath.
Skipping the attribute would mean the compiler treats Scala 3 classfiles like Java classfiles, I cannot imagine this would lead to a usable behavior?
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.
Ah, thanks! So, there cannot be a scenario where there's regular Scala 2 metadata and TASTY?
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.
Also, how about the case where a Scala 3 classfile is on the class path but not referenced directly? It could be forced because you're referencing a Scala 2 symbol directly, which then depends on a symbol from a Scala 3 jar. In that case, you should be able to safely consume the Scala 2 classes without adding
-Ytasty-reader
, I think. (We're running into this error in the wild, but I have not yet figured out how exactly.)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.
That's right, Scala 3 doesn't emit
ScalaSignature
s (Scala 2 pickles), Scala 2 doesn't emit TSATy.That's a good point. I haven't tested it, but it seems anything that depends on a Scala 3 jar "pollutes" the entire classpath.
Generally, publishing a Scala 2.13 library that depends on a Scala 3 library is discouraged, see https://docs.scala-lang.org/scala3/guides/migration/compatibility-classpath.html#disclaimer-for-library-maintainers. But in controlled environments this could be OK.
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.
(The dependency in our case was pulled in by ammonite -- see
cs resolve -t com.lihaoyi:ammonite-compiler-interface_2.13.6:2.4.0
.)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.
cc @lihaoyi
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.
@alexarchambault is probably the expert here. I think we recently resolved an issue around accidental Scala3 dependencies in Ammonite? com-lihaoyi/Ammonite#1215
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.
Thanks, looks like that should fix it! Would be great to get a release out with this fix. I've seen several places mention this crash while I was trying to figure out what was going on. (Sounds like the canonical issue is com-lihaoyi/Ammonite#1214)
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.
Yeah we probably should. @alexarchambault would you be able to tag a 2.4.1 release?