Open swift-ci opened 8 years ago
As a language change, this would need to go through the Swift Evolution Process.
Comment by Andrew Bennett (JIRA)
Thanks Jordan, I started a thread a while ago, but it didn't get any responses. I guess it got lost in the storm, or I submitted it at the wrong time (I'm in Australia).
https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160328/013559.html
I wasn't sure if this was a new feature, or a fix on an existing one, so I thought I'd try here.
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Improvement, LanguageFeatureRequest, TypeChecker | |Assignee | None | |Priority | Medium | md5: 7b1d93393e0ef2686685b69a17a3bfecIssue Description:
Overview
The return type is used to disambiguate function resolution. Whether a functions result is used should be used by the type-checker to disambiguate between
Void
and non-Void
functions.Consistency
If the result is unused and a single matching function returning
Void
is found, that function should be used.If the result is used and a single matching function not returning
Void
is found, that function should be used.Examples
The following examples use this code:
Currently this compiles, it uses the "no return" version:
This fails to compile,
error: ambiguous use of 'test'
, I expect it to use the "with return" version:This fails to compile,
error: ambiguous use of 'test'
, I expect it to use the "no return" version:Currently this has no error, that should still be the case, if it's unambiguous:
Thanks!