Skip to content

[Diagnostics] Extend single parameter tuple splat to support generic parameters #27584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 9, 2019

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Oct 9, 2019

Currently single parameter tuple splat fix/diagnostic supports only
cases where parameter is a concrete tuple type, let's enhance that to
support generic parameters as well e.g.:

func foo<T>(_: T) {}
foo(0, 1, 2) // `T` expects arguments to form a tuple e.g. `foo((0, 1, 2))`

xedin added 2 commits October 8, 2019 18:11
…parameters

Currently single parameter tuple splat fix/diagnostic supports only
cases where parameter is a concrete tuple type, let's enhance that to
support generic parameters as well e.g.:

```swift
func foo<T>(_: T) {}
foo(0, 1, 2) // `T` expects arguments to form a tuple e.g. `foo((0, 1, 2))`
```
In situations like this:

```swift
func foo(x: (Int, Int) {}
foo(x: 0, 0)
```

Left paren to form a missing tuple should be placed after
the label because belongs to the parameter and not the tuple.
@xedin xedin requested a review from hborla October 9, 2019 01:13
@xedin
Copy link
Contributor Author

xedin commented Oct 9, 2019

@swift-ci please smoke test

@xedin
Copy link
Contributor Author

xedin commented Oct 9, 2019

@swift-ci please smoke test

…neric parameter

Since it's hard to say whether tuple use is really intended, let's
add `did you mean to pass a tuple?` note to the error message.
@xedin xedin force-pushed the extend-use-of-single-param-splat-fix branch from 7d941a2 to 51476cd Compare October 9, 2019 17:59
@xedin
Copy link
Contributor Author

xedin commented Oct 9, 2019

@swift-ci please smoke test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants