-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Encode pickled primitives directly using reflection #10232
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
Encode pickled primitives directly using reflection #10232
Conversation
Step towards #10222 |
86d8b30
to
fa93686
Compare
fa93686
to
c60ee85
Compare
This removes the need of some extra helper methods in the internal package. Also add `asExpr` to have a variant of `asExprOf[Any]` that does not need the extra type test at runtime.
…` directly This removes the need of some extra helper methods in the internal package.
c60ee85
to
bff91a8
Compare
* '{ val x: t = ... } | ||
* ``` | ||
*/ | ||
def asType: scala.quoted.Type[?] |
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.
what's the difference with seal
?
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.
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 find the name asType
is not as informative as seal
, because the name Type
in the context of TypeRepr
is vague, it could refer to both TypeRepr
and quoted.Type
.
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 next step is to find a way to inject this type in the context directly. Something like
typeRep.asTypeInContext { [T] =>>
// Type[T] is given in this context
}
def asTypeInContext[U](body: [T] =>> (using Type[T]) => U): U = ...
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.
LGTM
* '{ val x: t = ... } | ||
* ``` | ||
*/ | ||
def asType: scala.quoted.Type[?] |
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 find the name asType
is not as informative as seal
, because the name Type
in the context of TypeRepr
is vague, it could refer to both TypeRepr
and quoted.Type
.
This removes the need of some extra helper methods in the internal package.
Add
asExpr
to have a variant ofasExprOf[Any]
that does not need the extra type test at runtime.Also add an equivalent
asType
method.