Skip to content

Commit 3b9e5b6

Browse files
committed
Make PolyType a ground type
It's too surprising to leave it as a type proxy. In all circumstances except erasure, it is not true that a PolyType is somehow the same as its result type.
1 parent 29c3818 commit 3b9e5b6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

compiler/src/dotty/tools/dotc/core/TypeErasure.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
389389
case rt =>
390390
tp.derivedLambdaType(tp.paramNames, formals, rt)
391391
}
392+
case tp: PolyType =>
393+
this(tp.resultType)
392394
case tp @ ClassInfo(pre, cls, classParents, decls, _) =>
393395
if (cls is Package) tp
394396
else {
@@ -517,6 +519,8 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
517519
if (inst.exists) sigName(inst) else tpnme.Uninstantiated
518520
case tp: TypeProxy =>
519521
sigName(tp.underlying)
522+
case tp: PolyType =>
523+
sigName(tp.resultType)
520524
case _: ErrorType | WildcardType =>
521525
tpnme.WILDCARD
522526
case tp: WildcardType =>

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2702,7 +2702,7 @@ object Types {
27022702
*/
27032703
class PolyType(val paramNames: List[TypeName])(
27042704
paramInfosExp: PolyType => List[TypeBounds], resultTypeExp: PolyType => Type)
2705-
extends HKLambda with TypeLambda {
2705+
extends MethodOrPoly with TypeLambda {
27062706

27072707
type This = PolyType
27082708
def companion = PolyType

0 commit comments

Comments
 (0)