mirror of
https://github.com/vlang/v.git
synced 2025-09-08 23:07:19 -04:00
This commit is contained in:
parent
8b5ee60275
commit
056998a42a
@ -4694,8 +4694,8 @@ fn (mut c Checker) mark_as_referenced(mut node ast.Expr, as_interface bool) {
|
||||
return
|
||||
}
|
||||
type_sym := c.table.sym(obj.typ.set_nr_muls(0))
|
||||
if obj.is_stack_obj && !type_sym.is_heap() && !c.pref.translated
|
||||
&& !c.file.is_translated {
|
||||
if obj.is_stack_obj && !type_sym.is_heap() && !type_sym.is_int()
|
||||
&& !c.pref.translated && !c.file.is_translated {
|
||||
suggestion := if type_sym.kind == .struct {
|
||||
'declaring `${type_sym.name}` as `@[heap]`'
|
||||
} else {
|
||||
|
12
vlib/v/tests/interfaces/interface_int_test.v
Normal file
12
vlib/v/tests/interfaces/interface_int_test.v
Normal file
@ -0,0 +1,12 @@
|
||||
module main
|
||||
|
||||
interface Value {}
|
||||
|
||||
fn test_main() {
|
||||
mut a := []string{len: 10}
|
||||
mut v := []Value{}
|
||||
for i := 0; i < a.len; i++ {
|
||||
v << i
|
||||
}
|
||||
assert v[0] == Value(0)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user