swift
swift copied to clipboard
[SR-4692] Useless diagnostics calling non-static method
| Previous ID | SR-4692 |
| Radar | rdar://problem/31847375 |
| Original Reporter | @NachoSoto |
| Type | Bug |
| Status | Resolved |
| Resolution | Done |
Environment
Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42)
Target: x86_64-apple-macosx10.9
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug, DiagnosticsQoI, TypeChecker |
| Assignee | @xedin |
| Priority | Medium |
md5: 797b62b171be00fdce6076562bad60e8
Issue Description:
Two similar examples with different (but equally useless) diagnostics
First one:
class D {
static func b() {
self.g(x: 3, y: true)
}
private func g(x: Int, y: Bool) {
}
}
Expected result:
Error saying `g` is not `static`.
Actual result:
error: repl.swift:22:25: error: extra argument 'y' in call
self.g(x: 3, y: true)
^~~~
Second one:
class C {
static func a() {
self.f(x: 3, y: true)
}
private func f(a: Int, b: Bool, c: String) {
self.f(x: a, y: b)
}
private func f(x: Int, y: Bool) {
}
}
Expected result:
Error saying `f(x:y: )` is not `static`.
Actual result:
error: repl.swift:22:9: error: ambiguous reference to member 'f(a:b:c:)'
self.f(x: 3, y: true)
^~~~
repl.swift:25:18: note: found this candidate
private func f(a: Int, b: Bool, c: String) {
^
repl.swift:29:18: note: found this candidate
private func f(x: Int, y: Bool) {
^
@swift-ci create
Fix and test cases from the ticket are included in https://github.com/apple/swift/pull/9376 which has been merged to master. Snapshot should be available soon, so please validate and let me know, resolving this as Done for now.
I can confirm this work now :thumbsup: