-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add error-checking when fetching rhs of trees from TASTy #22565
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
Conversation
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.
LGTM, but @liufengyun , do you also want to take a look?
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.
LGTM, thank you @lidaisy !
Let's squash the commits into one commit to make the history clean. In particular, avoid creating unnecessary merge commits in a PR (rebase is preferred).
/* This tests for errors in the program's TASTy trees. | ||
* The test consists of three files: (a) v1/A, (b) v1/B, and (c) v0/A. (a) and (b) are | ||
* compatible, but (b) and (c) are not. If (b) and (c) are compiled together, there should be | ||
* an error when reading the files' TASTy trees. */ |
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.
Minor: the *
and comments are not aligned.
|
||
val a0 = defaultOutputDir + tastyErrorGroup + "/A/v0/A" | ||
val a1 = defaultOutputDir + tastyErrorGroup + "/A/v1/A" | ||
val b1 = defaultOutputDir + tastyErrorGroup + "/B/v1/B" |
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.
Minor: the names a0
, a1
and b1
are not informative.
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.
Instead of assuming the output directory format, for maintainability, it would be better to explicitly set output directory based on the defaultOutputDir
.
Fewer assumptions are better --- it causes fewer problems in case the format changes.
compileFile("tests/init/tasty-error/v1/B.scala", tastyErrorOptions.withClasspath(a1))(tastyErrorGroup), | ||
compileFile("tests/init/tasty-error/v0/A.scala", tastyErrorOptions)(tastyErrorGroup), | ||
).map(_.keepOutput.checkCompile()) | ||
compileFile("tests/init/tasty-error/Main.scala", tastyErrorOptions.withClasspath(a0).withClasspath(b1))(tastyErrorGroup).checkExpectedErrors() |
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.
Minor: add one blank line before line 284 for better readability.
This PR would fix the error raised in #22442.
The error arises when reading incompatible TASTy trees. This PR checks if an error occurs when fetching the rhs of ValOrDefDef trees and gives a warning.