File tree Expand file tree Collapse file tree 4 files changed +16
-10
lines changed Expand file tree Collapse file tree 4 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -631,11 +631,14 @@ class TypeComparer(initctx: Context) extends DotClass {
631
631
def comparePolyParam = {
632
632
tp1 == tp2 ||
633
633
isSubTypeWhenFrozen(bounds(tp1).hi, tp2) || {
634
- if (! frozenConstraint &&
635
- (tp2 isRef defn.NothingClass ) &&
636
- ctx.typerState.isGlobalCommittable)
637
- ctx.log(s " !!! instantiating to Nothing: $tp1" )
638
- if (isConstrained(tp1)) addConstraint(tp1, tp2, fromBelow = false )
634
+ if (isConstrained(tp1))
635
+ addConstraint(tp1, tp2, fromBelow = false ) && {
636
+ if ((! frozenConstraint) &&
637
+ (tp2 isRef defn.NothingClass ) &&
638
+ ctx.typerState.isGlobalCommittable)
639
+ ctx.log(s " !!! instantiated to Nothing: $tp1, constraint = ${constraint.show}" )
640
+ true
641
+ }
639
642
else (ctx.mode is Mode .TypevarsMissContext ) || thirdTry(tp1, tp2)
640
643
}
641
644
}
Original file line number Diff line number Diff line change @@ -828,7 +828,7 @@ object Types {
828
828
def variances (include : TypeVar => Boolean )(implicit ctx : Context ): VarianceMap = track(" variances" ) {
829
829
val accu = new TypeAccumulator [VarianceMap ] {
830
830
def apply (vmap : VarianceMap , t : Type ): VarianceMap = t match {
831
- case t : TypeVar if include(t) =>
831
+ case t : TypeVar if ! t.isInstantiated && include(t) =>
832
832
val v = vmap(t)
833
833
if (v == null ) vmap.updated(t, variance)
834
834
else if (v == variance) vmap
@@ -852,9 +852,9 @@ object Types {
852
852
class Simplify extends TypeMap {
853
853
def apply (tp : Type ): Type = tp match {
854
854
case AndType (l, r) =>
855
- mapOver (l) & mapOver (r)
855
+ this (l) & this (r)
856
856
case OrType (l, r) =>
857
- mapOver (l) | mapOver (r)
857
+ this (l) | this (r)
858
858
case tp : PolyParam =>
859
859
ctx.typerState.constraint.typeVarOfParam(tp) orElse tp
860
860
case _ =>
Original file line number Diff line number Diff line change @@ -1225,8 +1225,8 @@ class Typer extends Namer with Applications with Implicits {
1225
1225
if (tree.tpe <:< pt) tree
1226
1226
else if (ctx.mode is Mode .Pattern ) tree // no subtype check for pattern
1227
1227
else {
1228
- typr.println(s " adapt to subtype ${tree.tpe} !<:< $pt " )
1229
- typr.println(TypeComparer .explained(implicit ctx => tree.tpe <:< pt))
1228
+ typr.println(s " adapt to subtype ${tree.tpe.show } !<:< ${pt.show} " )
1229
+ // typr.println(TypeComparer.explained(implicit ctx => tree.tpe <:< pt))
1230
1230
adaptToSubType(wtp)
1231
1231
}
1232
1232
}
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ import scala.collection.generic.CanBuildFrom
2
2
3
3
object collections {
4
4
5
+ val arr = Array (" a" , " b" )
6
+ val aa = arr ++ arr
7
+
5
8
List (1 , 2 , 3 ) map (x => 2 )
6
9
7
10
val s = Set (1 , 2 , 3 )
You can’t perform that action at this time.
0 commit comments