gobra
gobra copied to clipboard
Pure methods cannot implement non-pure interface methods
In the following snippet, Gobra complains that T2 does not implement the interface T1 because the 'pure' annotations of member f
in the implementation and interface do not match
type T1 interface {
f() int
}
type T2 struct{}
pure func (t T2) f() int { return 0 }
(T2) implements T1 {
(t T2) f() int {
return t.f()
}
}
Maybe I am missing something, but I believe that it is sound to allow pure methods to implement non-pure ones and that this snippet should be accepted.
How important is this? If I am not missing something, this should be quite easy to implement.
How important is this? If I am not missing something, this should be quite easy to implement.
This is definitely not urgent, but there were was at least a case in SCION where I found this limiting