Skip to content

Commit 362beb5

Browse files
committed
Revert unnecessary changes
1 parent bd9f4d0 commit 362beb5

File tree

3 files changed

+10
-19
lines changed

3 files changed

+10
-19
lines changed

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

+9-14
Original file line numberDiff line numberDiff line change
@@ -2564,18 +2564,15 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
25642564
case _ =>
25652565
tp
25662566

2567-
private def andTypeGen(tp1orig: Type, tp2orig: Type, op: (Type, Type) => Type,
2568-
original: (Type, Type) => Type = _ & _, isErased: Boolean = ctx.erasedTypes): Type = trace(s"andTypeGen(${tp1orig.show}, ${tp2orig.show})", subtyping, show = true) {
2569-
val tp1 = tp1orig.stripFlexible
2570-
val tp2 = tp2orig.stripFlexible
2567+
private def andTypeGen(tp1: Type, tp2: Type, op: (Type, Type) => Type,
2568+
original: (Type, Type) => Type = _ & _, isErased: Boolean = ctx.erasedTypes): Type = trace(s"andTypeGen(${tp1.show}, ${tp2.show})", subtyping, show = true) {
25712569
val t1 = distributeAnd(tp1, tp2)
2572-
val ret =
2573-
if t1.exists then t1
2574-
else
2575-
val t2 = distributeAnd(tp2, tp1)
2576-
if t2.exists then t2
2577-
else if isErased then erasedGlb(tp1, tp2)
2578-
else liftIfHK(tp1, tp2, op, original, _ | _)
2570+
if (t1.exists) t1
2571+
else {
2572+
val t2 = distributeAnd(tp2, tp1)
2573+
if (t2.exists) t2
2574+
else if (isErased) erasedGlb(tp1, tp2)
2575+
else liftIfHK(tp1, tp2, op, original, _ | _)
25792576
// The ` | ` on variances is needed since variances are associated with bounds
25802577
// not lambdas. Example:
25812578
//
@@ -2585,9 +2582,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
25852582
//
25862583
// Here, `F` is treated as bivariant in `O`. That is, only bivariant implementation
25872584
// of `F` are allowed. See neg/hk-variance2s.scala test.
2588-
2589-
if tp1orig.isInstanceOf[FlexibleType] && tp2orig.isInstanceOf[FlexibleType]
2590-
then FlexibleType(ret) else ret
2585+
}
25912586
}
25922587

25932588
/** Form a normalized conjunction of two types.

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

-4
Original file line numberDiff line numberDiff line change
@@ -1620,10 +1620,6 @@ object Types extends TypeUtils {
16201620
/** If this is a repeated type, its element type, otherwise the type itself */
16211621
def repeatedToSingle(using Context): Type = this match {
16221622
case tp @ ExprType(tp1) => tp.derivedExprType(tp1.repeatedToSingle)
1623-
case tp: FlexibleType =>
1624-
// The flexible type is handled here because the varargs from Java can be nullable.
1625-
val underlyingSingle = tp.underlying.repeatedToSingle
1626-
if underlyingSingle ne tp.underlying then underlyingSingle else tp
16271623
case _ => if (isRepeatedParam) this.argTypesHi.head else this
16281624
}
16291625

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ trait Applications extends Compatibility {
644644
missingArg(n)
645645
}
646646

647-
if formal.isRepeatedParam then
647+
if (formal.isRepeatedParam)
648648
args match {
649649
case arg :: Nil if isVarArg(arg) =>
650650
addTyped(arg)

0 commit comments

Comments
 (0)