cx icon indicating copy to clipboard operation
cx copied to clipboard

Cx is not supporting short-circuit evaluation

Open vidya88 opened this issue 5 years ago • 0 comments

@asahi3g commented on May 10

Describe the bug Cx is not supporting short-circuit evaluation

To Reproduce

package main

var count i32
func True(i i32) (out bool) {
	out = true
	count = i
}

func False(i i32) (out bool) {
	out = false
	count = i
}

func foo(b0 bool, b1 bool, b2 bool) {
}

func main()() {
	var b bool

	b = True(4) || True(5)
	test(count, 4, "a")

	if True(6) == true || True(7) == true {
	}
	test(count, 6, "b")

	b = False(8) && True(9)
	test(count, 8, "c")

	if False(10) == true && True(11) == true {
	}
	test(count, 10, "d")

	foo(True(12), True(13), True(14))
	test(count, 14, "e")
}

Expected behavior Cx must support short-circuit an test must pass.

Screenshots

byts1 [5 0 0 0]
byts2 [4 0 0 0]
pending_1.cx: 21: result was not equal to the expected value; a
byts1 [7 0 0 0]
byts2 [6 0 0 0]
pending_1.cx: 25: result was not equal to the expected value; b
byts1 [9 0 0 0]
byts2 [8 0 0 0]
pending_1.cx: 28: result was not equal to the expected value; c
byts1 [11 0 0 0]
byts2 [10 0 0 0]
pending_1.cx: 32: result was not equal to the expected value; d

Desktop (please complete the following information):

  • OS: linux
  • CX Version 0.6.2 commit 4ba0d2d

vidya88 avatar Sep 24 '19 03:09 vidya88