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-10231] Overloading Overriden Method By Inout-ness Causes Compile Error #52631

Closed
swift-ci opened this issue Mar 29, 2019 · 2 comments
Closed

[SR-10231] Overloading Overriden Method By Inout-ness Causes Compile Error #52631

swift-ci opened this issue Mar 29, 2019 · 2 comments

Comments

@swift-ci
Copy link
Collaborator

@swift-ci swift-ci commented Mar 29, 2019

Previous ID SR-10231
Radar None
Original Reporter trevorthoele (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Swift 4.2

XCode 10.2

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 5.0Regression
Assignee @slavapestov
Priority Medium

md5: 1d2b0351efbb0962eb5ccace68a59193

relates to:

  • SR-10198 Cannot override more than one superclass declaration

Issue Description:

Overriding a base class function and introducing an overload in the derived class based solely on the inout status of the parameter causes the compiler to think that the method is overridden twice.

This appears to happen regardless of whether an inout parameter is overridden or a non-inout parameter is overridden. This worked prior to upgrading to XCode 10.2.

Below, XCode reports the 'f(i: Int)' function declared in Derived as already overridden.

class Base {
    func f(i: inout Int) {
        
    }
}


class Derived : Base {
    override func f(i: inout Int) {
        
    }
    
    func f(i: Int) {
        
    }
}
@slavapestov
Copy link
Member

@slavapestov slavapestov commented Apr 1, 2019

Recall that parameter types no longer include an InOutType, so the problem here is that override checking is not checking parameter flags. In 4.2 I think we just compared tuple types.

@slavapestov
Copy link
Member

@slavapestov slavapestov commented Apr 3, 2019

#23754

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants