@@ -40,7 +40,7 @@ import annotation.tailrec
4040import Implicits .*
4141import util .Stats .record
4242import config .Printers .{gadts , typr }
43- import config .Feature , Feature .{migrateTo3 , modularity , sourceVersion , warnOnMigration }
43+ import config .Feature , Feature .{migrateTo3 , sourceVersion , warnOnMigration }
4444import config .SourceVersion .*
4545import rewrites .Rewrites , Rewrites .patch
4646import staging .StagingLevel
@@ -1142,7 +1142,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
11421142 if templ1.parents.isEmpty
11431143 && isFullyDefined(pt, ForceDegree .flipBottom)
11441144 && isSkolemFree(pt)
1145- && isEligible(pt.underlyingClassRef(refinementOK = Feature .enabled(modularity)))
1145+ && isEligible(pt.underlyingClassRef(refinementOK = Feature .enabled(Feature . modularity)))
11461146 then
11471147 templ1 = cpy.Template (templ)(parents = untpd.TypeTree (pt) :: Nil )
11481148 for case parent : RefTree <- templ1.parents do
@@ -1717,7 +1717,11 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
17171717 typedFunctionType(desugar.makeFunctionWithValDefs(tree, pt), pt)
17181718 else
17191719 val funSym = defn.FunctionSymbol (numArgs, isContextual, isImpure)
1720- val result = typed(cpy.AppliedTypeTree (tree)(untpd.TypeTree (funSym.typeRef), args :+ body), pt)
1720+ val args1 = args.mapConserve {
1721+ case cb : untpd.ContextBoundTypeTree => typed(cb)
1722+ case t => t
1723+ }
1724+ val result = typed(cpy.AppliedTypeTree (tree)(untpd.TypeTree (funSym.typeRef), args1 :+ body), pt)
17211725 // if there are any erased classes, we need to re-do the typecheck.
17221726 result match
17231727 case r : AppliedTypeTree if r.args.exists(_.tpe.isErasedClass) =>
@@ -2448,12 +2452,12 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
24482452 if tycon.tpe.typeParams.nonEmpty then
24492453 val tycon0 = tycon.withType(tycon.tpe.etaCollapse)
24502454 typed(untpd.AppliedTypeTree (spliced(tycon0), tparam :: Nil ))
2451- else if Feature .enabled(modularity) && tycon.tpe.member(tpnme.Self ).symbol.isAbstractOrParamType then
2455+ else if Feature .enabled(Feature . modularity) && tycon.tpe.member(tpnme.Self ).symbol.isAbstractOrParamType then
24522456 val tparamSplice = untpd.TypedSplice (typedExpr(tparam))
24532457 typed(untpd.RefinedTypeTree (spliced(tycon), List (untpd.TypeDef (tpnme.Self , tparamSplice))))
24542458 else
24552459 def selfNote =
2456- if Feature .enabled(modularity) then
2460+ if Feature .enabled(Feature . modularity) then
24572461 " and\n does not have an abstract type member named `Self` either"
24582462 else " "
24592463 errorTree(tree,
@@ -2472,7 +2476,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
24722476 val TypeDef (_, impl : Template ) = typed(refineClsDef): @ unchecked
24732477 val refinements1 = impl.body
24742478 val seen = mutable.Set [Symbol ]()
2475- for ( refinement <- refinements1) { // TODO: get clarity whether we want to enforce these conditions
2479+ for refinement <- refinements1 do // TODO: get clarity whether we want to enforce these conditions
24762480 typr.println(s " adding refinement $refinement" )
24772481 checkRefinementNonCyclic(refinement, refineCls, seen)
24782482 val rsym = refinement.symbol
@@ -2486,7 +2490,6 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
24862490 val member = refineCls.info.member(rsym.name)
24872491 if (member.isOverloaded)
24882492 report.error(OverloadInRefinement (rsym), refinement.srcPos)
2489- }
24902493 assignType(cpy.RefinedTypeTree (tree)(tpt1, refinements1), tpt1, refinements1, refineCls)
24912494 }
24922495
@@ -4701,7 +4704,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
47014704 cpy.Ident (qual)(qual.symbol.name.sourceModuleName.toTypeName)
47024705 case _ =>
47034706 errorTree(tree, em " cannot convert from $tree to an instance creation expression " )
4704- val tycon = ctorResultType.underlyingClassRef(refinementOK = Feature .enabled(modularity))
4707+ val tycon = ctorResultType.underlyingClassRef(refinementOK = Feature .enabled(Feature . modularity))
47054708 typed(
47064709 untpd.Select (
47074710 untpd.New (untpd.TypedSplice (tpt.withType(tycon))),
0 commit comments