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-13503] InsertExplicitCall fix not created for callable values #55945

Open
theblixguy opened this issue Sep 4, 2020 · 5 comments
Open

[SR-13503] InsertExplicitCall fix not created for callable values #55945

theblixguy opened this issue Sep 4, 2020 · 5 comments
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 type checker Area → compiler: Semantic analysis

Comments

@theblixguy
Copy link
Collaborator

Previous ID SR-13503
Radar rdar://problem/68376691
Original Reporter @theblixguy
Type Bug
Environment

Swift version 5.3-dev (LLVM 19447e2, Swift e41a0976e0bdb09)
Target: x86_64-apple-darwin19.5.0

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

md5: cf7afdf3fd38fee6a0ef870bb5bd3d36

Issue Description:

struct S {
  func callAsFunction() -> Int { 0 }
}

let s = S()

func doIt(arg: Int) { print(arg) }
doIt(arg: s) // error: cannot convert value of type 'S' to expected argument type 'Int'

In the above scenario, it is possible to call s (by adding ()) to produce the expected value of type Int. So, we should create the InsertExplicitCall fix (or create a fix tailored for callable values) in order to emit a better diagnostic.

@theblixguy
Copy link
Collaborator Author

cc @xedin @hborla

@typesanitizer
Copy link

@swift-ci create

@xedin
Copy link
Member

xedin commented Sep 7, 2020

It looks like we need to detect that it's possible to call `s` in this example and produce a tailored fix. Do you want to take a look luciano (JIRA User)?

@LucianoPAlmeida
Copy link
Collaborator

Sure @xedin, I'll take a look 🙂

@LucianoPAlmeida
Copy link
Collaborator

Here is a PR https://github.com/apple/swift/pull/34006

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

No branches or pull requests

4 participants