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

Warn when dynamically subclassing a static class #79

Open
vihanb opened this issue Sep 21, 2018 · 0 comments
Open

Warn when dynamically subclassing a static class #79

vihanb opened this issue Sep 21, 2018 · 0 comments

Comments

@vihanb
Copy link
Member

vihanb commented Sep 21, 2018

Certain classes are 'static' for design purposes. This means that with this class:

@dynamic(false)
public class Animal {
    // ...

    func makeSound() { ... }
}

The following should warn:

public class Dog: Animal {
    override public func makeSound() { ... }
}
Warning: Subclass of a static class cannot be dynamic, add `@dynamic(false)` (1:0)

    > 1 | public class Dog: Animal {
        | ^
      2 |     override public func makeSound() { ... }
      3 | }
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

1 participant