Files
swift-mirror/test/Constraints/invalid_logicvalue_coercion.swift
Chris Willmore 42dba24464 Don't allow '{' at start of if-condition
If '{' is encountered immediately after 'if', assume that the condition
is missing. Apply the same treatment to while, do-while, for-in, and
switch. This way we're not trying to re-parse, backtrack, repurpose
misparsed closure bodies, etc. in those cases. Users who want to write a
condition that starts with '{' can wrap it in parens.

Addressing feedback re <rdar://problem/18940198>.

Swift SVN r25747
2015-03-04 05:39:49 +00:00

10 lines
252 B
Swift

// RUN: %target-parse-verify-swift
class C {}
var c = C()
if c as C { // expected-error{{type 'C' does not conform to protocol 'BooleanType'}}
}
if ({1} as ()->Int) { // expected-error{{type '() -> Int' does not conform to protocol 'BooleanType'}}
}