Files
swift-mirror/test/Constraints/default_literals_swift4.swift
David Farler b7d17b25ba Rename -parse flag to -typecheck
A parse-only option is needed for parse performance tracking and the
current option also includes semantic analysis.
2016-11-28 10:50:55 -08:00

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}}