Skip to content

Commit f7d7b65

Browse files
committed
Don't dealias when deciding which arguments to defer for subtype checking
Fixes #10078
1 parent 6a88601 commit f7d7b65

File tree

5 files changed

+10
-2
lines changed

5 files changed

+10
-2
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1714,8 +1714,8 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
17141714
* comparison will instantiate or constrain type variables first.
17151715
*/
17161716
def isIncomplete(arg1: Type, arg2: Type): Boolean =
1717-
val arg1d = arg1.strippedDealias
1718-
val arg2d = arg2.strippedDealias
1717+
val arg1d = arg1.stripped
1718+
val arg2d = arg2.stripped
17191719
(v >= 0) && (arg1d.isInstanceOf[AndType] || arg2d.isInstanceOf[OrType])
17201720
||
17211721
(v <= 0) && (arg1d.isInstanceOf[OrType] || arg2d.isInstanceOf[AndType])
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public abstract class AbstractShapeBuilder<B extends AbstractShapeBuilder<B, S>, S extends Shape> {
2+
abstract public B addTrait(Trait trait);
3+
}

tests/pos/i20078/Shape.java

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public interface Shape {}

tests/pos/i20078/Test.scala

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@main def Test =
2+
val builder: AbstractShapeBuilder[? <: AbstractShapeBuilder[?, ?], ? <: Shape] = ???
3+
List.empty[Trait].foreach(builder.addTrait(_))

tests/pos/i20078/Trait.java

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public interface Trait {}

0 commit comments

Comments
 (0)