Files
swift-mirror/test/Constraints/unconstrained_generic.swift
Dmitri Hrybenko 3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00

26 lines
757 B
Swift

// RUN: %target-parse-verify-swift
// RUN: %target-parse-verify-swift
func unconstrained<T>(x: T) {}
var x = 0
var y = "one"
// Although the generic parameter is unconstrained, it can only be bound to
// a materializable type. This should resolve T = Int and load the @lvalue x.
unconstrained(x)
// Although the generic parameter is unconstrained, it can only be bound to
// This should resolve T = (Int, String) and load the (@lvalue x, @lvalue y)
// tuple.
// FIXME: There's an inconsistency here in call argument matching between
// rvalues and lvalues. <rdar://problem/17786730>
unconstrained((x, y))
unconstrained(x, y) // expected-error{{extra argument in call}}
let a = 0
let b = "one"
unconstrained(a)
unconstrained((a, b))
unconstrained(a, b)