Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

[SoM] Some day overridable extension methods will break. #104

Open
stephen-hawley opened this issue Sep 20, 2018 · 0 comments
Open

[SoM] Some day overridable extension methods will break. #104

stephen-hawley opened this issue Sep 20, 2018 · 0 comments
Milestone

Comments

@stephen-hawley
Copy link
Contributor

{
    public init() { }
}

extension Foo {
    open func doIt () { print("hi"); }
}

open class Bar : Foo {
    override open func doIt () { print ("hi mom"); }
}

Note to future Steve:
You can define open methods in extensions, but you can't override them yet (which is the error message you get from the Swift compiler).
The good news is that this doesn't affect us since we implement extensions as extensions (whereas extensions that are defined in the same file/module as the type get promoted to methods).
The bad news is that the fix for this isn't pretty.
To fix, when the reflected data is read in, look for all extensions on types contained within that module that aren't protocol extensions, then move all the members from the extensions into the type that it extends. Gross, but effective.

@stephen-hawley stephen-hawley transferred this issue from another repository Oct 29, 2019
@chamons chamons added this to the Future milestone Nov 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants