Files
swift-mirror/test/Parse/structure_no_overflow.swift
Christopher Ian Stern 469a0f3eb0 fix stack overflow on deeply nested parens [SR-4866] (#19631)
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
2018-10-10 13:42:18 +09:00

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
})})}) })})})}) ])})})}) })})})}) ])})})}) })})})}) ])})})}) })})})})
})})})}) })})})}) ])})})}) })})})}) ])})})}) })})})}) ])})})}) })})})})
})})})}) })})})}) ])})})}) })})})}) ])})})}) })})})}) ])})})}) })})})})
})})})}) })})})}) ])})})}) })})})}) ])})})}) })})})}) ])})})}) })})})})