mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
A parse-only option is needed for parse performance tracking and the current option also includes semantic analysis.
18 lines
635 B
Swift
18 lines
635 B
Swift
// RUN: %target-typecheck-verify-swift -swift-version 4
|
|
|
|
// Swift 3 used default literal types even for normal protocol constraints,
|
|
// which led to nonsensical type inference behavior.
|
|
|
|
// expected-note@+1{{in call to function 'f'}}
|
|
func f<T: ExpressibleByIntegerLiteral>(_: T = 0) { }
|
|
|
|
f() // expected-error{{generic parameter 'T' could not be inferred}}
|
|
|
|
// expected-note@+1{{'T' declared as parameter to type 'X'}}
|
|
struct X<T: ExpressibleByIntegerLiteral> {
|
|
func g() { }
|
|
}
|
|
|
|
X().g() // expected-error{{generic parameter 'T' could not be inferred}}
|
|
// expected-note@-1{{explicitly specify the generic arguments to fix this issue}}
|