File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
compiler/src/dotty/tools/dotc/util Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -100,13 +100,18 @@ object Positions {
100
100
101
101
/** A copy of this position with a different start */
102
102
def withStart (start : Int ) =
103
- fromOffsets(start, this .end, if (isSynthetic) SyntheticPointDelta else this .point - start)
103
+ if (exists) fromOffsets(start, this .end, if (isSynthetic) SyntheticPointDelta else this .point - start)
104
+ else this
104
105
105
106
/** A copy of this position with a different end */
106
- def withEnd (end : Int ) = fromOffsets(this .start, end, pointDelta)
107
+ def withEnd (end : Int ) =
108
+ if (exists) fromOffsets(this .start, end, pointDelta)
109
+ else this
107
110
108
111
/** A copy of this position with a different point */
109
- def withPoint (point : Int ) = fromOffsets(this .start, this .end, point - this .start)
112
+ def withPoint (point : Int ) =
113
+ if (exists) fromOffsets(this .start, this .end, point - this .start)
114
+ else this
110
115
111
116
/** A synthetic copy of this position */
112
117
def toSynthetic = if (isSynthetic) this else Position (start, end)
You can’t perform that action at this time.
0 commit comments