File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -171,7 +171,9 @@ abstract class Positioned extends DotClass with Product {
171
171
}
172
172
if (nonOverlapping) {
173
173
this match {
174
- case _ : Function => // ignore, functions produced from wildcards (e.g. (_ op _) mix parameters and body
174
+ case _ : WildcardFunction
175
+ if lastPositioned.isInstanceOf [ValDef ] && ! p.isInstanceOf [ValDef ] =>
176
+ // ignore transition from last wildcard parameter to body
175
177
case _ =>
176
178
assert(! lastPos.exists || ! p.pos.exists || lastPos.end <= p.pos.start,
177
179
s """ position error, child positions overlap or in wrong order
@@ -180,9 +182,9 @@ abstract class Positioned extends DotClass with Product {
180
182
|1st child position = $lastPos
181
183
|2nd child = $p
182
184
|2nd child position = ${p.pos}""" .stripMargin)
183
- lastPositioned = p
184
- lastPos = p.pos
185
185
}
186
+ lastPositioned = p
187
+ lastPos = p.pos
186
188
}
187
189
p.checkPos(nonOverlapping)
188
190
case xs : List [_] =>
Original file line number Diff line number Diff line change @@ -46,6 +46,13 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
46
46
override def isTerm = body.isTerm
47
47
override def isType = body.isType
48
48
}
49
+ /** A function created from a wildcard expression
50
+ * @param placeHolderParams a list of definitions of synthetic parameters
51
+ * @param body the function body where wildcards are replaced by
52
+ * references to synthetic parameters.
53
+ */
54
+ class WildcardFunction (placeholderParams : List [ValDef ], body : Tree ) extends Function (placeholderParams, body)
55
+
49
56
case class InfixOp (left : Tree , op : Name , right : Tree ) extends OpTree
50
57
case class PostfixOp (od : Tree , op : Name ) extends OpTree
51
58
case class PrefixOp (op : Name , od : Tree ) extends OpTree
Original file line number Diff line number Diff line change @@ -973,7 +973,7 @@ object Parsers {
973
973
else
974
974
try
975
975
if (placeholderParams.isEmpty) t
976
- else Function (placeholderParams.reverse, t)
976
+ else new WildcardFunction (placeholderParams.reverse, t)
977
977
finally placeholderParams = saved
978
978
}
979
979
You can’t perform that action at this time.
0 commit comments