mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Give the ternary a fixed precedence, parse '?' and ':' into SequenceExprs, and fold them into IfExprs as part of sequence folding. This allows assignment operators like '+=' to have precedence below the ternary as in C. Fixes <rdar://problem/13756211>. Swift SVN r4983
9 lines
450 B
Swift
9 lines
450 B
Swift
// RUN: %swift -parse -verify %s
|
|
|
|
func unbalanced_question(a:Bool, b:Bool, c:Bool, d:Bool) {
|
|
(a ? b) // expected-error{{expected ':' after '? ...' in ternary}}
|
|
(a ? b : c ? d) // expected-error{{expected ':' after '? ...' in ternary}}
|
|
(a ? b ? c : d) // expected-error{{expected ':' after '? ...' in ternary}}
|
|
(a ? b ? c) // expected-error{{expected ':' after '? ...' in ternary}} // expected-error{{expected ':' after '? ...' in ternary}}
|
|
}
|