@@ -81,7 +81,7 @@ object Parsers {
81
81
* to position spanning from `start` to last read offset, with given point.
82
82
* If the last offset is less than or equal to start, the tree `t` did not
83
83
* consume any source for its construction. In this case, don't position it yet,
84
- * but wait for its position to be determined by `setChildPositions ` when the
84
+ * but wait for its position to be determined by `setChildSpans ` when the
85
85
* parent node is positioned.
86
86
*/
87
87
def atPos [T <: Positioned ](start : Offset , point : Offset )(t : T ): T =
@@ -1975,9 +1975,9 @@ object Parsers {
1975
1975
prefix : Boolean = false , // clause precedes name of an extension method
1976
1976
firstClause : Boolean = false ) // clause is the first in regular list of clauses
1977
1977
: List [ValDef ] = {
1978
- var implicitOffset = - 1 // use once
1978
+ var impliedMods : Modifiers = EmptyModifiers
1979
1979
1980
- def param (impliedMods : Modifiers ): ValDef = {
1980
+ def param (): ValDef = {
1981
1981
val start = in.offset
1982
1982
var mods = impliedMods.withAnnotations(annotations())
1983
1983
if (ofClass) {
@@ -2012,9 +2012,8 @@ object Parsers {
2012
2012
val default =
2013
2013
if (in.token == EQUALS ) { in.nextToken(); expr() }
2014
2014
else EmptyTree
2015
- if (implicitOffset >= 0 ) {
2016
- // mods = mods.withPos(mods.span.union(Span(implicitOffset, implicitOffset)))
2017
- implicitOffset = - 1
2015
+ if (impliedMods.mods.nonEmpty) {
2016
+ impliedMods = impliedMods.withMods(Nil ) // keep only flags, so that parameter positions don't overlap
2018
2017
}
2019
2018
ValDef (name, tpt, default).withMods(mods)
2020
2019
}
@@ -2037,18 +2036,16 @@ object Parsers {
2037
2036
if (in.token == RPAREN && ! prefix) Nil
2038
2037
else {
2039
2038
def funArgMods (mods : Modifiers ): Modifiers =
2040
- if (in.token == IMPLICIT ) {
2041
- implicitOffset = in.offset
2039
+ if (in.token == IMPLICIT )
2042
2040
funArgMods(addMod(mods, atPos(accept(IMPLICIT )) { Mod .Implicit () }))
2043
- }
2044
2041
else if (in.token == ERASED )
2045
2042
funArgMods(addMod(mods, atPos(accept(ERASED )) { Mod .Erased () }))
2046
2043
else mods
2047
2044
2048
- val paramMods = funArgMods(EmptyModifiers )
2045
+ impliedMods = funArgMods(EmptyModifiers )
2049
2046
val clause =
2050
- if (prefix) param(paramMods ) :: Nil
2051
- else commaSeparated(() => param(paramMods ))
2047
+ if (prefix) param() :: Nil
2048
+ else commaSeparated(() => param())
2052
2049
checkVarArgsRules(clause)
2053
2050
clause
2054
2051
}
0 commit comments