mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Make sure StructureMarkerRAII checks structure nesting level on all paths. Previously swift crashed with no diagnostic on deeply nested '('. Now we print an error when more than 256 parens deep, just as we always have for '['.
fixes SR-4866
38 lines
2.1 KiB
Swift
38 lines
2.1 KiB
Swift
// RUN: %target-swift-frontend -parse %s 2>&1 | %FileCheck -allow-empty %s
|
|
|
|
// Test that we can have the allowed # of parens.
|
|
// CHECK-NOT: error
|
|
let a = (((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((
|
|
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((
|
|
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((
|
|
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((
|
|
1
|
|
)))))))))))))))))))))))))))))) ))))))))))))))))))))))))))))))))
|
|
)))))))))))))))))))))))))))))))) ))))))))))))))))))))))))))))))))
|
|
)))))))))))))))))))))))))))))))) ))))))))))))))))))))))))))))))))
|
|
)))))))))))))))))))))))))))))))) ))))))))))))))))))))))))))))))))
|
|
|
|
// Test that we can have the allowed # of curly braces.
|
|
/// CHECK-NOT: error
|
|
let b = {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{ {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
|
|
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{ {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
|
|
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{ {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
|
|
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{ {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
|
|
1
|
|
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
|
|
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
|
|
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
|
|
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
|
|
|
|
// Test that we can have the allowed # of mixed brackets.
|
|
// CHECK-NOT: error
|
|
let c = ({({({({ ({({({([ ({({({({ ({({({([ ({({({({ ({({({([ ({({({({ ({({({({
|
|
({({({({ ({({({([ ({({({({ ({({({([ ({({({({ ({({({([ ({({({({ ({({({({
|
|
({({({({ ({({({([ ({({({({ ({({({([ ({({({({ ({({({([ ({({({({ ({({({({
|
|
({({({({ ({({({([ ({({({({ ({({({([ ({({({({ ({({({([ ({({({({ ({({({
|
|
1
|
|
})})}) })})})}) ])})})}) })})})}) ])})})}) })})})}) ])})})}) })})})})
|
|
})})})}) })})})}) ])})})}) })})})}) ])})})}) })})})}) ])})})}) })})})})
|
|
})})})}) })})})}) ])})})}) })})})}) ])})})}) })})})}) ])})})}) })})})})
|
|
})})})}) })})})}) ])})})}) })})})}) ])})})}) })})})}) ])})})}) })})})})
|