Navigation Menu

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-10847] Argument labels are not correctly removed from curried instance member reference #53237

Open
hamishknight opened this issue Jun 6, 2019 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis

Comments

@hamishknight
Copy link
Collaborator

Previous ID SR-10847
Radar None
Original Reporter @hamishknight
Type Bug
Environment

Swift version 5.1-dev (LLVM e56fafcd29, Swift dbf80b1b28)
Target: x86_64-apple-darwin18.5.0

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, TypeChecker
Assignee None
Priority Medium

md5: 34a24fc48237fc4153d00b114bce91e0

Issue Description:

The following fails to compile:

class C {
  func bar(x: Bool) {}
}

let fn: (C) -> (Bool) -> Void
fn = { c in C.bar(c) } // error: Cannot assign value of type '(C) -> (Bool) -> ()' to type '(C) -> (Bool) -> Void'

However it does compile if bar doesn't have an argument label:

class C {
  func bar(_ x: Bool) {}
}

let fn: (C) -> (Bool) -> Void
fn = { c in C.bar(c) }

It looks like we're not stripping the argument labels from the reference.

@belkadan
Copy link
Contributor

belkadan commented Jun 7, 2019

@slavapestov, CodaFi (JIRA User), any insights?

@slavapestov
Copy link
Member

We've seen something similar internally as rdar://36209605. It would be source breaking to change this, but I expect the impact is minimal. As far as I know it only happens if you directly invoke the curried reference; if you store it in a variable it won't have the label, ever.

@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 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants