-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Avoid retraversing parts of the tree that do not contain Quote trees #17407
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
Avoid retraversing parts of the tree that do not contain Quote trees #17407
Conversation
1cf6b91
to
c27f870
Compare
val contents1 = contents ::: quote.tags | ||
val pickled = PickleQuotes.pickle(quote2, quotes, contents1) | ||
transform(pickled) // pickle quotes that are in the contents | ||
val contents1 = contents.map(transform(_)) ::: quote.tags |
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.
By the way, why are the tags after the content? Aren't they referenced in the body?
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.
The tags will not contain quotes, they are all TermRef
s. Therfore we know that this transformation will have no effect.
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.
right, I mean, why isn't it quote.tags ::: contents.map(...)
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.
The order was irrelevant as we split them in PickleQuotes.pickle
. This also deserves some optimization. I will add a commit for that.
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.
It was added at the end because of a zipWithIndex that we needed for the contents but not the tags. There was a TODO to cleanup that mess.
if typeSplices.isEmpty then Literal(Constant(null)) // keep pickled quote without contents as small as possible | ||
else SeqLiteral(typeSplices.map(_._1), TypeTree(defn.QuotedTypeClass.typeRef.appliedTo(WildcardType))) | ||
if quote.tags.isEmpty then Literal(Constant(null)) // keep pickled quote without holeContents as small as possible | ||
else SeqLiteral(quote.tags, TypeTree(defn.QuotedTypeClass.typeRef.appliedTo(WildcardType))) |
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.
Note that WildcardType isn't supposed to appear in types of trees, only in prototypes for inference, the argment of Foo[?]
should be represented with a TypeBounds
instead.
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.
Replaced it with TypeBounds.emptyPolyKind
.
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.
Otherwise LGTM.
Also, remove an illegal use of
WildcardType
.