mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Previously we would strictly match `{` + `}`, but
that ignored the fact that when parsing we consider
`#if` + `#endif` to be a stronger delimiter than
`{` + `}`, so can ignore a stray `}` in a `#if`.
Update the logic to also track opening and closing
`#if` decls, ignoring any braces that happen within
them.
rdar://129195380
14 lines
307 B
Swift
14 lines
307 B
Swift
// rdar://129195380 - Make sure we correctly handle '#if' when skipping function
|
|
// bodies.
|
|
class C {
|
|
func test1() {
|
|
#if FOOBAR
|
|
// RUN: %sourcekitd-test -req=cursor -pos=%(line + 2):5 %s -- %s -DFOOBAR
|
|
// RUN: %sourcekitd-test -req=cursor -pos=%(line + 1):5 %s -- %s
|
|
abc
|
|
}
|
|
|
|
func test2() {
|
|
}
|
|
}
|