Skip to content
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

[SR-13024] Unexpected tuple splat fix is diagnosed #55469

Open
omochi opened this issue Jun 16, 2020 · 0 comments
Open

[SR-13024] Unexpected tuple splat fix is diagnosed #55469

omochi opened this issue Jun 16, 2020 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@omochi
Copy link
Collaborator

omochi commented Jun 16, 2020

Previous ID SR-13024
Radar None
Original Reporter @omochi
Type Bug
Environment
commit 16c9c007af69bce822e79b0a73d6d51ce9e1e729 (HEAD -> master, tag: swift-DEVELOPMENT-SNAPSHOT-2020-06-13-a)
Merge: 8cb1331c75e 20dbe3fb220
Author: Saleem Abdulrasool <compnerd@compnerd.org>
Date:   Sat Jun 13 08:58:56 2020 -0700

    Merge pull request #&#8203;32350 from compnerd/vim-syntax
    
    vim: improve syntax highlighting rules
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 961d52ed226369e95fbeb3a7580e406b

Issue Description:

This code is diagnosed as following:

func f(_ a: (Int, Int), _ b: Int, _ c: Int) {}
f((1, 2))
a.swift:2:3: error: global function 'f' expects 2 separate arguments; remove extra parentheses to change tuple into separate arguments
f((1, 2))
  ^    ~

This message recommends user to remove parentheses.
But f actually expects 3 arguments and first tuple argument should be left as it is.

Expected diagnostics here is missing arguments for parameters #&#8203;2, #&#8203;3 in call.

This problem is come from difference of tuple splat condition in matchCallArgument and MissingArgumentsFailure::diagnoseInvalidTupleDestructuring.

It relates to SR-13023, SR-13002

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

1 participant