<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Aaron this works for me in both Swift 2.2 and Swift 3 provided that you remove the ‘throws’ keyword.
<div class=""><br class="">
</div>
<div class="">What seems odd to me is not the first assignment, but rather the second that _allows_ the use of ‘throws’ when t.1 (i.e. f) does not throw - is your concern the same?</div>
<div class=""><br class="">
</div>
<div class="">Shane</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">
<div>
<blockquote type="cite" class="">
<div class="">On Jul 5, 2016, at 10:48 PM, Aaron Bohannon via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div class="">Yesterday, it was pointed out that a variable name referring to a tuple cannot be used as a pattern. I have noticed another sort of inconsistency in how tuples are treated when they are referenced by name:</div>
<div class=""><br class="">
</div>
<div class="">
<div class=""><font face="monospace, monospace" class="">func f() -> Int { return 5 }</font></div>
<div class=""><font face="monospace, monospace" class=""><br class="">
</font></div>
<div class=""><font face="monospace, monospace" class="">let t = ("a", f)</font></div>
<div class=""><font face="monospace, monospace" class=""><br class="">
</font></div>
<div class=""><font face="monospace, monospace" class="">let _: (String, () throws -> Int) = t // type error</font></div>
<div class=""><font face="monospace, monospace" class="">let _: (String, () throws -> Int) = (t.0, t.1) // OK</font></div>
</div>
<div class=""><br class="">
</div>
<div class="">This situation leads to a different sort of type error; however, the error seems equally unwarranted. I can't see any good reason for a well-typed program to become ill-typed when `(t.0, t.1)` is replaced with `t` (assuming `t` is a pair).</div>
<div class=""><br class="">
</div>
<div class="">Should I file a separate bug for the specific example above?</div>
<div class=""><br class="">
</div>
<div class="">- Aaron</div>
</div>
_______________________________________________<br class="">
swift-users mailing list<br class="">
<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">
https://lists.swift.org/mailman/listinfo/swift-users<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</body>
</html>