-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Replace is{Poly|Erased}FunctionType
with {PolyOrErased,Poly,Erased}FunctionOf
#18207
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
Replace is{Poly|Erased}FunctionType
with {PolyOrErased,Poly,Erased}FunctionOf
#18207
Conversation
de1857c
to
429886f
Compare
@@ -1836,7 +1838,7 @@ class Definitions { | |||
tp.stripTypeVar.dealias match | |||
case tp1: TypeParamRef if ctx.typerState.constraint.contains(tp1) => | |||
asContextFunctionType(TypeComparer.bounds(tp1).hiBound) | |||
case tp1 @ RefinedType(parent, nme.apply, mt: MethodType) if isErasedFunctionType(parent) && mt.isContextualMethod => | |||
case tp1 @ PolyOrErasedFunctionOf(mt: MethodType) if mt.isContextualMethod => |
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 see that this only matches ErasedFunction and not PolyFunction because it takes a MethodType and not a PolyType, but this could easily lead to confusion (especially if we have polymorphic ErasedFunctions in the future), so I would prefer to have explicit ErasedFunctionOf/PolyFunctionOf extractors.
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.
Added ErasedFunctionOf
. There are no places left where we would use PolyFunctionOf
.
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's a couple of places where we have check for poly functions which could benefit from an extractor:
- https://github.com/dotty-staging/dotty/blob/remove-isErased-and-isPoly-functions/compiler/src/dotty/tools/dotc/typer/Typer.scala#L1653-L1654C40
- https://github.com/dotty-staging/dotty/blob/remove-isErased-and-isPoly-functions/compiler/src/dotty/tools/dotc/typer/Typer.scala#L1672-L1673
6337c96
to
24aa05c
Compare
24aa05c
to
73975db
Compare
is{Poly|Erased}FunctionType
with PolyOrErasedFunctionOf
is{Poly|Erased}FunctionType
with {PolyOrErased,Poly,Erased}FunctionOf
case t if defn.isNonRefinedFunction(t) => | ||
t | ||
case t if defn.isErasedFunctionType(t) => | ||
case t @ defn.PolyOrErasedFunctionOf(_) => | ||
t |
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.
Looks like this could be just case t if defn.isFunctionType(t) =>
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 would make findFunctionType
identify dependent function refinements. It looks like a desirable change.
No description provided.