Skip to content

Commit d1ce179

Browse files
oderskyallanrenucci
authored andcommitted
Fix isGround logic
1 parent b19ea47 commit d1ce179

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ object Types {
305305
that.existsPart(this == _)
306306

307307
/** Does this type not refer to TypeParamRefs or uninstantiated TypeVars? */
308-
final def isGround(implicit ctx: Context): Boolean = true
308+
final def isGround(implicit ctx: Context): Boolean =
309+
(new isGroundAccumulator).apply(true, this)
309310

310311
/** Is this a type of a repeated parameter? */
311312
def isRepeatedParam(implicit ctx: Context): Boolean =
@@ -3279,7 +3280,7 @@ object Types {
32793280

32803281
def isGround(acc: TypeAccumulator[Boolean])(implicit ctx: Context): Boolean = {
32813282
if (!isGroundKnown) {
3282-
isGroundCache = acc.foldOver(false, this)
3283+
isGroundCache = acc.foldOver(true, this)
32833284
isGroundKnown = true
32843285
}
32853286
isGroundCache
@@ -4797,7 +4798,7 @@ object Types {
47974798
}
47984799

47994800
class isGroundAccumulator(implicit ctx: Context) extends TypeAccumulator[Boolean] {
4800-
def apply(x: Boolean, tp: Type) = x || {
4801+
def apply(x: Boolean, tp: Type) = x && {
48014802
tp match {
48024803
case _: TypeParamRef => false
48034804
case tp: TypeVar => apply(x, tp.underlying)

0 commit comments

Comments
 (0)