1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
allow interface method with empty (void) return type

-> only look for type declaration if no new line has been
   while skipping whitespace
This commit is contained in:
marco
2019-07-03 21:53:25 +02:00
committed by Alexander Medvednikov
parent 7fdd94fcbb
commit 155e1fa961
3 changed files with 68 additions and 13 deletions

View File

@ -0,0 +1,32 @@
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)
}