You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apple Swift version 2.2 (swiftlang-703.0.18.1 clang-703.0.29)
Additional Detail from JIRA
Votes
0
Component/s
Compiler
Labels
Bug
Assignee
None
Priority
Medium
md5: 689b363b04e00a5ba10ec88c9241d8f5
duplicates:
SR-416 Automatic initializer inheritance doesn't work for generic types.
Issue Description:
According to Apple's documentation Swift does not necessary require override of initializer. In a following code example Bar inherits initializer of Foo:
classFoo {
letvalue: Intinit(value: Int = 5) {
self.value = value
}
}
classBar: Foo {
}
Modifying code as below prevents inheritance of initializer.
classFoo<T> {
letvalue: Intinit(value: Int = 5) {
self.value = value
}
}
classBar: Foo {
}
Here are an option how to define a class with generic that does not require override of designated initializer:
Environment
Apple Swift version 2.2 (swiftlang-703.0.18.1 clang-703.0.29)
Additional Detail from JIRA
md5: 689b363b04e00a5ba10ec88c9241d8f5
duplicates:
Issue Description:
According to Apple's documentation Swift does not necessary require override of initializer. In a following code example Bar inherits initializer of Foo:
Modifying code as below prevents inheritance of initializer.
Here are an option how to define a class with generic that does not require override of designated initializer:
However there is another interesting observation of behavior. Defining initializer like following cause override requirement:
The funny thing thing that adding one more parameter as following into such designated initializer cause this override requirement to disappear:
The text was updated successfully, but these errors were encountered: