We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
if
1 parent ad10c72 commit 2042dc1Copy full SHA for 2042dc1
test/expr/unary/if_expr.swift
@@ -933,6 +933,7 @@ func continue1() -> Int {
933
func return1() -> Int {
934
// Make sure we always reject a return.
935
let i = if .random() {
936
+ ()
937
do {
938
for _ in [0] {
939
while true {
@@ -1504,6 +1505,11 @@ dynamic func testDynamicOpaqueErase() -> some EraserP {
1504
1505
if .random() { SomeEraserP() } else { SomeEraserP() }
1506
}
1507
1508
+struct NonExhaustiveProperty {
1509
+ let i = if .random() { 0 }
1510
+ // expected-error@-1 {{'if' must have an unconditional 'else' to be used as expression}}
1511
+}
1512
+
1513
// MARK: Out of place if exprs
1514
1515
func inDefaultArg(x: Int = if .random() { 0 } else { 0 }) {}
0 commit comments