1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/compiler/tests/interface_test.v
marco 155e1fa961 FIX #202
allow interface method with empty (void) return type

-> only look for type declaration if no new line has been
   while skipping whitespace
2019-07-04 01:04:10 +02:00

33 lines
339 B
V

struct Dog {
}
fn (d Dog) speak() {
println('dog.speak()')
}
fn (d Dog) name() string {
return 'old gray'
}
interface Speaker {
name() string
speak()
}
interface Speak2er {
speak()
name() string
}
fn perform_speak(s Speaker) bool {
s.speak()
return true
}
fn test_perform_speak() {
d := Dog{}
assert perform_speak(d)
}