Skip to content

Commit

Permalink
perf: Use some instead of any for Swift protocols (#215)
Browse files Browse the repository at this point in the history
* perf: Use `some` instead of `any` for Swift protocols

* `__implementation` needs to be `any` (opaque)

* fix: Type itself should also be `any`

* fix: Return type for getter must also be `any`
  • Loading branch information
mrousavy authored Oct 14, 2024
1 parent 4dd2669 commit fcd7016
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ ${hasBase ? `public class ${name.HybridTSpecCxx} : ${baseClasses.join(', ')}` :
* Create a new \`${name.HybridTSpecCxx}\` that wraps the given \`${name.HybridTSpec}\`.
* All properties and methods bridge to C++ types.
*/
public init(_ implementation: any ${name.HybridTSpec}) {
public init(_ implementation: some ${name.HybridTSpec}) {
self.__implementation = implementation
${hasBase ? 'super.init(implementation)' : '/* no base class */'}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class HybridBaseSpecCxx {
* Create a new `HybridBaseSpecCxx` that wraps the given `HybridBaseSpec`.
* All properties and methods bridge to C++ types.
*/
public init(_ implementation: any HybridBaseSpec) {
public init(_ implementation: some HybridBaseSpec) {
self.__implementation = implementation
/* no base class */
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class HybridChildSpecCxx : HybridBaseSpecCxx {
* Create a new `HybridChildSpecCxx` that wraps the given `HybridChildSpec`.
* All properties and methods bridge to C++ types.
*/
public init(_ implementation: any HybridChildSpec) {
public init(_ implementation: some HybridChildSpec) {
self.__implementation = implementation
super.init(implementation)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class HybridImageFactorySpecCxx {
* Create a new `HybridImageFactorySpecCxx` that wraps the given `HybridImageFactorySpec`.
* All properties and methods bridge to C++ types.
*/
public init(_ implementation: any HybridImageFactorySpec) {
public init(_ implementation: some HybridImageFactorySpec) {
self.__implementation = implementation
/* no base class */
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class HybridImageSpecCxx {
* Create a new `HybridImageSpecCxx` that wraps the given `HybridImageSpec`.
* All properties and methods bridge to C++ types.
*/
public init(_ implementation: any HybridImageSpec) {
public init(_ implementation: some HybridImageSpec) {
self.__implementation = implementation
/* no base class */
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class HybridTestObjectSwiftKotlinSpecCxx {
* Create a new `HybridTestObjectSwiftKotlinSpecCxx` that wraps the given `HybridTestObjectSwiftKotlinSpec`.
* All properties and methods bridge to C++ types.
*/
public init(_ implementation: any HybridTestObjectSwiftKotlinSpec) {
public init(_ implementation: some HybridTestObjectSwiftKotlinSpec) {
self.__implementation = implementation
/* no base class */
}
Expand Down

0 comments on commit fcd7016

Please sign in to comment.