Skip to content

Commit 7624f5e

Browse files
committed
Properly desugar implicit/erased dependent function types
In `typedDependent` we used to desugar the type `implicit (x: HasT) => x.T` to: ImplicitFunction1[HasT, HasT#T] { def apply(x: HasT): x.T } This commit sets the implicit/erased modifiers on all parameters of an implicit/erased function type, this changes the desugaring to the more correct: ImplicitFunction1[HasT, HasT#T] { def apply(implicit x: HasT): x.T }
1 parent 2e6e6d3 commit 7624f5e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,8 @@ object Parsers {
759759
case Ident(name) if name != tpnme.WILDCARD && in.token == COLON =>
760760
isValParamList = true
761761
funArgTypesRest(
762-
typedFunParam(paramStart, name.toTermName),
763-
() => typedFunParam(in.offset, ident()))
762+
typedFunParam(paramStart, name.toTermName, imods),
763+
() => typedFunParam(in.offset, ident(), imods))
764764
case t =>
765765
funArgTypesRest(t, funArgType)
766766
}
@@ -800,9 +800,9 @@ object Parsers {
800800
}
801801

802802
/** TypedFunParam ::= id ':' Type */
803-
def typedFunParam(start: Offset, name: TermName): Tree = atPos(start) {
803+
def typedFunParam(start: Offset, name: TermName, mods: Modifiers = EmptyModifiers): Tree = atPos(start) {
804804
accept(COLON)
805-
makeParameter(name, typ(), Modifiers(Param))
805+
makeParameter(name, typ(), mods | Param)
806806
}
807807

808808
/** InfixType ::= RefinedType {id [nl] refinedType}

0 commit comments

Comments
 (0)