Skip to content

Instantly share code, notes, and snippets.

@devxoul
Last active March 31, 2016 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devxoul/b5ac688ffcf70fc9222892c267319ce5 to your computer and use it in GitHub Desktop.
Save devxoul/b5ac688ffcf70fc9222892c267319ce5 to your computer and use it in GitHub Desktop.
Overridden function is not being called when sublassing generic class in Release Build with Whole Module Optimization. https://bugs.swift.org/browse/SR-1117
/// A generic class
class Parent<T> {
func printName() {
print(self.name())
}
func name() -> String {
return "Parent"
}
}
/// Subclass of generic class
class Child: Parent<String> {
/// This method is not being called with Release Build + Whole Module Optimization.
override func name() -> String {
return "Child"
}
}
let child = Child()
child.printName() // expected "Child" but prints "Parent" with Release Build + Whole Module Optimization.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment