@@ -29,17 +29,17 @@ object Inferencing {
2929 * but only if the overall result of `isFullyDefined` is `true`.
3030 * Variables that are successfully minimized do not count as uninstantiated.
3131 */
32- def isFullyDefined (tp : Type , force : ForceDegree .Value )(implicit ctx : Context ): Boolean = {
32+ def isFullyDefined (tp : Type , force : ForceDegree .Value )(using Context ): Boolean = {
3333 val nestedCtx = ctx.fresh.setNewTyperState()
34- val result = new IsFullyDefinedAccumulator (force)(nestedCtx).process(tp)
34+ val result = new IsFullyDefinedAccumulator (force)(using nestedCtx).process(tp)
3535 if (result) nestedCtx.typerState.commit()
3636 result
3737 }
3838
3939 /** The fully defined type, where all type variables are forced.
4040 * Throws an error if type contains wildcards.
4141 */
42- def fullyDefinedType (tp : Type , what : String , span : Span )(implicit ctx : Context ): Type =
42+ def fullyDefinedType (tp : Type , what : String , span : Span )(using Context ): Type =
4343 if (isFullyDefined(tp, ForceDegree .all)) tp
4444 else throw new Error (i " internal error: type of $what $tp is not fully defined, pos = $span" ) // !!! DEBUG
4545
@@ -52,7 +52,7 @@ object Inferencing {
5252 * If none of (1) - (4) applies, the type variable is left uninstantiated.
5353 * The method is called to instantiate type variables before an implicit search.
5454 */
55- def instantiateSelected (tp : Type , tvars : List [Type ])(implicit ctx : Context ): Unit =
55+ def instantiateSelected (tp : Type , tvars : List [Type ])(using Context ): Unit =
5656 if (tvars.nonEmpty)
5757 IsFullyDefinedAccumulator (
5858 ForceDegree .Value (tvars.contains, IfBottom .flip), minimizeSelected = true
@@ -61,7 +61,7 @@ object Inferencing {
6161 /** Instantiate any type variables in `tp` whose bounds contain a reference to
6262 * one of the parameters in `tparams` or `vparamss`.
6363 */
64- def instantiateDependent (tp : Type , tparams : List [Symbol ], vparamss : List [List [Symbol ]])(implicit ctx : Context ): Unit = {
64+ def instantiateDependent (tp : Type , tparams : List [Symbol ], vparamss : List [List [Symbol ]])(using Context ): Unit = {
6565 val dependentVars = new TypeAccumulator [Set [TypeVar ]] {
6666 @ threadUnsafe lazy val params = (tparams :: vparamss).flatten
6767 def apply (tvars : Set [TypeVar ], tp : Type ) = tp match {
@@ -108,7 +108,7 @@ object Inferencing {
108108 * to their upper bound.
109109 */
110110 private class IsFullyDefinedAccumulator (force : ForceDegree .Value , minimizeSelected : Boolean = false )
111- (implicit ctx : Context ) extends TypeAccumulator [Boolean ] {
111+ (using Context ) extends TypeAccumulator [Boolean ] {
112112
113113 private def instantiate (tvar : TypeVar , fromBelow : Boolean ): Type = {
114114 val inst = tvar.instantiate(fromBelow)
@@ -167,7 +167,7 @@ object Inferencing {
167167 * instantiate the type parameter to the lower bound's approximation
168168 * (approximation because of possible F-bounds).
169169 */
170- def replaceSingletons (tp : Type )(implicit ctx : Context ): Unit = {
170+ def replaceSingletons (tp : Type )(using Context ): Unit = {
171171 val tr = new TypeTraverser {
172172 def traverse (tp : Type ): Unit = {
173173 tp match {
@@ -190,7 +190,7 @@ object Inferencing {
190190 }
191191
192192 /** If `tree` has a type lambda type, infer its type parameters by comparing with expected type `pt` */
193- def inferTypeParams (tree : Tree , pt : Type )(implicit ctx : Context ): Tree = tree.tpe match {
193+ def inferTypeParams (tree : Tree , pt : Type )(using Context ): Tree = tree.tpe match {
194194 case tl : TypeLambda =>
195195 val (tl1, tvars) = constrained(tl, tree)
196196 var tree1 = AppliedTypeTree (tree.withType(tl1), tvars)
@@ -201,7 +201,7 @@ object Inferencing {
201201 tree
202202 }
203203
204- def isSkolemFree (tp : Type )(implicit ctx : Context ): Boolean =
204+ def isSkolemFree (tp : Type )(using Context ): Boolean =
205205 ! tp.existsPart(_.isInstanceOf [SkolemType ])
206206
207207 /** The list of uninstantiated type variables bound by some prefix of type `T` which
@@ -212,7 +212,7 @@ object Inferencing {
212212 * - The prefix `p` of a selection `p.f`.
213213 * - The result expression `e` of a block `{s1; .. sn; e}`.
214214 */
215- def tvarsInParams (tree : Tree , locked : TypeVars )(implicit ctx : Context ): List [TypeVar ] = {
215+ def tvarsInParams (tree : Tree , locked : TypeVars )(using Context ): List [TypeVar ] = {
216216 @ tailrec def boundVars (tree : Tree , acc : List [TypeVar ]): List [TypeVar ] = tree match {
217217 case Apply (fn, _) => boundVars(fn, acc)
218218 case TypeApply (fn, targs) =>
@@ -252,7 +252,7 @@ object Inferencing {
252252 * -1 (minimize) if constraint is uniformly from below,
253253 * 0 if unconstrained, or constraint is from below and above.
254254 */
255- private def instDirection (param : TypeParamRef )(implicit ctx : Context ): Int = {
255+ private def instDirection (param : TypeParamRef )(using Context ): Int = {
256256 val constrained = ctx.typeComparer.fullBounds(param)
257257 val original = param.binder.paramInfos(param.paramNum)
258258 val cmp = ctx.typeComparer
@@ -267,7 +267,7 @@ object Inferencing {
267267 * class type reference where the class has a companion module, a reference to
268268 * that companion module. Otherwise NoType
269269 */
270- def companionRef (tp : Type )(implicit ctx : Context ): Type =
270+ def companionRef (tp : Type )(using Context ): Type =
271271 tp.underlyingClassRef(refinementOK = true ) match {
272272 case tp : TypeRef =>
273273 val companion = tp.classSymbol.companionModule
@@ -281,7 +281,7 @@ object Inferencing {
281281 * @return The list of type symbols that were created
282282 * to instantiate undetermined type variables that occur non-variantly
283283 */
284- def maximizeType (tp : Type , span : Span , fromScala2x : Boolean )(implicit ctx : Context ): List [Symbol ] = {
284+ def maximizeType (tp : Type , span : Span , fromScala2x : Boolean )(using Context ): List [Symbol ] = {
285285 Stats .record(" maximizeType" )
286286 val vs = variances(tp)
287287 val patternBound = new mutable.ListBuffer [Symbol ]
@@ -325,7 +325,7 @@ object Inferencing {
325325 *
326326 * we want to instantiate U to x.type right away. No need to wait further.
327327 */
328- private def variances (tp : Type )(implicit ctx : Context ): VarianceMap = {
328+ private def variances (tp : Type )(using Context ): VarianceMap = {
329329 Stats .record(" variances" )
330330 val constraint = ctx.typerState.constraint
331331
@@ -400,7 +400,7 @@ trait Inferencing { this: Typer =>
400400 * Then `Y` also occurs co-variantly in `T` because it needs to be minimized in order to constrain
401401 * `T` the least. See `variances` for more detail.
402402 */
403- def interpolateTypeVars (tree : Tree , pt : Type , locked : TypeVars )(implicit ctx : Context ): tree.type = {
403+ def interpolateTypeVars (tree : Tree , pt : Type , locked : TypeVars )(using Context ): tree.type = {
404404 val state = ctx.typerState
405405
406406 // Note that some variables in `locked` might not be in `state.ownedVars`
0 commit comments