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-11542] bad diagnostic when function invoked with trailing closure syntax and default args after closure #53943

Open
weissi opened this issue Sep 28, 2019 · 1 comment
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation

Comments

@weissi
Copy link
Member

weissi commented Sep 28, 2019

Previous ID SR-11542
Radar rdar://problem/55806391
Original Reporter @weissi
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI
Assignee @gregomni
Priority Medium

md5: 3a7dc68bd8326dd7437f59d25f32964e

Issue Description:

The following program might not be quite correct (because the trailing closure syntax is used but it's not actually the last argument)

func test(_ body: () -> Void, file: StaticString = #file, line: UInt = #line) {}

test {}

The diagnostic however is pretty bad:

$ swift repro.swift
repro.swift:3:1: error: cannot invoke 'test' with an argument list of type '(() -> ())'
test {}
^
repro.swift:3:1: note: expected an argument list of type '(() -> Void, file: StaticString, line: UInt)'
test {}
^

it claims that it can't invoke test with an argument list of () -> () which totally works though 🙂

@weissi
Copy link
Member Author

weissi commented Sep 28, 2019

@swift-ci create

@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. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation
Projects
None yet
Development

No branches or pull requests

1 participant