@@ -51,6 +51,7 @@ import NullOpsDecorator.*
5151import cc .CheckCaptures
5252import config .Config
5353import config .MigrationVersion
54+ import Migrations .*
5455
5556import scala .annotation .constructorOnly
5657import dotty .tools .dotc .rewrites .Rewrites
@@ -3137,13 +3138,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
31373138 case tree : untpd.TypeDef =>
31383139 // separate method to keep dispatching method `typedNamed` short which might help the JIT
31393140 def typedTypeOrClassDef : Tree =
3140- if tree.name eq tpnme.? then
3141- val addendum = if sym.owner.is(TypeParam )
3142- then " , use `_` to denote a higher-kinded type parameter"
3143- else " "
3144- val namePos = tree.sourcePos.withSpan(tree.nameSpan)
3145- report.errorOrMigrationWarning(
3146- em " `?` is not a valid type name $addendum" , namePos, MigrationVersion .Scala2to3 )
3141+ migrateKindProjectorQMark(tree, sym)
31473142 if tree.isClassDef then
31483143 typedClassDef(tree, sym.asClass)(using ctx.localContext(tree, sym))
31493144 else
@@ -3818,24 +3813,12 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
38183813 def adaptToArgs (wtp : Type , pt : FunProto ): Tree = wtp match {
38193814 case wtp : MethodOrPoly =>
38203815 def methodStr = methPart(tree).symbol.showLocated
3821- if (matchingApply(wtp, pt))
3816+ if matchingApply(wtp, pt) then
3817+ migrateContextBoundParams(tree, wtp, pt)
38223818 if needsTupledDual(wtp, pt) then adapt(tree, pt.tupledDual, locked)
38233819 else tree
38243820 else if wtp.isContextualMethod then
3825- def isContextBoundParams = wtp.stripPoly match
3826- case MethodType (ContextBoundParamName (_) :: _) => true
3827- case _ => false
3828- if sourceVersion == `future-migration` && isContextBoundParams && pt.args.nonEmpty
3829- then // Under future-migration, don't infer implicit arguments yet for parameters
3830- // coming from context bounds. Issue a warning instead and offer a patch.
3831- def rewriteMsg = Message .rewriteNotice(" This code" , `future-migration`)
3832- report.migrationWarning(
3833- em """ Context bounds will map to context parameters.
3834- |A `using` clause is needed to pass explicit arguments to them. $rewriteMsg""" , tree.srcPos)
3835- patch(Span (pt.args.head.span.start), " using " )
3836- tree
3837- else
3838- adaptNoArgs(wtp) // insert arguments implicitly
3821+ adaptNoArgs(wtp) // insert arguments implicitly
38393822 else if (tree.symbol.isPrimaryConstructor && tree.symbol.info.firstParamTypes.isEmpty)
38403823 readapt(tree.appliedToNone) // insert () to primary constructors
38413824 else
@@ -4441,7 +4424,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
44414424 protected def matchingApply (methType : MethodOrPoly , pt : FunProto )(using Context ): Boolean =
44424425 val isUsingApply = pt.applyKind == ApplyKind .Using
44434426 methType.isContextualMethod == isUsingApply
4444- || methType.isImplicitMethod && isUsingApply // for a transition allow `with ` arguments for regular implicit parameters
4427+ || methType.isImplicitMethod && isUsingApply // for a transition allow `using ` arguments for regular implicit parameters
44454428
44464429 /** Check that `tree == x: pt` is typeable. Used when checking a pattern
44474430 * against a selector of type `pt`. This implementation accounts for
0 commit comments