swiftlang/swift

[SR-15176] Fixit for `override func` that should be `override var`

Open

#57,499 opened on Sep 9, 2021

View on GitHub
 (31 comments) (0 reactions) (1 assignee)Swift (10,719 forks)batch import
compilerdiagnostics qualityfix-itsgood first issueimprovementinheritanceoverrideswift 5.9

Repository metrics

Stars
 (69,989 stars)
PR merge metrics
 (Avg merge 8d 17h) (510 merged PRs in 30d)

Description

Previous ID SR-15176
Radar rdar://28337871
Original Reporter @CodaFi
Type Improvement
Votes 0
Component/s Compiler
Labels Improvement, DiagnosticsQoI, StarterBug
Assignee jiaren wang (JIRA)
Priority Medium

md5: b17661d61829d04b65f822d78b07388a

Issue Description:

Consider

class C {
  var canBecomeFirstResponder: Bool

  init() {}
}

class D: C {
    override func canBecomeFirstResponder() -> Bool {
    }
}

We should add a special case to diagnoseGeneralOverrideFailure that tries to see if it can correct no-args FuncDecls to VarDecls and vice-versa.

Contributor guide