v icon indicating copy to clipboard operation
v copied to clipboard

V can't compile `go println(fib(i))`

Open threeid opened this issue 7 years ago • 1 comments

Hi medvednikov,

The following bug was found on Chrome with V version: V 0.0.10.

You just found a bug. V can't compile this program, but it should.

fn fib(n int) int {
	if n <= 1 {
		return n
	}
	return fib(n - 1) + fib(n - 2)
}

fn main() {
	for i := 0; i < 10; i++ {
            go println(fib(i))
	}
}

threeid avatar Jun 08 '19 09:06 threeid

Thanks, fixed.

println is a special generic function, and it didn't work with go.

It's much easier to just not allow it, at least for now, since calling go println() doesn't make much sense.

`go` cannot be used with `println`

medvednikov avatar Jun 08 '19 12:06 medvednikov