Decouple quoted Type interface from encoding V2 #9535
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before,
quoted.Type
was defined asWhere
T
is the proper type of the instance of aType
. This is the type used for all operations within the compiler.The only purpose of the type
X
was to be able to write context bounds as[X: Type]
and staged typesType[X]
instead ofType { type T = X }
.Unfortunately, the type
X
makes the assumption thatX
is known, which implies that instances ofType
with unknown types need to be encoded with a whildcard type.A
val t: Type[?] = ...
is unusable as we cannot heal staged wildcard types, even though we do have at.T
which can be handled.Now, we change the definition of
Type
to only have the type member and rename it toQuotedType
.This solves the aforementioned limitations with unkown staged types.
Now we are also able to remove the wildcard from
QuoteContext.tasty.Type.seal
and the result can be used in quotes.To keep the context bound syntax and provide more descriptive name for the concept, we defined the
quoted.Type
type alias.Alternative to #9485. This one does not affect the user interface.