Skip to content

Commit 89386d0

Browse files
committed
Fix TypeApplications.appliedTo instantiating classes.
self can be a TermRef to a constructor created by tpd.New. It used to work before last reiteration of hk-types.
1 parent 3c85915 commit 89386d0

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/dotty/tools/dotc/core/TypeApplications.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,13 +480,12 @@ class TypeApplications(val self: Type) extends AnyVal {
480480
}
481481
}
482482
if (args.isEmpty || ctx.erasedTypes) self
483+
else if (self.widen.isInstanceOf[PolyType]) self.widen.asInstanceOf[PolyType].instantiate(args)
483484
else self.stripTypeVar match {
484485
case EtaExpansion(self1) =>
485486
self1.appliedTo(args)
486487
case TypeLambda(_, _, body) if !args.exists(_.isInstanceOf[TypeBounds]) =>
487488
substHkArgs(body)
488-
case self: PolyType =>
489-
self.instantiate(args)
490489
case _ =>
491490
appliedTo(args, typeParams)
492491
}

0 commit comments

Comments
 (0)