Open mvenditto opened 2 years ago
This is because the anon func is being generated using the same name on parser phase.
struct Foo {}
fn (f Foo) foo() {
println('foo')
}
fn (f Foo) bar() {
println('bar')
}
fn main() {
f := Foo {}
$for method in Foo.methods {
$if method.name == 'foo' {
x := fn [method, f]() {
f.$method()
}
x()
}
$if method.name == 'bar' {
x := fn [method, f]() {
f.$method()
}
x()
}
}
}
Make it works.
V version: V 0.2.4 1b691e7.5ab91dd OS: linux, Ubuntu 21.10 (VM)
maybe an edge case, but comptime calls seems to behave wrong if nested inside anon funcs.
What did you do?
What did you expect to see?
What did you see instead?