-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Update Tasty Reflect match type code #10690
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
object MatchTypeCase: | ||
def unapply(tpe: TypeRepr): Option[(TypeRepr, TypeRepr)] = | ||
tpe match | ||
case AppliedType(t, Seq(from, to)) /*if t == MatchCaseType*/ => |
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.
Are these reflect extractor?
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 was code that we used in the doctool to take apart match types.
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.
This indicates that MatchType
are already fully supported. It is just a matter of knowing what needs to go there. This will need some documentation.
@nicolasstucki I see that in tests we actually have code that created match types by accessing the internal |
object MatchTypeCase: | ||
def unapply(tpe: TypeRepr): Option[(TypeRepr, TypeRepr)] = | ||
tpe match | ||
case AppliedType(t, Seq(from, to)) /*if t == MatchCaseType*/ => |
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.
This indicates that MatchType
are already fully supported. It is just a matter of knowing what needs to go there. This will need some documentation.
end extension | ||
end MatchTypeMethods | ||
|
||
type MatchTypeCase <: TypeRepr |
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.
We should keep the abstractions aligned with what is in TASTy and not add new ones.
type MatchTypeCase = dotc.core.Types.Type | ||
|
||
object MatchTypeCase extends MatchTypeCaseModule: | ||
def unapply(x: MatchTypeCase): Option[(List[String], List[TypeBounds], TypeRepr, TypeRepr)] = |
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.
We can implement this in userspace, this should not be added here. It is unclear what the ideal API should be, it would be better to implement such custom extractors in a separate library.
I do not think we should do these changes. We should keep it as it is. |
6a481a9
to
d43c5a2
Compare
d43c5a2
to
20ac708
Compare
@nicolasstucki can take a look at the PR now? This is a full version of the API. I think we need to have a type for a case of a match type, it's the same thing as with |
Replaced with #10735 |
No description provided.