Skip to content

Commit bcebfc6

Browse files
committed
Update comma disambiguation
1 parent d1d0d57 commit bcebfc6

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Documentation/Evolution/DelimiterSyntax.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ The above case seems uncommon, however note this may also occur when the closing
185185
foo(/, 2) + foo(/, 3)
186186
```
187187

188+
**TODO: Do we want to talk about a heuristic that looks for unbalanced parens? I'm kind of hesitant to implement that, as it would have edge cases and might screw with regex errors that should be diagnosed as invalid regex, rather than some cryptic Swift syntactic error. Which would also make it harder to explain to users.**
189+
188190
This would also become a regex literal, i.e it would be parsed as the argument `/, 2) + foo(/`. If users wish to disambiguate, they will need to surround at least the opening `/` with parentheses, e.g:
189191

190192
```swift
@@ -193,10 +195,6 @@ foo((/), 2) + foo(/, 3)
193195

194196
This takes advantage of the fact that a regex literal will not be parsed if the first character is `)`.
195197

196-
**TODO: More cases from slack discussion **
197-
198-
`foo(/, "(") / 2` !!!
199-
200198
</details>
201199

202200
#### Editor Considerations

0 commit comments

Comments
 (0)