@@ -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
@@ -1142,7 +1142,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
1142
1142
if templ1.parents.isEmpty
1143
1143
&& isFullyDefined(pt, ForceDegree .flipBottom)
1144
1144
&& isSkolemFree(pt)
1145
- && isEligible(pt.underlyingClassRef(refinementOK = Feature .enabled(modularity)))
1145
+ && isEligible(pt.underlyingClassRef(refinementOK = Feature .enabled(Feature . modularity)))
1146
1146
then
1147
1147
templ1 = cpy.Template (templ)(parents = untpd.TypeTree (pt) :: Nil )
1148
1148
for case parent : RefTree <- templ1.parents do
@@ -1717,7 +1717,11 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
1717
1717
typedFunctionType(desugar.makeFunctionWithValDefs(tree, pt), pt)
1718
1718
else
1719
1719
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)
1721
1725
// if there are any erased classes, we need to re-do the typecheck.
1722
1726
result match
1723
1727
case r : AppliedTypeTree if r.args.exists(_.tpe.isErasedClass) =>
@@ -2458,12 +2462,12 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
2458
2462
if tycon.tpe.typeParams.nonEmpty then
2459
2463
val tycon0 = tycon.withType(tycon.tpe.etaCollapse)
2460
2464
typed(untpd.AppliedTypeTree (spliced(tycon0), tparam :: Nil ))
2461
- else if Feature .enabled(modularity) && tycon.tpe.member(tpnme.Self ).symbol.isAbstractOrParamType then
2465
+ else if Feature .enabled(Feature . modularity) && tycon.tpe.member(tpnme.Self ).symbol.isAbstractOrParamType then
2462
2466
val tparamSplice = untpd.TypedSplice (typedExpr(tparam))
2463
2467
typed(untpd.RefinedTypeTree (spliced(tycon), List (untpd.TypeDef (tpnme.Self , tparamSplice))))
2464
2468
else
2465
2469
def selfNote =
2466
- if Feature .enabled(modularity) then
2470
+ if Feature .enabled(Feature . modularity) then
2467
2471
" and\n does not have an abstract type member named `Self` either"
2468
2472
else " "
2469
2473
errorTree(tree,
@@ -2482,7 +2486,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
2482
2486
val TypeDef (_, impl : Template ) = typed(refineClsDef): @ unchecked
2483
2487
val refinements1 = impl.body
2484
2488
val seen = mutable.Set [Symbol ]()
2485
- for ( refinement <- refinements1) { // TODO: get clarity whether we want to enforce these conditions
2489
+ for refinement <- refinements1 do // TODO: get clarity whether we want to enforce these conditions
2486
2490
typr.println(s " adding refinement $refinement" )
2487
2491
checkRefinementNonCyclic(refinement, refineCls, seen)
2488
2492
val rsym = refinement.symbol
@@ -2496,7 +2500,6 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
2496
2500
val member = refineCls.info.member(rsym.name)
2497
2501
if (member.isOverloaded)
2498
2502
report.error(OverloadInRefinement (rsym), refinement.srcPos)
2499
- }
2500
2503
assignType(cpy.RefinedTypeTree (tree)(tpt1, refinements1), tpt1, refinements1, refineCls)
2501
2504
}
2502
2505
@@ -4693,7 +4696,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
4693
4696
cpy.Ident (qual)(qual.symbol.name.sourceModuleName.toTypeName)
4694
4697
case _ =>
4695
4698
errorTree(tree, em " cannot convert from $tree to an instance creation expression " )
4696
- val tycon = ctorResultType.underlyingClassRef(refinementOK = Feature .enabled(modularity))
4699
+ val tycon = ctorResultType.underlyingClassRef(refinementOK = Feature .enabled(Feature . modularity))
4697
4700
typed(
4698
4701
untpd.Select (
4699
4702
untpd.New (untpd.TypedSplice (tpt.withType(tycon))),
0 commit comments