1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fix interface methods that return a value

This commit is contained in:
Alexander Medvednikov
2019-11-08 07:43:44 +03:00
parent 985fb91ee8
commit 7a8e7b4db8
3 changed files with 8 additions and 5 deletions

View File

@ -27,16 +27,18 @@ struct Foo {
speaker Speaker
}
fn perform_speak(s Speaker) bool {
fn perform_speak(s Speaker) {
s.speak()
return true
assert true
name := s.name()
assert name == 'Dog' || name == 'Cat'
}
fn test_perform_speak() {
d := Dog{}
assert perform_speak(d)
perform_speak(d)
cat := Cat{}
assert perform_speak(cat)
perform_speak(cat)
f := Foo {
//speaker: d
}