Skip to content

TASTy reflect join Tree, TypeTree, CaseDef and TypeCaseDef #6053

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

@nicolasstucki nicolasstucki commented Mar 9, 2019

The new hierarchy as Tree as the root of all trees, type trees and case trees

+- Tree -+- PackageClause
         +- Import
         +- Statement -+- Definition -+- ...
         |             |
         |             +- Term -+- ...
         |
         +- TypeTree -+- ...
         |
         +- TypeBoundsTree
         +- SyntheticBounds
         +- CaseDef
         +- TypeCaseDef

+- Pattren -+- ...

...

@nicolasstucki nicolasstucki self-assigned this Mar 9, 2019
@nicolasstucki nicolasstucki force-pushed the tasty-reflect-join-tree-and-typetree branch 3 times, most recently from f044e52 to 4f1160e Compare March 9, 2019 20:56
@nicolasstucki nicolasstucki force-pushed the tasty-reflect-join-tree-and-typetree branch from 8f7c63a to 160bad2 Compare March 10, 2019 06:55
@nicolasstucki nicolasstucki force-pushed the tasty-reflect-join-tree-and-typetree branch from 2826aac to 57b8dad Compare March 10, 2019 08:49
@nicolasstucki nicolasstucki changed the title TASTy reflect join Tree and TypeTree TASTy reflect join Tree, TypeTree, CaseDef and TypeCaseDef Mar 10, 2019
@nicolasstucki nicolasstucki force-pushed the tasty-reflect-join-tree-and-typetree branch from 520429e to ae252e1 Compare March 10, 2019 11:27
@nicolasstucki nicolasstucki marked this pull request as ready for review March 10, 2019 11:59
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

LGTM . ~150LOC less code, nice refactoring 👍

BTW, if we decide CaseDef and TypeCaseDef are trees, maybe we may admit Pattern as trees too. It's better to have a principle to document and justify the different treatment of syntatic elements.

@nicolasstucki
Copy link
Contributor Author

Pattern have are another problem. They are impossible to join to the Tree hierarchy without making the extractors unsound. For example Typed and TypeTest would be indistinguishable as they are both represented with a tpd.Typed but there is nothing in them to know if they are in a pattern or not. These will need a deeper redesign of the reflect API.

@nicolasstucki nicolasstucki merged commit 7fb91ad into scala:master Mar 10, 2019
@ghost ghost removed the stat:needs review label Mar 10, 2019
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