@@ -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
@@ -1145,7 +1145,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
11451145 if templ1.parents.isEmpty
11461146 && isFullyDefined(pt, ForceDegree .flipBottom)
11471147 && isSkolemFree(pt)
1148- && isEligible(pt.underlyingClassRef(refinementOK = Feature .enabled(modularity)))
1148+ && isEligible(pt.underlyingClassRef(refinementOK = Feature .enabled(Feature . modularity)))
11491149 then
11501150 templ1 = cpy.Template (templ)(parents = untpd.TypeTree (pt) :: Nil )
11511151 for case parent : RefTree <- templ1.parents do
@@ -1720,7 +1720,11 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
17201720 typedFunctionType(desugar.makeFunctionWithValDefs(tree, pt), pt)
17211721 else
17221722 val funSym = defn.FunctionSymbol (numArgs, isContextual, isImpure)
1723- val result = typed(cpy.AppliedTypeTree (tree)(untpd.TypeTree (funSym.typeRef), args :+ body), pt)
1723+ val args1 = args.mapConserve {
1724+ case cb : untpd.ContextBoundTypeTree => typed(cb)
1725+ case t => t
1726+ }
1727+ val result = typed(cpy.AppliedTypeTree (tree)(untpd.TypeTree (funSym.typeRef), args1 :+ body), pt)
17241728 // if there are any erased classes, we need to re-do the typecheck.
17251729 result match
17261730 case r : AppliedTypeTree if r.args.exists(_.tpe.isErasedClass) =>
@@ -2451,12 +2455,12 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
24512455 if tycon.tpe.typeParams.nonEmpty then
24522456 val tycon0 = tycon.withType(tycon.tpe.etaCollapse)
24532457 typed(untpd.AppliedTypeTree (spliced(tycon0), tparam :: Nil ))
2454- else if Feature .enabled(modularity) && tycon.tpe.member(tpnme.Self ).symbol.isAbstractOrParamType then
2458+ else if Feature .enabled(Feature . modularity) && tycon.tpe.member(tpnme.Self ).symbol.isAbstractOrParamType then
24552459 val tparamSplice = untpd.TypedSplice (typedExpr(tparam))
24562460 typed(untpd.RefinedTypeTree (spliced(tycon), List (untpd.TypeDef (tpnme.Self , tparamSplice))))
24572461 else
24582462 def selfNote =
2459- if Feature .enabled(modularity) then
2463+ if Feature .enabled(Feature . modularity) then
24602464 " and\n does not have an abstract type member named `Self` either"
24612465 else " "
24622466 errorTree(tree,
@@ -2475,7 +2479,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
24752479 val TypeDef (_, impl : Template ) = typed(refineClsDef): @ unchecked
24762480 val refinements1 = impl.body
24772481 val seen = mutable.Set [Symbol ]()
2478- for ( refinement <- refinements1) { // TODO: get clarity whether we want to enforce these conditions
2482+ for refinement <- refinements1 do // TODO: get clarity whether we want to enforce these conditions
24792483 typr.println(s " adding refinement $refinement" )
24802484 checkRefinementNonCyclic(refinement, refineCls, seen)
24812485 val rsym = refinement.symbol
@@ -2489,7 +2493,6 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
24892493 val member = refineCls.info.member(rsym.name)
24902494 if (member.isOverloaded)
24912495 report.error(OverloadInRefinement (rsym), refinement.srcPos)
2492- }
24932496 assignType(cpy.RefinedTypeTree (tree)(tpt1, refinements1), tpt1, refinements1, refineCls)
24942497 }
24952498
@@ -4706,7 +4709,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
47064709 cpy.Ident (qual)(qual.symbol.name.sourceModuleName.toTypeName)
47074710 case _ =>
47084711 errorTree(tree, em " cannot convert from $tree to an instance creation expression " )
4709- val tycon = ctorResultType.underlyingClassRef(refinementOK = Feature .enabled(modularity))
4712+ val tycon = ctorResultType.underlyingClassRef(refinementOK = Feature .enabled(Feature . modularity))
47104713 typed(
47114714 untpd.Select (
47124715 untpd.New (untpd.TypedSplice (tpt.withType(tycon))),
0 commit comments