Files
swift-mirror/validation-test/stdlib/BoolDiagnostics_Dataflow.swift
Joe Groff fbd2e4d872 Rename @asmname to @_silgen_name.
This reflects the fact that the attribute's only for compiler-internal use, and isn't really equivalent to C's asm attribute, since it doesn't change the calling convention to be C-compatible.
2015-11-17 14:13:48 -08:00

58 lines
1.5 KiB
Swift

// RUN: %target-swift-frontend -emit-sil -verify %s
@_silgen_name("opaque")
func opaque() -> Int
func test_constantFoldAnd1() -> Int {
while true && true {
return 42
}
// FIXME: this is a false positive.
} // expected-error {{missing return in a function expected to return 'Int'}}
func test_constantFoldAnd2() -> Int {
while true && false {
return 42
}
} // expected-error {{missing return in a function expected to return 'Int'}}
func test_constantFoldAnd3() -> Int {
while false && true {
return 42
}
} // expected-error {{missing return in a function expected to return 'Int'}}
func test_constantFoldAnd4() -> Int {
while false && false {
return 42
}
} // expected-error {{missing return in a function expected to return 'Int'}}
func test_constantFoldOr1() -> Int {
while true || true {
return 42
}
// FIXME: this is a false positive.
} // expected-error {{missing return in a function expected to return 'Int'}}
func test_constantFoldOr2() -> Int {
while true || false {
return 42
}
// FIXME: this is a false positive.
} // expected-error {{missing return in a function expected to return 'Int'}}
func test_constantFoldOr3() -> Int {
while false || true {
return 42
}
// FIXME: this is a false positive.
} // expected-error {{missing return in a function expected to return 'Int'}}
func test_constantFoldOr4() -> Int {
while false || false {
return 42
}
} // expected-error {{missing return in a function expected to return 'Int'}}