cx icon indicating copy to clipboard operation
cx copied to clipboard

Compilation error when using multiple return values in short hand expression.

Open vidya88 opened this issue 5 years ago • 0 comments

@asahi3g commented on Jul 3

Describe the bug Can't declare and inline initialize multiple variable from return values of a function call.

To Reproduce

package main

func foo()(i i32, f f32) {
	i = 5
	f = 1.0
}

func main()(){
	i, f := foo()

	test(i, 5, "")
	test(f, 1.0, "")
}

Expected behavior No compilation error and test pass.

Screenshots

error: pending_7.cx:9 identifier 'i' does not exist
error: pending_7.cx:9 function 'foo' expected receiving variable of type 'i32'; 'ident' was provided
error: pending_7.cx:9 function 'foo' expected receiving variable of type 'f32'; 'i32' was provided
error: pending_7.cx:11 identifier 'i' does not exist
error: pending_7.cx:15 first and second input arguments' types are not equal in 'test' call ('ident' != 'i32')
error: pending_7.cx:15 first and second input arguments' types are not equal in 'test' call ('i32' != 'f32')

Desktop:

  • OS: Linux
  • CX Version 0.7.0 commit: f999780

vidya88 avatar Sep 24 '19 02:09 vidya88