diff options
author | Martin Odersky <odersky@gmail.com> | 2016-09-24 19:18:12 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-09-24 19:18:12 +0200 |
commit | 4825980b0329c884d5b2e4e5377afdd16cefa3ad (patch) | |
tree | f770de4c25c9082d310124da387aad0bc8163543 /src/dotty/tools/dotc/ast/Positioned.scala | |
parent | 962377ebc23a4c6a2757bee99e6558dd6a93c067 (diff) | |
download | dotty-4825980b0329c884d5b2e4e5377afdd16cefa3ad.tar.gz dotty-4825980b0329c884d5b2e4e5377afdd16cefa3ad.tar.bz2 dotty-4825980b0329c884d5b2e4e5377afdd16cefa3ad.zip |
Specially mark functions coming from wildcard expressions
That way, we can check functions for the ordering requirement as well.
We only have to remember that the last parameter of a wildcard function
does not precede its body (because the parameter is in fact part of the body).
Diffstat (limited to 'src/dotty/tools/dotc/ast/Positioned.scala')
-rw-r--r-- | src/dotty/tools/dotc/ast/Positioned.scala | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/ast/Positioned.scala b/src/dotty/tools/dotc/ast/Positioned.scala index 216446e93..8d364d439 100644 --- a/src/dotty/tools/dotc/ast/Positioned.scala +++ b/src/dotty/tools/dotc/ast/Positioned.scala @@ -171,7 +171,9 @@ abstract class Positioned extends DotClass with Product { } if (nonOverlapping) { this match { - case _: Function => // ignore, functions produced from wildcards (e.g. (_ op _) mix parameters and body + case _: WildcardFunction + if lastPositioned.isInstanceOf[ValDef] && !p.isInstanceOf[ValDef] => + // ignore transition from last wildcard parameter to body case _ => assert(!lastPos.exists || !p.pos.exists || lastPos.end <= p.pos.start, s"""position error, child positions overlap or in wrong order @@ -180,9 +182,9 @@ abstract class Positioned extends DotClass with Product { |1st child position = $lastPos |2nd child = $p |2nd child position = ${p.pos}""".stripMargin) - lastPositioned = p - lastPos = p.pos } + lastPositioned = p + lastPos = p.pos } p.checkPos(nonOverlapping) case xs: List[_] => |