Skip to content

Improve sourcepath handling #7678

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 4 commits into from
Dec 4, 2019
Merged

Conversation

smarter
Copy link
Member

@smarter smarter commented Dec 4, 2019

Once we re-bootstrap with a compiler that contains this PR, I'll be able to make a follow-up PR to move IArray.scala from src-bootstrapped/ to src/

@odersky odersky assigned smarter and unassigned odersky Dec 4, 2019
... and delete -scansource which is now unnecessary.

The difference between these two settings is that the former assumes
that a file A.scala contains a top-level class or object A, whereas the
latter will use the outline parser to find definitions in A.scala and
create symbols for them.

So far we used the former to compile the standard library and
dotty-library, and the latter for the IDE, but we might as well always
use the latter, it's one less code path and dotty-library now uses
top-level definitions (like `type IArray` in scala/IArray.scala) so the
assumptions of -sourcepath do not apply to it anymore.

(top-level definitions are still not handled correctly with -sourcepath
after this commit, this is fixed in a latter commit in this PR)

This change required moving WithBounds which was previously in the wrong
directory.
The previous commit broke compilation of the standard library, because
we ended up calling `runContext` before the first context is set, when
it's still `null`. But we don't really need a new run just for creating
the symbol: the completer we set will call Run#lateCompile which will
take care of creating a new run anyway.
If a top-level definition is found in a file that is part of the
sourcepath, create a symbol for the package object that will wrap the
top-level definitions.
Move -sourcepath tests so that the directory passed to
-sourcepath does not contain any unrelated files.
@smarter smarter force-pushed the sourcepath-toplevel branch from 5007f97 to 1907b49 Compare December 4, 2019 17:20
@smarter smarter merged commit 5a695a5 into scala:master Dec 4, 2019
@smarter smarter deleted the sourcepath-toplevel branch December 4, 2019 19:19
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.

2 participants