Skip to content

Commit

Permalink
Turn on special handling for erased functions in TypeComparer
Browse files Browse the repository at this point in the history
  • Loading branch information
Linyxus committed Jul 10, 2023
1 parent ffee8bd commit 6a349b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
case _ =>
isSubType(info1, info2)

if defn.isFunctionType(tp2) then
if defn.isFunctionType(tp2) || defn.isErasedFunctionType(tp2) then

This comment has been minimized.

Copy link
@odersky

odersky Jul 11, 2023

The special treatment of defn.isErasedFunctionType looks like a footgun. I think isFunctionType should also cover erased functions.

This comment has been minimized.

Copy link
@nicolasstucki

nicolasstucki Jul 12, 2023

We need to make some major refactoring to reconcile FunctionN/ContextFunctionN/PolyFunction/ErasedFunction.

Maybe we could use isFunctionOrPolyType here. This variant covers all the different functions. But then we would need to nest the following if tp2.parent.typeSymbol == defn.PolyFunctionClass then. This might be more consistent.

This comment has been minimized.

Copy link
@nicolasstucki

nicolasstucki Jul 12, 2023

I started refactorings in scala#18193. It includes this fix.

tp1w.widenDealias match
case tp1: RefinedType =>
return isSubInfo(tp1.refinedInfo, tp2.refinedInfo)
Expand Down

0 comments on commit 6a349b5

Please sign in to comment.