Skip to content

Commit df1bf4d

Browse files
Use .zipped.forall instead zip_zip_forall
1 parent 3db347f commit df1bf4d

File tree

3 files changed

+6
-20
lines changed

3 files changed

+6
-20
lines changed

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

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,19 +1945,6 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] {
19451945
true
19461946
}
19471947
case (AppliedType(tycon1, args1), AppliedType(tycon2, args2)) if tycon1 == tycon2 =>
1948-
// Unboxed xs.zip(ys).zip(zs).forall { case ((a, b), c) => f(a, b, c) }
1949-
def zip_zip_forall[A, B, C](xs: List[A], ys: List[B], zs: List[C])(f: (A, B, C) => Boolean): Boolean = {
1950-
xs match {
1951-
case x :: xs => ys match {
1952-
case y :: ys => zs match {
1953-
case z :: zs => f(x, y, z) && zip_zip_forall(xs, ys, zs)(f)
1954-
case _ => true
1955-
}
1956-
case _ => true
1957-
}
1958-
case _ => true
1959-
}
1960-
}
19611948
def covariantIntersecting(tp1: Type, tp2: Type, tparam: TypeParamInfo): Boolean = {
19621949
intersecting(tp1, tp2) || {
19631950
// We still need to proof that `Nothing` is not a valid
@@ -1981,7 +1968,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] {
19811968
}
19821969
}
19831970

1984-
zip_zip_forall(args1, args2, tycon1.typeParams) {
1971+
(args1, args2, tycon1.typeParams).zipped.forall {
19851972
(arg1, arg2, tparam) =>
19861973
val v = tparam.paramVariance
19871974
if (v > 0)
@@ -1994,7 +1981,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] {
19941981
covariantIntersecting(arg1, arg2, tparam) && (isSameType(arg1, arg2) || {
19951982
// We can only trust a "no" from `isSameType` when both
19961983
// `arg1` and `arg2` are fully instantiated.
1997-
val fullyInstantiated = new TypeAccumulator[Boolean] {
1984+
def fullyInstantiated(tp: Type): Boolean = new TypeAccumulator[Boolean] {
19981985
override def apply(x: Boolean, t: Type) =
19991986
x && {
20001987
t match {
@@ -2003,9 +1990,8 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] {
20031990
case _ => foldOver(x, t)
20041991
}
20051992
}
2006-
}
2007-
!(fullyInstantiated.apply(true, arg1) &&
2008-
fullyInstantiated.apply(true, arg2))
1993+
}.apply(true, tp)
1994+
!(fullyInstantiated(arg1) && fullyInstantiated(arg2))
20091995
})
20101996
}
20111997
case (tp1: HKLambda, tp2: HKLambda) =>

library/src-3.x/scala/compiletime/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ package object compiletime {
1111
inline def constValue[T]: T = ???
1212

1313
type S[X <: Int] <: Int
14-
}
14+
}

tests/run/tuples1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ object Test extends App {
9494
val us0: 0 = size(())
9595
val x3s1: 3 = size0(x3)
9696
val us1: 0 = size0(())
97-
}
97+
}

0 commit comments

Comments
 (0)