mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
This commit is contained in:
parent
b3073b96b5
commit
98ca0f075e
2 changed files with 23 additions and 0 deletions
|
@ -799,7 +799,10 @@ fn (mut p Parser) interface_decl() ast.InterfaceDecl {
|
|||
}
|
||||
if p.tok.kind.is_start_of_type() && p.tok.line_nr == line_nr {
|
||||
method.return_type_pos = p.tok.pos()
|
||||
last_inside_return := p.inside_fn_return
|
||||
p.inside_fn_return = true
|
||||
method.return_type = p.parse_type()
|
||||
p.inside_fn_return = last_inside_return
|
||||
method.return_type_pos = method.return_type_pos.extend(p.tok.pos())
|
||||
method.pos = method.pos.extend(method.return_type_pos)
|
||||
}
|
||||
|
|
20
vlib/v/tests/interfaces/interface_fixed_array_ret_test.v
Normal file
20
vlib/v/tests/interfaces/interface_fixed_array_ret_test.v
Normal file
|
@ -0,0 +1,20 @@
|
|||
interface IValue {
|
||||
value() [2]int
|
||||
}
|
||||
|
||||
struct Speed {
|
||||
data [2]int
|
||||
}
|
||||
|
||||
fn (s Speed) value() [2]int {
|
||||
return s.data
|
||||
}
|
||||
|
||||
fn get_value(v IValue) [2]int {
|
||||
return v.value()
|
||||
}
|
||||
|
||||
fn test_main() {
|
||||
s := Speed{[35, 36]!}
|
||||
assert get_value(s) == [35, 36]!
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue