Files
swift-mirror/test/Constraints/invalid_logicvalue_coercion.swift
Pavel Yaskevich 72b61f55bf [Diagnostics] Tailored diagnostic for "condition" expression
Since all condition expressions supposed to be convertible
to `Bool`, let's use that type as contextual and produce a
tailored diagnostic.
2019-09-20 12:37:35 -07:00

10 lines
288 B
Swift

// RUN: %target-typecheck-verify-swift
class C {}
var c = C()
if c as C { // expected-error{{cannot convert value of type 'C' to expected condition type 'Bool'}}
}
if ({1} as () -> Int) { // expected-error{{cannot convert value of type '() -> Int' to expected condition type 'Bool'}}
}