swiftlang/swift

[SR-11420] Protocol Stubs Should Suggest Requirement Stubs for Renames As Well

Open

#53.821 aperta il 4 set 2019

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)Swift (10.719 fork)batch import
bugcompilerdiagnostics qualitygood first issue

Metriche repository

Star
 (69.989 star)
Metriche merge PR
 (Merge medio 8g 17h) (510 PR mergiate in 30 g)

Descrizione

Previous ID SR-11420
Radar rdar://problem/55041530
Original Reporter @CodaFi
Type Bug

Attachment: Download

Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, StarterBug
Assignee RoyCao (JIRA)
Priority Medium

md5: b5341cef12a65640a517d36946649164

Issue Description:

For some odd reason, we don't print requirements that we diagnose as "close enough" to another witness that we can offer a rename fixit. For requirements that nearly-match something in another module (especially one you don't control like Foundation), this means the stub we print is missing requirements and doesn't compile.

Look into the callers (or lack thereof) of swift::printRequirementStub to see why this is happening.

I've attached a small SwiftUI Mac app that tries to define a coordinator with a conformance to an Objective-C protocol that defines two requirements. If you open it up and try to build it, only one of the two requirement stubs is printed. The other notes that something in NSObject should be renamed. That remaining stub should be suggested and printed along with the other requirement.

Guida contributor