Skip to content

Fix #7683: Fix CompilationUnit handling in Context#withSource #7691

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

Merged
merged 2 commits into from
Dec 11, 2019

Conversation

smarter
Copy link
Member

@smarter smarter commented Dec 5, 2019

In e07a728, I changed
Context#withSource to set a new CompilationUnit based on the source if
no compilation unit is currently set (always having a CompilationUnit
set is now needed since I moved the fresh name generator inside
CompilationUnit), however CompilationUnit#apply will error out if the
source file does not exist, which might happen for library code.

Fixed by adding a parameter to disable this check, but this is not very
pretty and we should really try to design a better way to distinguish
between user source files and source files we happen to know the name of
because it's stored in Tasty.

In e07a728, I changed
Context#withSource to set a new CompilationUnit based on the source if
no compilation unit is currently set (always having a CompilationUnit
set is now needed since I moved the fresh name generator inside
CompilationUnit), however CompilationUnit#apply will error out if the
source file does not exist, which might happen for library code.

Fixed by adding a parameter to disable this check, but this is not very
pretty and we should really try to design a better way to distinguish
between user source files and source files we happen to know the name of
because it's stored in Tasty.
@smarter smarter force-pushed the careful-compilation-unit branch from 9a32a2c to 31d095b Compare December 6, 2019 16:29
@smarter smarter force-pushed the careful-compilation-unit branch from 31d095b to 35b79c5 Compare December 6, 2019 16:30
@bishabosha bishabosha added this to the 0.21 Tech Preview milestone Dec 9, 2019
@bishabosha
Copy link
Member

This fixed the issue

@smarter smarter merged commit 8698691 into scala:master Dec 11, 2019
@smarter smarter deleted the careful-compilation-unit branch December 11, 2019 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants