Skip to content

Do not compute PackageDef members in extractor #4578

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

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

@nicolasstucki nicolasstucki force-pushed the add-missing-tasty-implemetations branch 2 times, most recently from 8d02417 to e5ad4af Compare May 24, 2018 14:06
@nicolasstucki nicolasstucki requested a review from odersky May 24, 2018 15:22
@nicolasstucki nicolasstucki changed the title Add missing tasty implementations Do not compute PackageDef members in extractor May 24, 2018
if (x.symbol.is(core.Flags.JavaDefined)) Nil // FIXME should also support java packages
else x.symbol.info.decls.iterator.map(FromSymbol.definition).toList
Some(x.symbol.name.toString, definitions)
Some((x.symbol.name.toString, FromSymbol.packageDef(x.symbol.owner)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty hard to guess here: the returned PackageDef is the owner. Lacking constructors that's hard to document.

@nicolasstucki nicolasstucki force-pushed the add-missing-tasty-implemetations branch from e5ad4af to 7378bc2 Compare May 26, 2018 10:05
@nicolasstucki nicolasstucki force-pushed the add-missing-tasty-implemetations branch from 7378bc2 to b90ff00 Compare May 28, 2018 15:51
@nicolasstucki
Copy link
Contributor Author

Rebased

Copy link
Contributor

@Blaisorblade Blaisorblade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell this is mostly a refactoring (that optimizes things by making them lazier), which LGTM.

However, this changes PackageDef destruction to not match TastyFormat anymore — since that defines

TopLevelStat  = PACKAGE        Length Path TopLevelStat*
                  Stat

I'm fine with this format being inspired by Tasty, but that seems potentially problematic in general.

To ensure we keep a correspondence between this format and tasty, I suspect we should add tests comparing the output from this API with the results of reading pickled Tasty trees, verifying the two are isomorphic. Such a test could be updated to withstand this change, but that would limit more invasive misalignments.

@nicolasstucki
Copy link
Contributor Author

The confusion here is that in tasty reflet we call the PackageDef tree PackageClause. The PackageDef in tasty reflect represents the symbol of the package.

@nicolasstucki nicolasstucki removed the request for review from odersky June 5, 2018 09:30
@nicolasstucki nicolasstucki assigned Blaisorblade and unassigned odersky Jun 5, 2018
@nicolasstucki
Copy link
Contributor Author

@Blaisorblade any other comment or can we merge this one?

@Blaisorblade Blaisorblade merged commit 656b96a into scala:master Jun 5, 2018
@Blaisorblade
Copy link
Contributor

Merging.

The PackageDef in tasty reflect represents the symbol of the package.

Now I see what you mean, but I don't understand what the distinction is supposed to represent conceptually.

As far as I can tell, tasty.PackageDef has no corresponding node in tasty, and it's just used as a way to proxy package clauses without loading the whole package.

@Blaisorblade Blaisorblade deleted the add-missing-tasty-implemetations branch June 5, 2018 12:03
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