@@ -34,7 +34,7 @@ import annotation.tailrec
3434import Implicits ._
3535import util .Stats .record
3636import config .Printers .{gadts , typr }
37- import config .Feature
37+ import config .Feature . _
3838import config .SourceVersion ._
3939import rewrites .Rewrites .patch
4040import NavigateAST ._
@@ -319,7 +319,7 @@ class Typer extends Namer
319319 ctx.errorOrMigrationWarning(
320320 AmbiguousReference (name, Definition , Inheritance , prevCtx)(using outer),
321321 posd.sourcePos)
322- if Feature . migrateTo3 then
322+ if migrateTo3 then
323323 patch(Span (posd.span.start),
324324 if prevCtx.owner == refctx.owner.enclosingClass then " this."
325325 else s " ${prevCtx.owner.name}.this. " )
@@ -348,7 +348,7 @@ class Typer extends Namer
348348 checkNoOuterDefs(found.denot, ctx, ctx)
349349 case _ =>
350350 else
351- if Feature . migrateTo3 && ! foundUnderScala2.exists then
351+ if migrateTo3 && ! foundUnderScala2.exists then
352352 foundUnderScala2 = checkNewOrShadowed(found, Definition , scala2pkg = true )
353353 if (defDenot.symbol.is(Package ))
354354 result = checkNewOrShadowed(previous orElse found, PackageClause )
@@ -1934,7 +1934,7 @@ class Typer extends Namer
19341934 ctx.phase.isTyper &&
19351935 cdef1.symbol.ne(defn.DynamicClass ) &&
19361936 cdef1.tpe.derivesFrom(defn.DynamicClass ) &&
1937- ! Feature . dynamicsEnabled
1937+ ! dynamicsEnabled
19381938 if (reportDynamicInheritance) {
19391939 val isRequired = parents1.exists(_.tpe.isRef(defn.DynamicClass ))
19401940 ctx.featureWarning(nme.dynamics.toString, " extension of type scala.Dynamic" , cls, isRequired, cdef.sourcePos)
@@ -2103,15 +2103,15 @@ class Typer extends Namer
21032103 case _ =>
21042104 val recovered = typed(qual)(using ctx.fresh.setExploreTyperState())
21052105 ctx.errorOrMigrationWarning(OnlyFunctionsCanBeFollowedByUnderscore (recovered.tpe.widen), tree.sourcePos)
2106- if (Feature . migrateTo3) {
2106+ if (migrateTo3) {
21072107 // Under -rewrite, patch `x _` to `(() => x)`
21082108 patch(Span (tree.span.start), " (() => " )
21092109 patch(Span (qual.span.end, tree.span.end), " )" )
21102110 return typed(untpd.Function (Nil , qual), pt)
21112111 }
21122112 }
21132113 nestedCtx.typerState.commit()
2114- if (ctx.settings.strict.value) {
2114+ if sourceVersion.isAtLeast(`3.1`) then
21152115 lazy val (prefix, suffix) = res match {
21162116 case Block (mdef @ DefDef (_, _, vparams :: Nil , _, _) :: Nil , _ : Closure ) =>
21172117 val arity = vparams.length
@@ -2123,12 +2123,11 @@ class Typer extends Namer
21232123 if ((prefix ++ suffix).isEmpty) " simply leave out the trailing ` _`"
21242124 else s " use ` $prefix<function> $suffix` instead "
21252125 ctx.errorOrMigrationWarning(i """ The syntax `<function> _` is no longer supported;
2126- |you can $remedy""" , tree.sourcePos)
2127- if ( Feature .migrateTo3) {
2126+ |you can $remedy""" , tree.sourcePos, `3.1` )
2127+ if sourceVersion.isMigrating then
21282128 patch(Span (tree.span.start), prefix)
21292129 patch(Span (qual.span.end, tree.span.end), suffix)
2130- }
2131- }
2130+ end if
21322131 res
21332132 }
21342133
@@ -2756,17 +2755,16 @@ class Typer extends Namer
27562755 case wtp : MethodOrPoly =>
27572756 def methodStr = methPart(tree).symbol.showLocated
27582757 if (matchingApply(wtp, pt))
2759- if (pt.args.lengthCompare(1 ) > 0 && isUnary(wtp) && Feature . autoTuplingEnabled)
2758+ if (pt.args.lengthCompare(1 ) > 0 && isUnary(wtp) && autoTuplingEnabled)
27602759 adapt(tree, pt.tupled, locked)
27612760 else
27622761 tree
27632762 else if (wtp.isContextualMethod)
27642763 def isContextBoundParams = wtp.stripPoly match
27652764 case MethodType (EvidenceParamName (_) :: _) => true
27662765 case _ => false
2767- if ctx.settings.migration.value && ctx.settings.strict.value
2768- && isContextBoundParams
2769- then // Under 3.1 and -migration, don't infer implicit arguments yet for parameters
2766+ if sourceVersion == `3.1-migration` && isContextBoundParams
2767+ then // Under 3.1-migration, don't infer implicit arguments yet for parameters
27702768 // coming from context bounds. Issue a warning instead and offer a patch.
27712769 ctx.migrationWarning(
27722770 em """ Context bounds will map to context parameters.
@@ -2928,7 +2926,7 @@ class Typer extends Namer
29282926 def isAutoApplied (sym : Symbol ): Boolean =
29292927 sym.isConstructor
29302928 || sym.matchNullaryLoosely
2931- || Feature . warnOnMigration(MissingEmptyArgumentList (sym), tree.sourcePos)
2929+ || warnOnMigration(MissingEmptyArgumentList (sym), tree.sourcePos)
29322930 && { patch(tree.span.endPos, " ()" ); true }
29332931
29342932 // Reasons NOT to eta expand:
@@ -3266,7 +3264,7 @@ class Typer extends Namer
32663264 case ref : TermRef =>
32673265 pt match {
32683266 case pt : FunProto
3269- if pt.args.lengthCompare(1 ) > 0 && isUnary(ref) && Feature . autoTuplingEnabled =>
3267+ if pt.args.lengthCompare(1 ) > 0 && isUnary(ref) && autoTuplingEnabled =>
32703268 adapt(tree, pt.tupled, locked)
32713269 case _ =>
32723270 adaptOverloaded(ref)
0 commit comments