-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Change/simplify projections #231
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
Conversation
* refinement type `T { X = U; ... }` | ||
*/ | ||
def reduceProjection(implicit ctx: Context): Type = { | ||
val reduced = prefix.lookupRefined(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe replace body with prefix.lookupRefined(name) orElse this
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be valid and more elegant. But reduceProjection is called often, so to not have unforeseen performance degradations we tend to eschew object allocations in hot paths. Can and should come back to this once we have macros or guaranteed inlining. But then it's likely to be a global cleanup by means of a regexp search.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. Maybe a // TODO: use Type's orElse combinator once it is inlined
then?
Can (should?) this also reduce |
The current implementation should do this. I'll think of a way to demonstrate this. |
Great! |
An example where this helps: Previously, the private value `mnemonics` in Coder.scala was fof the form Lambda$IP { ... } # Apply It now simplifies to a Map[...] type.
Needed some fixes to lookup refined. The potential alias type is now calculated by taking the member of the original refined type, instead of by simply following the refined info. This takes into account refinements that were defined after the refinement type that contains the alias. The change amde another test (transform) hit the deep subtype limit, which is now disabled.
71d3b36
to
8daa7a0
Compare
Force pushed after rebasing |
I think you accidentally force-pushed every branch in https://github.com/dotty-staging/dotty/ |
On Tue, Nov 18, 2014 at 7:41 PM, Guillaume Martres <[email protected]
Martin Odersky |
@smarter if you'll tell me which branches you want reverted before force-push I can revert them. |
Well, I would typically answer |
You can also ask github to disable push --force. We did that in scala/scala and have never needed it. |
@adriaanm we actually are rewriting history for dotty-staging. But disabling force-pushing for dotty master would indeed be a good step I guess. |
@DarkDimius: There's no branch I want to revert particularly, I just wanted people to be aware of this, for historical purpose it might be worth reverting every branch (except the one this pull-request is based on obviously). |
Seem like you can also recover the overwritten branch tips from the event log: https://gist.github.com/retronym/7ccec6d7ad0f0bb0db50 Hat tip: http://www.objectpartners.com/2014/02/11/recovering-a-commit-from-githubs-reflog/ Love the first comment on that blog:
|
Oh nice one! |
Nice! |
💯 |
Superseded by #232 |
Backport "Handle type aliases in contextFunctionResultTypeAfter" to 3.3 LTS
More aggressive relimination of
types. Review by @adriaanm @DarkDimius