-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #6542: Pickle line sizes in TASTy #10363
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1363,8 +1363,13 @@ class TreeUnpickler(reader: TastyReader, | |
def sourceChangeContext(addr: Addr = currentAddr)(using Context): Context = { | ||
val path = sourcePathAt(addr) | ||
if (path.nonEmpty) { | ||
val sourceFile = ctx.getSource(path) | ||
posUnpicklerOpt match | ||
case Some(posUnpickler) => | ||
sourceFile.setLineIndicesFromLineSizes(posUnpickler.lineSizes) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a potential issue here: the relative path of a file is not a unique identifier of the file, there might be path conflicts in the Scala ecosystem. If we also store the hash of source files, that would be better. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How would you use that hash? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The hash would be on the contents of the source? Then we would need to read all the sources eagerly when we add them to the context. That may be quite expensive. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When we compile files, we already have the file contents in memory. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, it is only loaded when we first access something the depends on the source https://github.com/lampepfl/dotty/blob/master/compiler/src/dotty/tools/dotc/util/SourceFile.scala#L43. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When we compile Scala files, the contents for the Scala files will be forced. |
||
case _ => | ||
pickling.println(i"source change at $addr: $path") | ||
ctx.withSource(ctx.getSource(path)) | ||
ctx.withSource(sourceFile) | ||
} | ||
else ctx | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.