-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Synthesize anonymous mirrors with path dependent prefixes #13502
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
781d29f
to
1240444
Compare
87e9976
to
df02001
Compare
9f85908
to
ba0d1ec
Compare
add a new method healPrefix which converts ThisTypes wrapping a Module into a TermRef and subsitutes ThisType of enclosing classes with matching parts of the prefix of the summoned mirror fixes scala#12328 fixes scala#11174 use do not force symbols add safety for unknown type experiment with TypeOps.refineUsingParent support hk types rebase fixes disable for scala2x generic product nonstatic simplify a bit add more tests find common prefix of and/or types refine implementation based on runtime tests experiment with supertypes remove prefix splice in companionref
ba0d1ec
to
0d4e294
Compare
constr = untpd.emptyConstructor, | ||
parents = untpd.TypeTree(defn.ObjectType) :: Nil, | ||
derived = Nil, | ||
self = EmptyValDef, | ||
body = monoTypeDef :: Nil | ||
).withAttachment(attachment, ()) | ||
).withAttachment(attachment, ()).withAttachment(AnonymousMirrorPrefix, pre) |
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.
@bishabosha I want to make anonymous mirrors SAMs and I'm thinking - wouldn't it be easier to synthesize them here directly instead of passing all the attachments and then manually linking the symbols?
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.
I think it would be in principle, however there is supposed to be a feature that the companion object is not meant to leak the mirror definitions if its the mirror (its a bit broken now) - which would be difficult if mirror implementation was added in typer
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.
But that shouldn't be affected by synthesizing anonymous mirrors in the typer.
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.
yes I think that can work - I'm not aware of the original reason to do the current behaviour
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.
^ reserve this work for another PR - probably involves abstracting a few things in SyntheticMembers
(where anonymous mirrors get their definitions)
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.
Yes, I meant another PR - but I can't seem to find the time
will open a new PR with a cleaner implementation |
identify and splice the prefix of a summoned mirror into the generated code of the mirror
fixes #13332
fixes #12328
fixes #11174
fixes #13935