Skip to content

Commit 2e38f70

Browse files
committed
ignore GADT related issues for now
1 parent e8c83f3 commit 2e38f70

File tree

2 files changed

+3
-23
lines changed

2 files changed

+3
-23
lines changed

compiler/src/dotty/tools/dotc/transform/IsInstanceOfChecker.scala

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ object Checkable {
5858
* 4. if `P = Array[T]`, checkable(E, T) where `E` is the element type of `X`, defaults to `Any`.
5959
* 5. if `P` is `pre.F[Ts]` and `pre.F` refers to a class which is not `Array`:
6060
* (a) replace `Ts` with fresh type variables `Xs`
61-
* (b) constrain `Xs` with `pre.F[Xs] <:< X`,
62-
* if `X` cannot be uniquely determined, instantiate `X` with fresh type symbol.
61+
* (b) constrain `Xs` with `pre.F[Xs] <:< X`
6362
* (c) instantiate Xs and check `pre.F[Xs] <:< P`
6463
* 6. if `P = T1 | T2` or `P = T1 & T2`, checkable(X, T1) && checkable(X, T2).
6564
* 7. if `P` is a refinement type, FALSE
@@ -101,26 +100,7 @@ object Checkable {
101100

102101
P1 <:< X // may fail, ignore
103102

104-
// 3324g.scala cannot happen in such cases
105-
def canInstantiate =
106-
tycon.classSymbol.is(Final) ||
107-
!X.classSymbol.is(Trait) ||
108-
X.classSymbol.typeParams.isEmpty
109-
110-
if (canInstantiate)
111-
maximizeType(P1, pos, fromScala2x = true) // use `fromScala2x = true` to force instantiate invariant tvars
112-
else
113-
tvars.foreach { case tvar: TypeVar =>
114-
val bounds = ctx.typerState.constraint.entry(tvar.origin)
115-
if (bounds.loBound =:= bounds.hiBound)
116-
tvar.instantiateWith(bounds.loBound)
117-
else { // 3324g.scala
118-
val wildCard = ctx.newSymbol(ctx.owner, WildcardParamName.fresh().toTypeName, Case, tvar.origin.underlying, coord = pos)
119-
tvar.instantiateWith(wildCard.typeRef)
120-
}
121-
}
122-
123-
val res = P1 <:< P
103+
val res = isFullyDefined(P1, ForceDegree.noBottom) && P1 <:< P
124104
debug.println("P1 : " + P1)
125105
debug.println("P1 <:< P = " + res)
126106

tests/neg-custom-args/isInstanceOf/3324g.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Test {
1212
}
1313

1414
def quux[T](a: A[T]): Unit = a match {
15-
case _: B[T] => // error
15+
case _: B[T] => // err-or: cannot handle this for now
1616
}
1717

1818
quux(new C[Int])

0 commit comments

Comments
 (0)