@@ -51,6 +51,7 @@ import NullOpsDecorator.*
51
51
import cc .CheckCaptures
52
52
import config .Config
53
53
import config .MigrationVersion
54
+ import Migrations .*
54
55
55
56
import scala .annotation .constructorOnly
56
57
import dotty .tools .dotc .rewrites .Rewrites
@@ -3137,13 +3138,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
3137
3138
case tree : untpd.TypeDef =>
3138
3139
// separate method to keep dispatching method `typedNamed` short which might help the JIT
3139
3140
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)
3147
3142
if tree.isClassDef then
3148
3143
typedClassDef(tree, sym.asClass)(using ctx.localContext(tree, sym))
3149
3144
else
@@ -3818,24 +3813,12 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
3818
3813
def adaptToArgs (wtp : Type , pt : FunProto ): Tree = wtp match {
3819
3814
case wtp : MethodOrPoly =>
3820
3815
def methodStr = methPart(tree).symbol.showLocated
3821
- if (matchingApply(wtp, pt))
3816
+ if matchingApply(wtp, pt) then
3817
+ migrateContextBoundParams(tree, wtp, pt)
3822
3818
if needsTupledDual(wtp, pt) then adapt(tree, pt.tupledDual, locked)
3823
3819
else tree
3824
3820
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
3839
3822
else if (tree.symbol.isPrimaryConstructor && tree.symbol.info.firstParamTypes.isEmpty)
3840
3823
readapt(tree.appliedToNone) // insert () to primary constructors
3841
3824
else
@@ -4441,7 +4424,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
4441
4424
protected def matchingApply (methType : MethodOrPoly , pt : FunProto )(using Context ): Boolean =
4442
4425
val isUsingApply = pt.applyKind == ApplyKind .Using
4443
4426
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
4445
4428
4446
4429
/** Check that `tree == x: pt` is typeable. Used when checking a pattern
4447
4430
* against a selector of type `pt`. This implementation accounts for
0 commit comments