Files
swift-mirror/validation-test/stdlib/BoolDiagnostics_Dataflow.swift
Dave Abrahams dc777eec78 [stdlib] Deprecate ExpressibleByStringInterpolation
We know its API is
inadequate (https://bugs.swift.org/browse/SR-1260?jql=text%20~%20%22StringInterpolationConvertible%22)
and don't want to be constrained to supporting it in future versions.
2016-08-17 13:45:06 -07:00

60 lines
1.7 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'}}
// expected-warning@+1 {{'ExpressibleByStringInterpolation' is deprecated: it will be replaced or redesigned in Swift 4.0. Instead of conforming to 'ExpressibleByStringInterpolation', consider adding an 'init(_:String)'}}
typealias X = ExpressibleByStringInterpolation