@@ -4,7 +4,7 @@ package transform
4
4
import util .Positions ._
5
5
import MegaPhase .MiniPhase
6
6
import core ._
7
- import Contexts .Context , Types ._ , Decorators ._ , Symbols ._ , typer ._
7
+ import Contexts .Context , Types ._ , Decorators ._ , Symbols ._ , typer ._ , ast . _
8
8
import TypeUtils ._ , Flags ._
9
9
import config .Printers .{ transforms => debug }
10
10
@@ -51,8 +51,8 @@ object Checkable {
51
51
* 4. if `P = Array[T]`, checkable(E, T) where `E` is the element type of `X`, defaults to `Any`.
52
52
* 5. if `P` is `pre.F[Ts]` and `pre.F` refers to a class which is not `Array`:
53
53
* (a) replace `Ts` with fresh type variables `Xs`
54
- * (b) instantiate `Xs` with the constraint ` pre.F[Xs] <:< X`
55
- * (c) `pre.F[Xs ] <:< P`
54
+ * (b) ` pre.F[Xs] <:< X` with `Xs` instantiated as `Es `
55
+ * (c) `pre.F[Es ] <:< P`
56
56
* 6. if `P = T1 | T2` or `P = T1 & T2`, checkable(X, T1) && checkable(X, T2).
57
57
* 7. if `P` is a refinement type, FALSE
58
58
* 8. otherwise, TRUE
@@ -72,13 +72,14 @@ object Checkable {
72
72
73
73
def isClassDetermined (X : Type , P : AppliedType )(implicit ctx : Context ) = {
74
74
val AppliedType (tycon, _) = P
75
- val tvars = tycon.typeParams.map { tparam => newTypeVar(tparam.paramInfo.bounds) }
75
+ val typeLambda = tycon.ensureHK.asInstanceOf [TypeLambda ]
76
+ val tvars = constrained(typeLambda, untpd.EmptyTree , alwaysAddTypeVars = true )._2.map(_.tpe)
76
77
val P1 = tycon.appliedTo(tvars)
77
78
78
79
debug.println(" P1 : " + P1 .show)
79
80
debug.println(" X : " + X .show)
80
81
81
- ! (P1 <:< X ) || {
82
+ (P1 <:< X ) && {
82
83
val res = isFullyDefined(P1 , ForceDegree .noBottom) && P1 <:< P
83
84
debug.println(" P1 <:< P = " + res)
84
85
res
0 commit comments