mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
argument. For now we start with some of the most simple cases: single argument calls. This dramatically improves the QoI for error messages in argument lists, typically turning a error+note combo into a single specific error message. Some minor improvements coming (and also generalizing this to n-ary calls), but it is nice that all the infrastructure is starting to come together... Swift SVN r30905
42 lines
648 B
Swift
42 lines
648 B
Swift
// RUN: %target-parse-verify-swift
|
|
|
|
class A { }
|
|
class B : A { }
|
|
class C : B { }
|
|
class D : B { }
|
|
|
|
class E<T> : D { }
|
|
class F<T> : E<[T]> { }
|
|
|
|
var a : A
|
|
var b : B
|
|
var c : C
|
|
var d : D
|
|
var ef : E<Float>
|
|
var fi : F<Int>
|
|
|
|
func f0(b : B) {}
|
|
|
|
func ternary<T>(cond: Bool,
|
|
@autoclosure _ ifTrue: () -> T,
|
|
@autoclosure _ ifFalse: () -> T) -> T {}
|
|
|
|
f0(c)
|
|
f0(a) // expected-error{{cannot convert value of type 'A' to expected argument type 'B'}}
|
|
f0(ef)
|
|
f0(fi)
|
|
|
|
// FIXME: Test subtyping of class metatypes.
|
|
|
|
ternary(true, ef, c)
|
|
|
|
|
|
class X {
|
|
init() {}
|
|
init(x:Int, y:UnicodeScalar) {}
|
|
}
|
|
|
|
var x0 = X()
|
|
var x1 = X(x: 1, y: "2")
|
|
|