File tree 2 files changed +7
-4
lines changed
compiler/src/dotty/tools/dotc/typer 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -108,12 +108,15 @@ object Checking {
108
108
* in order to prevent scenarios that lead to self application of
109
109
* types. Self application needs to be avoided since it can lead to stack overflows.
110
110
* Test cases are neg/i2771.scala and neg/i2771b.scala.
111
+ * A NoType paramBounds is used as a sign that checking should be suppressed.
111
112
*/
112
- def preCheckKind (arg : Tree , paramBounds : TypeBounds )(implicit ctx : Context ): Tree =
113
- if (arg.tpe.widen.isRef(defn.NothingClass ) || arg.tpe.hasSameKindAs(paramBounds.hi)) arg
113
+ def preCheckKind (arg : Tree , paramBounds : Type )(implicit ctx : Context ): Tree =
114
+ if (arg.tpe.widen.isRef(defn.NothingClass ) ||
115
+ ! paramBounds.exists ||
116
+ arg.tpe.hasSameKindAs(paramBounds.bounds.hi)) arg
114
117
else errorTree(arg, em " Type argument ${arg.tpe} has not the same kind as its bound $paramBounds" )
115
118
116
- def preCheckKinds (args : List [Tree ], paramBoundss : List [TypeBounds ])(implicit ctx : Context ): List [Tree ] = {
119
+ def preCheckKinds (args : List [Tree ], paramBoundss : List [Type ])(implicit ctx : Context ): List [Tree ] = {
117
120
val args1 = args.zipWithConserve(paramBoundss)(preCheckKind)
118
121
args1 ++ args.drop(paramBoundss.length)
119
122
// add any arguments that do not correspond to a parameter back,
Original file line number Diff line number Diff line change @@ -1236,7 +1236,7 @@ class Typer extends Namer
1236
1236
case (tparam, TypeBoundsTree (EmptyTree , EmptyTree )) =>
1237
1237
// if type argument is a wildcard, suppress kind checking since
1238
1238
// there is no real argument.
1239
- TypeBounds .empty
1239
+ NoType
1240
1240
case (tparam, _) =>
1241
1241
tparam.paramInfo.bounds
1242
1242
}
You can’t perform that action at this time.
0 commit comments