@@ -40,7 +40,7 @@ import annotation.tailrec
40
40
import Implicits .*
41
41
import util .Stats .record
42
42
import config .Printers .{gadts , typr }
43
- import config .Feature , Feature .{migrateTo3 , modularity , sourceVersion , warnOnMigration }
43
+ import config .Feature , Feature .{migrateTo3 , sourceVersion , warnOnMigration }
44
44
import config .SourceVersion .*
45
45
import rewrites .Rewrites , Rewrites .patch
46
46
import staging .StagingLevel
@@ -1145,7 +1145,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
1145
1145
if templ1.parents.isEmpty
1146
1146
&& isFullyDefined(pt, ForceDegree .flipBottom)
1147
1147
&& isSkolemFree(pt)
1148
- && isEligible(pt.underlyingClassRef(refinementOK = Feature .enabled(modularity)))
1148
+ && isEligible(pt.underlyingClassRef(refinementOK = Feature .enabled(Feature . modularity)))
1149
1149
then
1150
1150
templ1 = cpy.Template (templ)(parents = untpd.TypeTree (pt) :: Nil )
1151
1151
for case parent : RefTree <- templ1.parents do
@@ -1720,7 +1720,11 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
1720
1720
typedFunctionType(desugar.makeFunctionWithValDefs(tree, pt), pt)
1721
1721
else
1722
1722
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)
1724
1728
// if there are any erased classes, we need to re-do the typecheck.
1725
1729
result match
1726
1730
case r : AppliedTypeTree if r.args.exists(_.tpe.isErasedClass) =>
@@ -2451,12 +2455,12 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
2451
2455
if tycon.tpe.typeParams.nonEmpty then
2452
2456
val tycon0 = tycon.withType(tycon.tpe.etaCollapse)
2453
2457
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
2455
2459
val tparamSplice = untpd.TypedSplice (typedExpr(tparam))
2456
2460
typed(untpd.RefinedTypeTree (spliced(tycon), List (untpd.TypeDef (tpnme.Self , tparamSplice))))
2457
2461
else
2458
2462
def selfNote =
2459
- if Feature .enabled(modularity) then
2463
+ if Feature .enabled(Feature . modularity) then
2460
2464
" and\n does not have an abstract type member named `Self` either"
2461
2465
else " "
2462
2466
errorTree(tree,
@@ -2475,7 +2479,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
2475
2479
val TypeDef (_, impl : Template ) = typed(refineClsDef): @ unchecked
2476
2480
val refinements1 = impl.body
2477
2481
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
2479
2483
typr.println(s " adding refinement $refinement" )
2480
2484
checkRefinementNonCyclic(refinement, refineCls, seen)
2481
2485
val rsym = refinement.symbol
@@ -2489,7 +2493,6 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
2489
2493
val member = refineCls.info.member(rsym.name)
2490
2494
if (member.isOverloaded)
2491
2495
report.error(OverloadInRefinement (rsym), refinement.srcPos)
2492
- }
2493
2496
assignType(cpy.RefinedTypeTree (tree)(tpt1, refinements1), tpt1, refinements1, refineCls)
2494
2497
}
2495
2498
@@ -4706,7 +4709,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
4706
4709
cpy.Ident (qual)(qual.symbol.name.sourceModuleName.toTypeName)
4707
4710
case _ =>
4708
4711
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))
4710
4713
typed(
4711
4714
untpd.Select (
4712
4715
untpd.New (untpd.TypedSplice (tpt.withType(tycon))),
0 commit comments