Skip to content

[4.2] Swift 4 compatibility hack for redeclaration of properties in generic type and extension #17414

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

Merged

Conversation

huonw
Copy link
Contributor

@huonw huonw commented Jun 22, 2018

The patch that nailed down our semantics here missed an additional case that
required a compatibility hack: a property on a generic type and a same-named one
in an (unconstrained) extension:

struct Foo<T> {
    var x: Int { return 0 }
}
extension Foo {
    var x: Bool { return false }
}

Fixes rdar://problem/40685642.

4.2 merge of #17392

huonw added 2 commits June 22, 2018 11:23
"illegal" is an overloaded word and can distress people who aren't familiar with
the usage as being illegal with respect to the language definition, not the
actual law.
…tensions of generic types.

The patch that nailed down our semantics here missed an additional case that
required a compatibility hack: a property on a generic type and a same-named one
in an (unconstrained) extension:

    struct Foo<T> {
        var x: Int { return 0 }
    }
    extension Foo {
        var x: Bool { return false }
    }

Fixes rdar://problem/40685642.
@huonw
Copy link
Contributor Author

huonw commented Jun 22, 2018

@swift-ci please test

@huonw huonw merged commit cca7ab0 into swiftlang:swift-4.2-branch Jun 22, 2018
@huonw huonw deleted the redefinition-swift-4-compat-4.2 branch June 22, 2018 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant