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
{{ message }}
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.
Is your feature request related to a problem? Please describe.
It is just not optimal to use the gryphon annotation for override, also I always forget to add it and then I discover the problem when trying to use it.
Describe the solution you'd like
It would be really nice if a interface implementation already came with the override annotation
So for this Swift code:
protocol A {
var b: Double { get set }
func f() -> String
}
class Foo : A {
var b: Double
init(b: Double) {
self.b = b
}
func f() -> String {
}
}
I would like to get this Kotlin code
internal interface A {
var b: Double
fun f(): String
}
internal open class Foo: A {
override var b: Double
constructor(b: Double) {
this.b = b
}
override fun f(): String {
}
}
Describe alternatives you've considered
Since it is hard to know if a function is regarding the implementation of the interface, if the function signature or the variable matches the implemented interface, add the override annotation
The text was updated successfully, but these errors were encountered:
So, I've wanted to do this for a while now, but it's not as easy as I'd hoped.
The basic structure for storing protocols, comparing the functions and adding the override is pretty much already there; I added an initial implementation of the parts that were missing in in the automatic-overrides branch.
The issue comes when checking if the function's type is a match. If we have a class B conforming to a protocol A, a function in B would have the type (B) -> () -> (), and a function in A would have the type <Self where Self : A> (Self) -> () -> (). Considering how these function types can be arbitrarily complicated, it's hard to implement this matching logic while treating types as common strings like we currently do.
It would be a lot easier, however, if we treated types as proper data structures, something I've also been wanting to do for a while (there's even a prototype implementation of this in the type-refactoring branch, though it's really old). I added issue #64 to track this.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Is your feature request related to a problem? Please describe.
It is just not optimal to use the gryphon annotation for override, also I always forget to add it and then I discover the problem when trying to use it.
Describe the solution you'd like
It would be really nice if a interface implementation already came with the override annotation
So for this Swift code:
I would like to get this Kotlin code
Describe alternatives you've considered
Since it is hard to know if a function is regarding the implementation of the interface, if the function signature or the variable matches the implemented interface, add the override annotation
The text was updated successfully, but these errors were encountered: