-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Skip caret when source is missing in initialization checker #23926
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
base: main
Are you sure you want to change the base?
Conversation
fb848cd
to
2cb6965
Compare
* The method SourceFile#exists always return true thus cannot be used. | ||
*/ | ||
def fileExists(source: SourceFile): Boolean = | ||
source.content().nonEmpty |
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.
FileContentNonEmpty?
* The method SourceFile#exists always return true thus cannot be used. | ||
*/ | ||
def fileExists(source: SourceFile): Boolean = | ||
source.content().nonEmpty |
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.
Should we just headOption,does the nonEmpty read the content?
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.
SourceFile#content
is a special method with cache. If it is not empty, we will need to read lines from it (thus force loading the content).
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 mean maybe just need to check the first char or line
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 see what you mean. If you check the overall design for code caching and SourceFile#content
, you will see there is no need/opportunity for optimization here.
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
In CompilationTests.scala
, we are accumulating quite a few ad hoc cases where we compile some files somehow, and later compile some other files together with the output of the first compilation. As a future issue/PR, we should think about ways to factor out any commonality to clean this up.
Skip caret when source is missing in initialization checker