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-4630] Fixit for adding a protocol conformance when a type is compatible, but not declared so #47207

Open
ddunbar opened this issue Apr 19, 2017 · 0 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

Comments

@ddunbar
Copy link
Member

ddunbar commented Apr 19, 2017

Previous ID SR-4630
Radar None
Original Reporter @ddunbar
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI
Assignee None
Priority Medium

md5: a2d0aa62469aac4d0b3104d933a1f22d

relates to:

  • SR-11042 Incorrect cast fix-it when type does not conform to a protocol

Issue Description:

The Swift compiler should give me a fixit for adding the obvious protocol conformance declaration, when it sees I tried to pass a type which could conform, but just hasn't been declared to do so:

$ cat z.swift
protocol P { var x: Int { get } }
struct S { var x = 0 }
func f0(_ p: P) {}
f0(S())

$ swiftc -c z.swift 
z.swift:4:4: error: argument type 'S' does not conform to expected type 'P'
f0(S())
   ^~~
       as! P
@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