Skip to content

sourcepath: Fix handling of top-level definitions and user-written package objects #7690

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 9, 2019

Conversation

smarter
Copy link
Member

@smarter smarter commented Dec 5, 2019

No description provided.

@smarter smarter requested a review from odersky December 5, 2019 19:11
@smarter smarter force-pushed the sourcepath-toplevel-again-2 branch from 8fc3664 to 4a92b5a Compare December 5, 2019 19:11
5c2a2d5 was a bit too clever: instead
of running the desugaring of top-level definitions, it manually checked
if such a desugaring was needed and then entered the package object if
needed and traversed the non-desugared package statements, but in a
situation like this:

  package foo
  type Foo
  object Foo

The desugaring will move `object Foo` inside the package object,
so by traversing the non-desugared tree, we were creating a symbol
for Foo at the wrong level.

This commit fixes this by simply calling the appropriate desugaring
method before doing any traversal. Unfortunately I wasn't able to
manufacture a testcase where this makes a difference, but this
fixes some issues I saw when compiling dotty-library itself.
Turns out we never handled this properly before.
@smarter smarter force-pushed the sourcepath-toplevel-again-2 branch from 4a92b5a to d4b2222 Compare December 5, 2019 21:01
@odersky odersky merged commit 1fb73f9 into scala:master Dec 9, 2019
@odersky odersky deleted the sourcepath-toplevel-again-2 branch December 9, 2019 10:01
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