Skip to content

Commit e8c4c10

Browse files
committed
use wildApprox instead isGround
1 parent d94a22f commit e8c4c10

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6967,15 +6967,11 @@ object Types extends TypeUtils {
69676967
end NamedPartsAccumulator
69686968

69696969
class isGroundAccumulator(using Context) extends TypeAccumulator[Boolean] {
6970-
var tparams = util.HashSet[TypeLambda](initialCapacity = 8)
69716970
def apply(x: Boolean, tp: Type): Boolean = x && {
69726971
tp match {
6973-
case tp: TypeParamRef => tparams.contains(tp.binder)
6972+
case _: TypeParamRef => false
69746973
case tp: TypeVar => apply(x, tp.underlying)
69756974
case tp: AppliedType => tp.isGround(this)
6976-
case tp: HKTypeLambda =>
6977-
tparams.add(tp)
6978-
apply(x, tp.resType)
69796975
case _ => foldOver(x, tp)
69806976
}
69816977
}

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4358,7 +4358,12 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
43584358
implicitArgs(formals2, argIndex + 1, pt)
43594359

43604360
val pt1 = pt.deepenProtoTrans
4361-
if (pt1 `ne` pt) && (pt1 ne sharpenedPt) && pt1.isGround then
4361+
val approxPt = withMode(Mode.TypevarsMissContext):
4362+
wildApprox(pt1)
4363+
if (pt1 `ne` pt)
4364+
&& (pt1 ne sharpenedPt)
4365+
&& (AvoidWildcardsMap()(approxPt) `eq` approxPt)
4366+
&& !isFullyDefined(formal, ForceDegree.none) then
43624367
constrainResult(tree.symbol, wtp, pt1)
43634368
val arg = inferImplicitArg(formal, tree.span.endPos)
43644369

0 commit comments

Comments
 (0)