diff --git a/conformance/lang/expressions/is-expr/is_expr.balt b/conformance/lang/expressions/is-expr/is_expr.balt index ccb0bc77..641cc429 100644 --- a/conformance/lang/expressions/is-expr/is_expr.balt +++ b/conformance/lang/expressions/is-expr/is_expr.balt @@ -1453,7 +1453,7 @@ function init() { ]; io:println(i is any); // @output true - table> j = table key(a) [ + table> j = table [ {a: 1, b: error("E1")}, {a: 2, b: error("E2")} ]; @@ -1841,11 +1841,18 @@ function init() { io:println(d is int:Unsigned32); // @output true io:println(d is byte); // @output true - any e = table key(x) [{x: 1, y: [10.2, "A"]}]; - io:println(e is TableType); // @output true + any e = table [{x: 1, y: [10.2, "A"]}]; + io:println(e is TableType); // @output false io:println(e is table>); // @output false - io:println(e is table key); // @output true - io:println(e is anydata); // @output true + io:println(e is table key); // @output false + io:println(e is anydata); // @output false + + TableType h = table [{x: 1, y: [10.2, "A"]}]; + io:println(h is any); // @output true + io:println(h is table key); // @output true + io:println(h is table); // @output true + io:println(h is table); // @output true + io:println(h is anydata); // @output true record {|readonly int x; [float, string] y;|} f = {x: 1, y: [10.2, "A"]}; io:println(f is Record); // @output true diff --git a/conformance/lang/expressions/is-expr/negation_is_expr.balt b/conformance/lang/expressions/is-expr/negation_is_expr.balt index 71d66a4f..dfed7171 100644 --- a/conformance/lang/expressions/is-expr/negation_is_expr.balt +++ b/conformance/lang/expressions/is-expr/negation_is_expr.balt @@ -1454,7 +1454,7 @@ function init() { ]; io:println(i !is any); // @output false - table> j = table key(a) [ + table> j = table [ {a: 1, b: error("E1")}, {a: 2, b: error("E2")} ]; @@ -1842,11 +1842,18 @@ function init() { io:println(d !is int:Unsigned32); // @output false io:println(d !is byte); // @output false - any e = table key(x) [{x: 1, y: [10.2, "A"]}]; - io:println(e !is TableType); // @output false + any e = table [{x: 1, y: [10.2, "A"]}]; + io:println(e !is TableType); // @output true io:println(e !is table>); // @output true - io:println(e !is table key); // @output false - io:println(e !is anydata); // @output false + io:println(e !is table); // @output true + io:println(e !is anydata); // @output true + + TableType h = table [{x: 1, y: [10.2, "A"]}]; + io:println(h !is any); // @output false + io:println(h !is table key); // @output false + io:println(h !is table); // @output false + io:println(h !is table); // @output false + io:println(h !is anydata); // @output false record {|readonly int x; [float, string] y;|} f = {x: 1, y: [10.2, "A"]}; io:println(f !is Record); // @output false diff --git a/conformance/lang/expressions/multiplicative-expr/multiplicative_expr.balt b/conformance/lang/expressions/multiplicative-expr/multiplicative_expr.balt index 54b6eabd..41d75fd6 100644 --- a/conformance/lang/expressions/multiplicative-expr/multiplicative_expr.balt +++ b/conformance/lang/expressions/multiplicative-expr/multiplicative_expr.balt @@ -69,14 +69,10 @@ type Ints 1|2; type Floats 2.0|3.0|4.0; type Decimals 1d|4.12d; -function errorFunction(int:Signed8 a, int:Signed16 b, int:Signed32 c, - int:Unsigned8 d, int:Unsigned16 e, int:Unsigned32 f, - byte g, Ints h, Floats i, Decimals j, - int:Unsigned8? k, Ints? l, Floats? m, Decimals? n) { +function errorFunction(int:Signed8 a, int:Signed32 c, int:Unsigned16 e, int:Unsigned32 f, byte g, + Ints h, Floats i, Decimals j, int:Unsigned8? k, Ints? l, Floats? m, Decimals? n) { int:Signed8 _ = a * i; // @error * is not allowed with operands of different basic types - decimal _ = j / b; // @error / is not allowed with operands of different basic types float _ = c % m; // @error % is not allowed with operands of different basic types - float _ = i * d; // @error * is not allowed with operands of different basic types int _ = e / j; // @error / is not allowed with operands of different basic types float _ = m % f; // @error % is not allowed with operands of different basic types int _ = g * n; // @error * is not allowed with operands of different basic types diff --git a/conformance/lang/expressions/range-expr/range_expr_exclusive.balt b/conformance/lang/expressions/range-expr/range_expr_exclusive.balt new file mode 100644 index 00000000..a53ad5c0 --- /dev/null +++ b/conformance/lang/expressions/range-expr/range_expr_exclusive.balt @@ -0,0 +1,6023 @@ +Test-Case: output +Description: Test range expression (exclusive) when values of both expressions are positive integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int startIndex = 0; + int endIndex = 6; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 6 + io:println(arr); // @output [0,1,2,3,4,5] +} + +Test-Case: output +Description: Test range expression (exclusive) when values of both expressions are negative integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-exclusive, list-constructor-expr, + range-expr, unary-minus + +function init() { + int startIndex = -6; + int endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 5 + io:println(arr); // @output [-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) when the value of one expression is a negative integer and the value of the other + expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-exclusive, list-constructor-expr, + range-expr, unary-minus + +function init() { + int startIndex = -10; + int endIndex = 20; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 30 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19] +} + +Test-Case: output +Description: Test range expression (exclusive) when the value of one expression is a negative integer and the value of the other + expression is a positive integer. +Labels: additive-expr, DecimalNumber, foreach-stmt, int, iterable-exclusive, range-expr, unary-minus + +function init() { + int startIndex = -7635315; + int endIndex = 964732; + int count = 0; + foreach int i in startIndex ..< endIndex { + count = count + i; + } + io:println(count); // @output -28683667958724 +} + +Test-Case: output +Description: Test range expression (exclusive) when values of both expressions are positive Signed8 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed8 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr[count] = i; + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when values of both expressions are negative Signed8 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed8 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) when the value of one expression is a negative Signed8 integer and + the value of the other expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed8 endIndex = 20; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 30 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19] +} + +Test-Case: output +Description: Test range expression (exclusive) when values of both expressions are positive Signed16 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed16 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when values of both expressions are negative Signed16 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed16 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) when the value of one expression is a negative Signed16 integer and + the value of the other expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed16 endIndex = 20; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 30 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19] +} + +Test-Case: output +Description: Test range expression (exclusive) when values of both expressions are positive Signed32 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed32 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when values of both expressions are negative Signed32 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed32 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) when the value of one expression is a negative Signed32 integer and + the value of the other expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed32 endIndex = 20; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 30 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19] +} + +Test-Case: output +Description: Test range expression (exclusive) when values of both expressions are Unsigned8 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned8 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when values of both expressions are bytes. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + byte startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when values of both expressions are Unsigned16 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned16 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when values of both expressions are Unsigned32 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned32 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive integer and value of the + second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative integer and value of the + second expression is a negative Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int startIndex = -10; + int:Signed8 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative integer and value of the + second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int startIndex = -10; + int:Signed8 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive integer and value of the + second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative integer and value of the + second expression is a negative Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int startIndex = -10; + int:Signed16 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative integer and value of the + second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int startIndex = -10; + int:Signed16 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive integer and value of the + second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative integer and value of the + second expression is a negative Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int startIndex = -10; + int:Signed32 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative integer and value of the + second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int startIndex = -10; + int:Signed32 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive integer and value of the + second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative integer and value of the + second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int startIndex = -10; + int:Unsigned8 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive integer and value of the + second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, iterable-exclusive, list-constructor-expr, + range-expr + +function init() { + int startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative integer and value of the + second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, iterable-exclusive, list-constructor-expr, + range-expr, unary-minus + +function init() { + int startIndex = -10; + byte endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive integer and value of the + second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative integer and value of the + second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int startIndex = -10; + int:Unsigned16 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive integer and value of the + second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative integer and value of the + second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int startIndex = -10; + int:Unsigned32 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed8 integer and value of the + second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed8 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed8 integer and value of the + second expression is a negative integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed8 integer and value of the + second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed8 integer and value of the + second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed8 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed8 integer and value of the + second expression is a negative Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed16 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed8 integer and value of the + second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed16 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed8 integer and value of the + second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed8 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed8 integer and value of the + second expression is a negative Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed32 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed8 integer and value of the + second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed32 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed8 integer and value of the + second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed8 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed8 integer and value of the + second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Unsigned8 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed8 integer and value of the + second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed8 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed8 integer and value of the + second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + byte endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed8 integer and value of the + second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned16, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed8 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed8 integer and value of the + second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned16, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Unsigned16 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed8 integer and value of the + second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned32, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed8 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed8 integer and value of the + second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned32, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Unsigned32 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed16 integer and value of the + second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed16 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed16 integer and value of the + second expression is a negative integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed16 integer and value of the + second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed16 integer and value of the + second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed16 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed16 integer and value of the + second expression is a negative Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed8 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed16 integer and value of the + second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed8 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed16 integer and value of the + second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed16 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed16 integer and value of the + second expression is a negative Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed32 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed16 integer and value of the + second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed32 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed16 integer and value of the + second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed16 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed16 integer and value of the + second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Unsigned8 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed16 integer and value of the + second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed16 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed16 integer and value of the + second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + byte endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed16 integer and value of the + second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned16, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed16 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed16 integer and value of the + second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned16, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Unsigned16 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed16 integer and value of the + second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned32, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed16 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed16 integer and value of the + second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned32, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Unsigned32 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed32 integer and value of the + second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed32 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed32 integer and value of the + second expression is a negative integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed32 integer and value of the + second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed32 integer and value of the + second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed32 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed32 integer and value of the + second expression is a negative Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed8 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed32 integer and value of the + second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed8 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed32 integer and value of the + second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed32 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed32 integer and value of the + second expression is a negative Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed16 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed32 integer and value of the + second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed16 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed32 integer and value of the + second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed32 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed32 integer and value of the + second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned8, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Unsigned8 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed32 integer and value of the + second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed32 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed32 integer and value of the + second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + byte endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed32 integer and value of the + second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned16, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed32 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed32 integer and value of the + second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned16, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Unsigned16 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a positive Signed32 integer and value of the + second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned32, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed32 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a negative Signed32 integer and value of the + second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned32, iterable-exclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Unsigned32 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned8 integer and value of the + second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned8 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned8 integer and value of the + second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned8 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned8 integer and value of the + second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned8 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned8 integer and value of the + second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned8 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned8 integer and value of the + second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Unsigned8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned8 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned8 integer and value of the + second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, int:Unsigned8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned8 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned8 integer and value of the + second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, int:Unsigned8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned8 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned16 integer and value of the + second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned16 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned16 integer and value of the + second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned16, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned16 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned16 integer and value of the + second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned16, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned16 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned16 integer and value of the + second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned16, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned16 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned16 integer and value of the + second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, int:Unsigned8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned16 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned16 integer and value of the + second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Unsigned16, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned16 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned16 integer and value of the + second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, int:Unsigned32, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned16 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned32 integer and value of the + second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned32 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned32 integer and value of the + second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned32, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned32 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned32 integer and value of the + second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned32, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned32 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned32 integer and value of the + second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned32, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned32 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned32 integer and value of the + second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, int:Unsigned8, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned32 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned32 integer and value of the + second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Unsigned32, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned32 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when value of the first expression is a Unsigned32 integer and value of the + second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, int:Unsigned32, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned32 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when values of both expressions are of user-defined subtypes of int. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-exclusive, list-constructor-expr, + module-type-defn, range-expr, singleton-type, union-type + +type Ints 1|10; + +function init() { + Ints startIndex = 1; + Ints endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when values of both expressions are of singleton types of int. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-exclusive, list-constructor-expr, + module-type-defn, range-expr, singleton-type + +type TEN 10; + +function init() { + 1 startIndex = 1; + TEN endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when values of both expressions are of union of int subtypes. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned32, iterable-exclusive, + list-constructor-expr, range-expr, union-type + +function init() { + int:Signed8|int:Unsigned32 startIndex = 1; + int:Signed8|int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when the value of the first expression and the value of the second expression + is equal. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-exclusive, list-constructor-expr, range-expr + +function init() { + int startIndex = 5; + int endIndex = 5; + int count = 0; + int[] arr = []; + + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 0 + io:println(arr); // @output [] +} + +Test-Case: output +Description: Test range expression (exclusive) when the value of the first expression is less than the + value of the second expression. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-exclusive, list-constructor-expr, range-expr + +function init() { + int startIndex = 5; + int endIndex = 3; + int count = 0; + int[] arr = []; + + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 0 + io:println(arr); // @output [] +} + +Test-Case: output +Description: Test range expression (exclusive) when the types expressions are inferred. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-exclusive, list-constructor-expr, + range-expr, var + +function init() { + var startIndex = 1; + var endIndex = 10; + int count = 0; + int[] arr = []; + + foreach int i in startIndex ..< endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test int literals as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-exclusive, list-constructor-expr, + range-expr + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in 1 ..< 10 { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test field and member access as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, field-access-expr, foreach-stmt, int, iterable-exclusive, + list-constructor-expr, mapping-constructor-expr, member-access-expr, module-type-defn, range-expr, record-type + +type Record record { + int x; +}; + +function init() { + Record c = {x: 10}; + int[] d = [30, 40]; + int count = 0; + int[] arr = []; + + foreach int i in c.x ..< d[0] { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 20 + io:println(arr); // @output [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29] +} + +Test-Case: output +Description: Test function and method call as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, explicit-new-expr, foreach-stmt, function-call-expr, int, + iterable-exclusive, list-constructor-expr, method-call-expr, module-class-defn, range-expr + +class Class { + function getInt() returns int { + return 1; + } +} + +function init() { + Class cls = new Class(); + int count = 0; + int[] arr = []; + + foreach int i in cls.getInt() ..< getInt() { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +function getInt() returns int { + return 10; +} + +Test-Case: output +Description: Test type cast expression as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-exclusive, list-constructor-expr, + range-expr, type-cast-expr + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in 1.0 ..< 10.0 { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test unary expressions as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-exclusive, list-constructor-expr, + range-expr, unary-complement, unary-minus, unary-plus + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in -10 ..< +2 { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] + + count = 0; + arr = []; + foreach int i in -10 ..< ~2 { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 7 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4] +} + +Test-Case: output +Description: Test additive expression as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-exclusive, list-constructor-expr, range-expr + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in 0+1 ..< 12-2 { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test multiplicative expressions as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-exclusive, list-constructor-expr, + multiplicative-expr, range-expr + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in 1*2 ..< 36/4 { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 7 + io:println(arr); // @output [2,3,4,5,6,7,8] + + count = 0; + arr = []; + foreach int i in 34%5 ..< 4*5 { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 16 + io:println(arr); // @output [4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19] +} + +Test-Case: output +Description: Test binary bitwise expressions as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, binary-bitwise-expr, DecimalNumber, foreach-stmt, int, iterable-exclusive, + list-constructor-expr, range-expr + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in (1&2) ..< (4|8) { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [0,1,2,3,4,5,6,7,8,9,10,11] + + count = 0; + arr = []; + foreach int i in (6|3) ..< (2^8) { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 3 + io:println(arr); // @output [7,8,9] +} + +Test-Case: output +Description: Test checking expressions as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, check, checkpanic, DecimalNumber, error, foreach-stmt, int, iterable-exclusive, + list-constructor-expr, optional-type, range-expr, union-type + +function init() returns error? { + int|error startIndex = 2; + int|error endIndex = 12; + int count = 0; + int[] arr = []; + + foreach int i in check startIndex ..< checkpanic endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [2,3,4,5,6,7,8,9,10,11] +} + +Test-Case: output +Description: Test let expression as expressions in range expression (exclusive). +Labels: DecimalNumber, foreach-stmt, int, iterable-exclusive, let-expr, range-expr + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in (let int h1 = 10 in h1) ..< (let int h1 = 25 in h1) { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 15 + io:println(arr); // @output [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24] +} + +Test-Case: output +Description: Test shift expressions as expressions in range expression (exclusive). +Labels: DecimalNumber, foreach-stmt, int, iterable-exclusive, range-expr, shift-expr + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in 1 << 2 ..< 100 >> 4 { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 2 + io:println(arr); // @output [4,5] +} + +Test-Case: output +Description: Test conditional expressions as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, binary-conditional-expr, DecimalNumber, error, foreach-stmt, int, iterable-exclusive, + list-constructor-expr, nil-literal, optional-type, range-expr, ternary-conditional-expr, union-type + +function init() { + int|error a = 10; + int? b = (); + int count = 0; + int[] arr = []; + + foreach int i in (a is error ? 5 : a) ..< (b ?: 25) { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 15 + io:println(arr); // @output [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24] +} + +Test-Case: output +Description: Test lang.int constants as expressions in range expression (exclusive). +Labels: additive-expr, foreach-stmt, int, int:SIGNED8_MAX_VALUE, int:UNSIGNED8_MAX_VALUE, iterable-exclusive, range-expr + +function init() { + int count = 0; + + foreach int i in int:SIGNED8_MAX_VALUE ..< int:UNSIGNED8_MAX_VALUE { + count = count + i; + } + io:println(count); // @output 24384 +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when values of both expressions are positive + integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int startIndex = 0; + int endIndex = 6; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 6 + io:println(arr); // @output [0,1,2,3,4,5] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when values of both expressions are negative + integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -6; + int endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 5 + io:println(arr); // @output [-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when the value of one expression is a + negative integer and the value of the other expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -10; + int endIndex = 20; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 30 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when the value of one expression is a negative + integer and the value of the other expression is a positive integer. +Labels: additive-expr, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, object-type, object-type-inclusion, + optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -7635315; + int endIndex = 964732; + int count = 0; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + count = count + i; + } + io:println(count); // @output -28683667958724 +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when values of both expressions are positive + Signed8 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type + +function init() { + int:Signed8 startIndex = 1; + int:Signed8 endIndex = 10; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + int count = 0; + int[] arr = []; + foreach int i in range { + arr[count] = i; + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when values of both expressions are negative + Signed8 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed8 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when the value of one expression is a negative + Signed8 integer and the value of the other expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed8 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when values of both expressions are positive + Signed16 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type + +function init() { + int:Signed16 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when values of both expressions are negative + Signed16 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed16 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when the value of one expression is a + negative Signed16 integer and the value of the other expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed16 endIndex = 20; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 30 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when values of both expressions are positive + Signed32 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type + +function init() { + int:Signed32 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when values of both expressions are negative + Signed32 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed32 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when the value of one expression is a + negative Signed32 integer and the value of the other expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed32 endIndex = 20; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 30 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when values of both expressions are + Unsigned8 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned8, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type + +function init() { + int:Unsigned8 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when values of both expressions are bytes. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type + +function init() { + byte startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when values of both expressions are + Unsigned16 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Unsigned16 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when values of both expressions are + Unsigned32 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Unsigned32 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a + positive integer and value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type + +function init() { + int startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a + negative integer and value of the second expression is a negative Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type, unary-minus + +function init() { + int startIndex = -10; + int:Signed8 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a + negative integer and value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type, unary-minus + +function init() { + int startIndex = -10; + int:Signed8 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a + positive integer and value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type + +function init() { + int startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a + negative integer and value of the second expression is a negative Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type, unary-minus + +function init() { + int startIndex = -10; + int:Signed16 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a + negative integer and value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type, unary-minus + +function init() { + int startIndex = -10; + int:Signed16 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a + positive integer and value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type + +function init() { + int startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a + negative integer and value of the second expression is a negative Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type, unary-minus + +function init() { + int startIndex = -10; + int:Signed32 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative + integer and value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -10; + int:Signed32 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -10; + int:Unsigned8 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive + integer and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative integer + and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -10; + byte endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive integer + and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative integer + and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -10; + int:Unsigned16 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive integer + and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative integer + and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -10; + int:Unsigned32 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed8 + integer and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed8 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a negative integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed8 + integer and value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed8 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a negative Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed16 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed16 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed8 + integer and value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed8 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a negative Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed32 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed32 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed8 + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed8 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Unsigned8 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed8 integer + and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed8 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + byte endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed8 + integer and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed8 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Unsigned16 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive + Signed8 integer and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed8 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Unsigned32 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed16 + integer and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed16 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a negative integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed16 + integer and value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed16 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a negative Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed8 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed8 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed16 + integer and value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed16 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a negative Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed32 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed32 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed16 + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed16 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Unsigned8 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed16 + integer and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed16 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + byte endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed16 + integer and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed16 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Unsigned16 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed16 + integer and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed16 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Unsigned32 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed32 + integer and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed32 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a negative integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed32 + integer and value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed32 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a negative Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed8 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed8 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed32 + integer and value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed32 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a negative Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed16 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed16 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed32 + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed32 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Unsigned8 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed32 + integer and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed32 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + byte endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed32 + integer and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed32 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Unsigned16 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a positive Signed32 + integer and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed32 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Unsigned32 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned8 + integer and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned8 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned8 + integer and value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned8 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned8 + integer and value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned8 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned8 + integer and value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned8 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned8 + integer and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned8 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned8 + integer and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned8 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned8 + integer and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned8 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned16 + integer and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned16 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned16 + integer and value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned16, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type + +function init() { + int:Unsigned16 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned16 + integer and value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned16, + isolated-method, iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, + range-expr, record-type + +function init() { + int:Unsigned16 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned16 + integer and value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned16, + isolated-method, iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, + range-expr, record-type + +function init() { + int:Unsigned16 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned16 + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned16 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned16 integer + and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned16 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned16 + integer and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, int:Unsigned32, + isolated-method, iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, + range-expr, record-type + +function init() { + int:Unsigned16 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned32 + integer and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type + +function init() { + int:Unsigned32 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned32 + integer and value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned32, + isolated-method, iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, + range-expr, record-type + +function init() { + int:Unsigned32 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned32 + integer and value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned32, + isolated-method, iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, + range-expr, record-type + +function init() { + int:Unsigned32 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned32 + integer and value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned32, + isolated-method, iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, + range-expr, record-type + +function init() { + int:Unsigned32 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned32 + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, int:Unsigned8, + isolated-method, iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, + range-expr, record-type + +function init() { + int:Unsigned32 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned32 + integer and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Unsigned32, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type + +function init() { + int:Unsigned32 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when value of the first expression is a Unsigned32 + integer and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, int:Unsigned32, + isolated-method, iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, + range-expr, record-type + +function init() { + int:Unsigned32 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when values of both expressions are of + user-defined subtypes of int. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, module-type-defn, object-type, object-type-inclusion, optional-type, range-expr, + record-type, singleton-type, union-type + +type Ints 1|10; + +function init() { + Ints startIndex = 1; + Ints endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when values of both expressions are of singleton + types of int. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, module-type-defn, object-type, object-type-inclusion, optional-type, range-expr, + record-type, singleton-type + +type TEN 10; + +function init() { + 1 startIndex = 1; + TEN endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when values of both expressions are of union of + int subtypes. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned32, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type, union-type + +function init() { + int:Signed8|int:Unsigned32 startIndex = 1; + int:Signed8|int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when the value of the first expression and the value of the + second expression is equal. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int startIndex = 5; + int endIndex = 5; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 0 + io:println(arr); // @output [] +} + +Test-Case: output +Description: Test range expression (exclusive) when the value of the first expression is less than the + value of the second expression. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int startIndex = 5; + int endIndex = 3; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 0 + io:println(arr); // @output [] +} + +Test-Case: output +Description: Test range expression (exclusive) with iterable object when the types of the expressions are inferred. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, var + +function init() { + var startIndex = 1; + var endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) when the types of the expressions and type of the range expression are inferred. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, range-expr, var + +function init() { + var startIndex = 1; + var endIndex = 10; + int count = 0; + int[] arr = []; + + var range = startIndex ..< endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) at module level. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, module-init-var-decl, object-type, object-type-inclusion, optional-type, range-expr, + record-type + +int startIndex = 1; +int endIndex = 10; + +object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; +} range = startIndex ..< endIndex; + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test range expression (exclusive) at module level with var. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, module-init-var-decl, range-expr, var + +int startIndex = 1; +int endIndex = 10; + +var range = startIndex ..< endIndex; + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test iterable object returned by the range expression (exclusive). +Labels: array-type, array:push, DecimalNumber, foreach-stmt, int, list-constructor-expr, method-call-expr, object-type, + optional-type, range-expr, value:toBalString, var + +function init() { + object { + public isolated function iterator() returns (object { + public isolated function next() returns (record {|int value;|}?); + }); + } range = 1 ..< 3; + + var iterator = range.iterator(); + + record {| int value; |}? rec = iterator.next(); + io:println(rec); // @output {"value":1} + io:println(rec?.value); // @output 1 + + rec = iterator.next(); + io:println(rec); // @output {"value":2} + io:println(rec?.value); // @output 2 + + rec = iterator.next(); + io:println(rec.toBalString()); // @output () + io:println(rec?.value.toBalString()); // @output () +} + +Test-Case: output +Description: Test int literals as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = 1 ..< 10; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test field and member access as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, field-access-expr, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, mapping-constructor-expr, member-access-expr, module-type-defn, object-type, object-type-inclusion, + optional-type, range-expr, record-type + +type Record record { + int x; +}; + +function init() { + Record c = {x: 10}; + int[] d = [30, 40]; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = c.x ..< d[0]; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 20 + io:println(arr); // @output [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29] +} + +Test-Case: output +Description: Test function and method call as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, explicit-new-expr, foreach-stmt, function-call-expr, int, + isolated-method, iterable-object, list-constructor-expr, method-call-expr, module-class-defn, object-type, + object-type-inclusion, optional-type, range-expr, record-type + +class Class { + function getInt() returns int { + return 1; + } +} + +function init() { + Class cls = new Class(); + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = cls.getInt() ..< getInt(); + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +function getInt() returns int { + return 10; +} + +Test-Case: output +Description: Test type cast expression as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, + type-cast-expr + +function init() { + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = 1.0 ..< 10.0; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test unary expressions as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, + unary-complement, unary-minus, unary-plus + +function init() { + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = -10 ..< +2; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1] + + count = 0; + arr = []; + range = -10 ..< ~2; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 7 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4] +} + +Test-Case: output +Description: Test additive expression as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = 0+1 ..< 12-2; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: output +Description: Test multiplicative expressions as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, multiplicative-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type + +function init() { + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = 1*2 ..< 36/4; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 7 + io:println(arr); // @output [2,3,4,5,6,7,8] + + count = 0; + arr = []; + range = 34%5 ..< 4*5; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 16 + io:println(arr); // @output [4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19] +} + +Test-Case: output +Description: Test binary bitwise expressions as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, binary-bitwise-expr, DecimalNumber, foreach-stmt, int, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type + +function init() { + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = (1&2) ..< (4|8); + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 12 + io:println(arr); // @output [0,1,2,3,4,5,6,7,8,9,10,11] + + count = 0; + arr = []; + range = (6|3) ..< (2^8); + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 3 + io:println(arr); // @output [7,8,9] +} + +Test-Case: output +Description: Test checking expressions as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, check, checkpanic, DecimalNumber, error, foreach-stmt, int, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type, union-type + +function init() returns error? { + int|error startIndex = 2; + int|error endIndex = 12; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = check startIndex ..< checkpanic endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [2,3,4,5,6,7,8,9,10,11] +} + +Test-Case: output +Description: Test let expression as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + let-expr, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = (let int h1 = 10 in h1) ..< (let int h1 = 25 in h1); + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 15 + io:println(arr); // @output [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24] +} + +Test-Case: output +Description: Test shift expressions as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, shift-expr + +function init() { + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = 1<<2 ..< 100>>4; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 2 + io:println(arr); // @output [4,5] +} + +Test-Case: output +Description: Test conditional expressions as expressions in range expression (exclusive). +Labels: additive-expr, array-type, array:push, conditional-expr, DecimalNumber, error, foreach-stmt, int, isolated-method, + iterable-object, list-constructor-expr, nil-literal, object-type, object-type-inclusion, optional-type, + range-expr, record-type, union-type + +function init() { + int|error a = 10; + int? b = (); + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = (a is error ? 5 : a) ..< (b ?: 25); + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 15 + io:println(arr); // @output [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24] +} + +Test-Case: output +Description: Test lang.int constants as expressions in range expression (exclusive). +Labels: additive-expr, DecimalNumber, foreach-stmt, int, int:SIGNED8_MAX_VALUE, int:UNSIGNED8_MAX_VALUE, isolated-method, + iterable-object, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int count = 0; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = int:SIGNED8_MAX_VALUE ..< int:UNSIGNED8_MAX_VALUE; + + foreach int i in range { + count = count + i; + } + io:println(count); // @output 24384 +} + +Test-Case: output +Description: Test isolatedness of range expression (exclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, function-call-expr, int, isolated-method, + iterable-object, list-constructor-expr, lock-stmt, object-type, object-type-inclusion, optional-type, + range-expr, record-type + +isolated int j = 1; + +function init() { + int count = 0; + int[] arr = []; + foreach int i in getRange() { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 9 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9] +} + +function getRange() returns object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; +} { + lock { + return j ..< j + 9; + } +} + +Test-Case: output +Description: Test isolatedness of the resultant object of the range expression (exclusive). +Labels: any, array-type, array:push, int, is-expr, isolated-method, list-constructor-expr, object-type, + object-type-inclusion, optional-type, range-expr, record-type, type-cast-expr + +function init() { + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = 1 ..< 10; + + io:println(range is isolated object {}); // @output true +} + +Test-Case: output +Description: Test isolatedness of the iterator() and next() methods of range expression (exclusive). +Labels: array-type, array:push, DecimalNumber, int, is-expr, list-constructor-expr, method-call-expr, object-type, + optional-type, range-expr, record-type + +type IsolatedIterable isolated object { + public isolated function iterator() returns isolated object { + public isolated function next() returns record {| int value; |}?; + }; +}; + +function init() { + object {} range = 1 ..< 10; + + io:println(range is IsolatedIterable); // @output true +} + +Test-Case: output +Description: Test range expression (exclusive) with query expression. +Labels: array-type, array:push, DecimalNumber, int, list-constructor-expr, query-expr, range-expr + +function init() { + int[] a = from int i in 1 ..< 10 + select i; + + io:println(a); // @output [1,2,3,4,5,6,7,8,9] +} + +Test-Case: error +Description: Test range expression (exclusive) when static type of either of the expression is not a subtype of int. +Labels: DecimalFloatingPointNumber, int, range-expr, string + +function errorFunction() { + _ = 1.0 ..< 10; // @error ..< not defined when static type of either of the expression is not a subtype of int + _ = 1 ..< 10.0; // @error ..< not defined when static type of either of the expression is not a subtype of int + _ = 1.0 ..< 10.0; // @error ..< not defined when static type of either of the expression is not a subtype of int + + _ = "1" ..< 10; // @error ..< not defined when static type of either of the expression is not a subtype of int + _ = 1 ..< "10"; // @error ..< not defined when static type of either of the expression is not a subtype of int + _ = "1" ..< "10"; // @error ..< not defined when static type of either of the expression is not a subtype of int +} + +Test-Case: error +Description: Test assigning the result of range expression (exclusive) to an incompatible type. +Labels: DecimalNumber, float, int, isolated-method, object-type, optional-type, range-expr, record-type + +function errorFunction() { + int _ = 1 ..< 10; // @error expects an int, but the result of a range expression is an object + + object { + public isolated function iterator() returns (object { + public isolated function next() returns (record {|float value;|}?); + }); + } _ = 1 ..< 10; // @error expects next() returning record {|float value;|}?, but the next() of range expression's iterable object returns a record {|int value;|}? +} + +Test-Case: error +Description: Test assigning the result of range expression (exclusive) to an incompatible type when the static + type of the range expression is inferred. +Labels: DecimalNumber, float, int, isolated-method, object-type, optional-type, range-expr, record-type, var + +function errorFunction() { + var a = 1 ..< 10; + + int _ = a; // @error expects an int, but the result of a range expression is an object + + object { + public isolated function iterator() returns (object { + public isolated function next() returns (record {|float value;|}?); + }); + } _ = a; // @error expects next() returning record {|float value;|}?, but the next() of range expression's iterable object returns a record {|int value;|}? +} diff --git a/conformance/lang/expressions/range-expr/range_expr_inclusive.balt b/conformance/lang/expressions/range-expr/range_expr_inclusive.balt new file mode 100644 index 00000000..1eb50337 --- /dev/null +++ b/conformance/lang/expressions/range-expr/range_expr_inclusive.balt @@ -0,0 +1,6010 @@ +Test-Case: output +Description: Test range expression (inclusive) when values of both expressions are positive integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-inclusive, list-constructor-expr, + range-expr + +function init() { + int startIndex = 0; + int endIndex = 6; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 7 + io:println(arr); // @output [0,1,2,3,4,5,6] +} + +Test-Case: output +Description: Test range expression (inclusive) when values of both expressions are negative integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-inclusive, list-constructor-expr, + range-expr, unary-minus + +function init() { + int startIndex = -6; + int endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 6 + io:println(arr); // @output [-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) when the value of one expression is a negative integer and + the value of the other expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-inclusive, list-constructor-expr, + range-expr, unary-minus + +function init() { + int startIndex = -10; + int endIndex = 20; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 31 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] +} + +Test-Case: output +Description: Test range expression (inclusive) when the value of one expression is a negative integer and + the value of the other expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-inclusive, list-constructor-expr, + range-expr, unary-minus + +function init() { + int startIndex = -7635315; + int endIndex = 964732; + int count = 0; + foreach int i in startIndex ... endIndex { + count = count + i; + } + io:println(count); // @output -28683666993992 +} + +Test-Case: output +Description: Test range expression (inclusive) when values of both expressions are positive Signed8 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed8 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when values of both expressions are negative Signed8 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed8 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) when the value of one expression is a negative Signed8 integer and + the value of the other expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed8 endIndex = 20; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 31 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] +} + +Test-Case: output +Description: Test range expression (inclusive) when values of both expressions are positive Signed16 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed16 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when values of both expressions are negative Signed16 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed16 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) when the value of one expression is a negative Signed16 integer and + the value of the other expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed16 endIndex = 20; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 31 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] +} + +Test-Case: output +Description: Test range expression (inclusive) when values of both expressions are positive Signed32 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed32 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when values of both expressions are negative Signed32 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed32 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) when the value of one expression is a negative Signed32 integer and + the value of the other expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed32 endIndex = 20; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 31 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] +} + +Test-Case: output +Description: Test range expression (inclusive) when values of both expressions are Unsigned8 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned8 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when values of both expressions are bytes. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + byte startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when values of both expressions are Unsigned16 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned16 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when values of both expressions are Unsigned32 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned32 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive integer and value of the + second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative integer and value of the + second expression is a negative Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int startIndex = -10; + int:Signed8 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative integer and value of the + second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int startIndex = -10; + int:Signed8 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive integer and value of the + second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative integer and value of the + second expression is a negative Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int startIndex = -10; + int:Signed16 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative integer and value of the + second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int startIndex = -10; + int:Signed16 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive integer and value of the + second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative integer and value of the + second expression is a negative Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int startIndex = -10; + int:Signed32 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative integer and value of the + second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int startIndex = -10; + int:Signed32 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive integer and value of the + second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative integer and value of the + second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int startIndex = -10; + int:Unsigned8 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive integer and value of the + second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, iterable-inclusive, list-constructor-expr, + range-expr + +function init() { + int startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative integer and value of the + second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, iterable-inclusive, list-constructor-expr, + range-expr, unary-minus + +function init() { + int startIndex = -10; + byte endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive integer and value of the + second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative integer and value of the + second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int startIndex = -10; + int:Unsigned16 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive integer and value of the + second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative integer and value of the + second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int startIndex = -10; + int:Unsigned32 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed8 integer + and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed8 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed8 integer and + value of the second expression is a negative integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed8 integer and + value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed8 integer and + value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed8 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed8 integer and + value of the second expression is a negative Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed16 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed8 integer and + value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed16 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed8 integer and + value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed8 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed8 integer and + value of the second expression is a negative Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed32 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed8 integer and + value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed32 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed8 integer and + value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed8 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed8 integer and + value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Unsigned8 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed8 integer and + value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed8 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed8 integer and + value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + byte endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed8 integer and + value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned16, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed8 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed8 integer and + value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned16, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Unsigned16 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed8 integer and + value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned32, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed8 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed8 integer and + value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned32, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Unsigned32 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed16 integer and + value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed16 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed16 integer and + value of the second expression is a negative integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed16 integer and + value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed16 integer and + value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed16 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed16 integer and + value of the second expression is a negative Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed8 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed16 integer and + value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed8 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed16 integer and + value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed16 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed16 integer and + value of the second expression is a negative Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed32 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed16 integer and + value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed32 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed16 integer and + value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed16 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed16 integer and + value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Unsigned8 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed16 integer and + value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed16 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed16 integer and + value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed16, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + byte endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed16 integer and + value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned16, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed16 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed16 integer and + value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned16, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Unsigned16 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed16 integer and + value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned32, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed16 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed16 integer and + value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned32, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Unsigned32 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed32 integer and + value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed32 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed32 integer and + value of the second expression is a negative integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed32 integer and + value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed32 integer and + value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed32 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed32 integer and + value of the second expression is a negative Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed8 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed32 integer and + value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed8 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed32 integer and + value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed32 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed32 integer and + value of the second expression is a negative Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed16 endIndex = -1; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed32 integer and + value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed16 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed32 integer and + value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed32 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed32 integer and + value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned8, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Unsigned8 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed32 integer and + value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed32 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed32 integer and + value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed32, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + byte endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed32 integer and + value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned16, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed32 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed32 integer and + value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned16, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Unsigned16 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a positive Signed32 integer and + value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned32, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Signed32 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a negative Signed32 integer and + value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned32, iterable-inclusive, + list-constructor-expr, range-expr, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Unsigned32 endIndex = 2; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned8 integer and value of the + second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned8 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned8 integer and value of the + second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned8 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned8 integer and value of the + second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned8 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned8 integer and value of the + second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned8 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned8 integer and value of the + second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Unsigned8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned8 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned8 integer and value of the + second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, int:Unsigned8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned8 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned8 integer and value of the + second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, int:Unsigned8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned8 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned16 integer and value of the + second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned16 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned16 integer and value of the + second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned16, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned16 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned16 integer and value of the + second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned16, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned16 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned16 integer and value of the + second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned16, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned16 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned16 integer and value of the + second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, int:Unsigned8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned16 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned16 integer and value of the + second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Unsigned16, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned16 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned16 integer and value of the + second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, int:Unsigned32, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned16 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned32 integer and value of the + second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned32 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned32 integer and value of the + second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned32, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned32 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned32 integer and value of the + second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned32, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned32 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned32 integer and value of the + second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned32, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned32 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned32 integer and value of the + second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, int:Unsigned8, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned32 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned32 integer and value of the + second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Unsigned32, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned32 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when value of the first expression is a Unsigned32 integer and value of the + second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, int:Unsigned32, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int:Unsigned32 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when values of both expressions are of user-defined subtypes of int. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-inclusive, list-constructor-expr, + module-type-defn, range-expr, singleton-type, union-type + +type Ints 1|10; + +function init() { + Ints startIndex = 1; + Ints endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when values of both expressions are of singleton types of int. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-inclusive, list-constructor-expr, + module-type-defn, range-expr, singleton-type + +type TEN 10; + +function init() { + 1 startIndex = 1; + TEN endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when values of both expressions are of union of int subtypes. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned32, iterable-inclusive, + list-constructor-expr, range-expr, union-type + +function init() { + int:Signed8|int:Unsigned32 startIndex = 1; + int:Signed8|int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when the value of the first expression and the value of the + second expression is equal. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-inclusive, list-constructor-expr, range-expr + +function init() { + int startIndex = 5; + int endIndex = 5; + int count = 0; + int[] arr = []; + + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 1 + io:println(arr); // @output [5] +} + +Test-Case: output +Description: Test range expression (inclusive) when the value of the first expression is less than the + value of the second expression. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-inclusive, list-constructor-expr, range-expr + +function init() { + int startIndex = 5; + int endIndex = 3; + int count = 0; + int[] arr = []; + + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 0 + io:println(arr); // @output [] +} + +Test-Case: output +Description: Test range expression (inclusive) when the types of the expressions are inferred. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-inclusive, list-constructor-expr, + range-expr, var + +function init() { + var startIndex = 1; + var endIndex = 10; + int count = 0; + int[] arr = []; + + foreach int i in startIndex ... endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test int literals as expressions in range expression (inclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-inclusive, list-constructor-expr, + range-expr + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in 1 ... 10 { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test field and member access as expressions in range expression (inclusive). +Labels: array-type, array:push, DecimalNumber, field-access-expr, foreach-stmt, int, iterable-inclusive, list-constructor-expr, + mapping-constructor-expr, member-access-expr, module-type-defn, range-expr, record-type + +type Record record { + int x; +}; + +function init() { + Record c = {x: 10}; + int[] d = [30, 40]; + int count = 0; + int[] arr = []; + + foreach int i in c.x ... d[0] { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 21 + io:println(arr); // @output [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30] +} + +Test-Case: output +Description: Test function and method call as expressions in range expression (inclusive). +Labels: array-type, array:push, DecimalNumber, explicit-new-expr, foreach-stmt, function-call-expr, int, iterable-inclusive, + list-constructor-expr, method-call-expr, module-class-defn, range-expr + +class Class { + function getInt() returns int { + return 1; + } +} + +function init() { + Class cls = new Class(); + int count = 0; + int[] arr = []; + + foreach int i in cls.getInt() ... getInt() { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +function getInt() returns int { + return 10; +} + +Test-Case: output +Description: Test type cast expression as expressions in range expression (inclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-inclusive, list-constructor-expr, + range-expr, type-cast-expr + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in 1.0 ... 10.0 { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test unary expressions as expressions in range expression (inclusive). +Labels: array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-inclusive, list-constructor-expr, range-expr, + unary-complement, unary-minus, unary-plus + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in -10 ... +2 { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] + + count = 0; + arr = []; + foreach int i in -10 ... ~2 { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 8 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3] +} + +Test-Case: output +Description: Test additive expression as expressions in range expression (inclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-inclusive, list-constructor-expr, range-expr + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in 0+1 ... 12-2 { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test multiplicative expressions as expressions in range expression (inclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-inclusive, list-constructor-expr, + multiplicative-expr, range-expr + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in 1*2 ... 36/4 { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 8 + io:println(arr); // @output [2,3,4,5,6,7,8,9] + + count = 0; + arr = []; + foreach int i in 34%5 ... 4*5 { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 17 + io:println(arr); // @output [4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] +} + +Test-Case: output +Description: Test binary bitwise expressions as expressions in range expression (inclusive). +Labels: additive-expr, array-type, array:push, binary-bitwise-expr, DecimalNumber, foreach-stmt, int, iterable-inclusive, + list-constructor-expr, range-expr + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in (1&2) ... (4|8) { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [0,1,2,3,4,5,6,7,8,9,10,11,12] + + count = 0; + arr = []; + foreach int i in (6|3) ... (2^8) { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 4 + io:println(arr); // @output [7,8,9,10] +} + +Test-Case: output +Description: Test checking expressions as expressions in range expression (inclusive). +Labels: array-type, array:push, check, checkpanic, DecimalNumber, error, foreach-stmt, int, iterable-inclusive, list-constructor-expr, + optional-type, range-expr, union-type + +function init() returns error? { + int|error startIndex = 2; + int|error endIndex = 12; + int count = 0; + int[] arr = []; + + foreach int i in check startIndex ... checkpanic endIndex { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 11 + io:println(arr); // @output [2,3,4,5,6,7,8,9,10,11,12] +} + +Test-Case: output +Description: Test let expression as expressions in range expression (inclusive). +Labels: array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-inclusive, let-expr, list-constructor-expr, range-expr + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in (let int h1 = 10 in h1) ... (let int h1 = 25 in h1) { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 16 + io:println(arr); // @output [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25] +} + +Test-Case: output +Description: Test shift expressions as expressions in range expression (inclusive). +Labels: array-type, array:push, DecimalNumber, foreach-stmt, int, iterable-inclusive, list-constructor-expr, range-expr, shift-expr + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in 1 << 2 ... 100 >> 4 { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 3 + io:println(arr); // @output [4,5,6] +} + +Test-Case: output +Description: Test conditional expressions as expressions in range expression (inclusive). +Labels: array-type, array:push, binary-conditional-expr, DecimalNumber, error, foreach-stmt, int, iterable-inclusive, + list-constructor-expr, nil-literal, optional-type, range-expr, ternary-conditional-expr, union-type + +function init() { + int|error a = 10; + int? b = (); + int count = 0; + int[] arr = []; + + foreach int i in (a is error ? 5 : a) ... (b ?: 25) { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 16 + io:println(arr); // @output [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25] +} + +Test-Case: output +Description: Test lang.int constants as expressions in range expression (inclusive). +Labels: foreach-stmt, int, int:SIGNED8_MAX_VALUE, int:UNSIGNED8_MAX_VALUE, iterable-inclusive, range-expr + +function init() { + int count = 0; + + foreach int i in int:SIGNED8_MAX_VALUE ... int:UNSIGNED8_MAX_VALUE { + count = count + i; + } + io:println(count); // @output 24639 +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when values of both expressions are positive integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int startIndex = 0; + int endIndex = 6; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 7 + io:println(arr); // @output [0,1,2,3,4,5,6] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when values of both expressions are negative integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -6; + int endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 6 + io:println(arr); // @output [-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when the value of one expression is a + negative integer and the value of the other expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -10; + int endIndex = 20; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 31 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when the value of one expression is a + negative integer and the value of the other expression is a positive integer. +Labels: additive-expr, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, object-type, object-type-inclusion, + optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -7635315; + int endIndex = 964732; + int count = 0; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + count = count + i; + } + io:println(count); // @output -28683666993992 +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when values of both expressions are positive + Signed8 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type + +function init() { + int:Signed8 startIndex = 1; + int:Signed8 endIndex = 10; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + int count = 0; + int[] arr = []; + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when values of both expressions are negative + Signed8 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed8 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when the value of one expression is a + negative Signed8 integer and the value of the other expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed8 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when values of both expressions are positive + Signed16 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type + +function init() { + int:Signed16 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when values of both expressions are negative + Signed16 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed16 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when the value of one expression is a + negative Signed16 integer and the value of the other expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed16 endIndex = 20; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 31 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when values of both expressions are positive + Signed32 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed32 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when values of both expressions are negative + Signed32 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed32 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when the value of one expression is a + negative Signed32 integer and the value of the other expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed32 endIndex = 20; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 31 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when values of both expressions are + Unsigned8 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned8 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when values of both expressions are bytes. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + byte startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when values of both expressions are + Unsigned16 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Unsigned16 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when values of both expressions are + Unsigned32 integers. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Unsigned32 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive + integer and value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a + negative integer and value of the second expression is a negative Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -10; + int:Signed8 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative + integer and value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -10; + int:Signed8 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive + integer and value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative + integer and value of the second expression is a negative Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -10; + int:Signed16 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative + integer and value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -10; + int:Signed16 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive + integer and value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative + integer and value of the second expression is a negative Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -10; + int:Signed32 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative + integer and value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -10; + int:Signed32 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -10; + int:Unsigned8 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive + integer and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative integer + and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -10; + byte endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive integer + and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative integer + and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -10; + int:Unsigned16 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive integer + and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative integer + and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int startIndex = -10; + int:Unsigned32 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed8 + integer and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed8 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a negative integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed8 + integer and value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed8 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a negative Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed16 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed16 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed8 + integer and value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed8 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a negative Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed32 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Signed32 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed8 + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed8 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Unsigned8 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed8 + integer and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed8 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + byte endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed8 + integer and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed8 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Unsigned16 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed8 + integer and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed8 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed8 + integer and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed8 startIndex = -10; + int:Unsigned32 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed16 + integer and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed16 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a negative integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed16 + integer and value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed16 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a negative Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed8 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed8 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed16 + integer and value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed16 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a negative Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed32 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Signed32 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed16 + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed16 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Unsigned8 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed16 + integer and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed16 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + byte endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed16 + integer and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed16 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Unsigned16 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed16 + integer and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed16 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed16 + integer and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed16 startIndex = -10; + int:Unsigned32 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed32 + integer and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed32 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a negative integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed32 + integer and value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed32 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a negative Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed8 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Signed8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed8 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed32 + integer and value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed32 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a negative Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed16 endIndex = -1; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Signed32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Signed16 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed32 + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed32 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Unsigned8 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed32 + integer and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed32 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Signed32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + byte endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed32 + integer and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed32 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Unsigned16 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a positive Signed32 + integer and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Signed32 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a negative Signed32 + integer and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, unary-minus + +function init() { + int:Signed32 startIndex = -10; + int:Unsigned32 endIndex = 2; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned8 + integer and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned8 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned8 + integer and value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned8 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned8 + integer and value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned8 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned8 + integer and value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned8 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned8 + integer and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned8 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned8 + integer and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned8 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned8 + integer and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned8 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned16 + integer and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned16 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned16 + integer and value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned16 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned16 + integer and value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned16 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned16 + integer and value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned16 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned16 + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned16 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned16 integer + and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Unsigned16, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned16 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned16 + integer and value of the second expression is a Unsigned32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned16 startIndex = 1; + int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned32 + integer and value of the second expression is a positive integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned32 startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned32 + integer and value of the second expression is a positive Signed8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned32 startIndex = 1; + int:Signed8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned32 + integer and value of the second expression is a positive Signed16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed16, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned32 startIndex = 1; + int:Signed16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned32 + integer and value of the second expression is a positive Signed32 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed32, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned32 startIndex = 1; + int:Signed32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned32 + integer and value of the second expression is a Unsigned8 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned32, int:Unsigned8, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned32 startIndex = 1; + int:Unsigned8 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned32 + integer and value of the second expression is a byte. +Labels: additive-expr, array-type, array:push, byte, DecimalNumber, foreach-stmt, int, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned32 startIndex = 1; + byte endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when value of the first expression is a Unsigned32 + integer and value of the second expression is a Unsigned16 integer. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Unsigned16, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int:Unsigned32 startIndex = 1; + int:Unsigned16 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when values of both expressions are of + user-defined subtypes of int. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, list-constructor-expr, + module-type-defn, object-type, object-type-inclusion, optional-type, range-expr, record-type, singleton-type, union-type + +type Ints 1|10; + +function init() { + Ints startIndex = 1; + Ints endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when values of both expressions are of singleton + types of int. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, module-type-defn, object-type, object-type-inclusion, optional-type, range-expr, + record-type, singleton-type + +type TEN 10; + +function init() { + 1 startIndex = 1; + TEN endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when values of both expressions are of + union of int subtypes. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, int:Signed8, int:Unsigned32, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, union-type + +function init() { + int:Signed8|int:Unsigned32 startIndex = 1; + int:Signed8|int:Unsigned32 endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when the value of the first expression and the + value of the second expression is equal. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int startIndex = 5; + int endIndex = 5; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 1 + io:println(arr); // @output [5] +} + +Test-Case: output +Description: Test range expression (inclusive) when the value of the first expression is less than the + value of the second expression. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int startIndex = 5; + int endIndex = 3; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 0 + io:println(arr); // @output [] +} + +Test-Case: output +Description: Test range expression (inclusive) with iterable object when the types of the values of the expressions + are inferred. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type, var + +function init() { + var startIndex = 1; + var endIndex = 10; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) when the types of the values of the expressions and type of the range + expression are inferred. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, list-constructor-expr, + range-expr, var + +function init() { + int startIndex = 1; + int endIndex = 10; + int count = 0; + int[] arr = []; + + var range = startIndex ... endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) at module level. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, list-constructor-expr, + object-type, object-type-inclusion, optional-type, range-expr, record-type + +int startIndex = 1; +int endIndex = 10; + +object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; +} range = startIndex ... endIndex; + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test range expression (inclusive) at module level with var. +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, range-expr, var + +int startIndex = 1; +int endIndex = 10; + +var range = startIndex ... endIndex; + +function init() { + int count = 0; + int[] arr = []; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test iterable object returned by the range expression (inclusive). +Labels: array-type, array:push, DecimalNumber, foreach-stmt, int, list-constructor-expr, method-call-expr, object-type, + range-expr, value:toBalString, var + +function init() { + object { + public isolated function iterator() returns (object { + public isolated function next() returns (record {|int value;|}?); + }); + } range = 1 ... 3; + + var iterator = range.iterator(); + + record {| int value; |}? rec = iterator.next(); + io:println(rec); // @output {"value":1} + io:println(rec?.value); // @output 1 + + rec = iterator.next(); + io:println(rec); // @output {"value":2} + io:println(rec?.value); // @output 2 + + rec = iterator.next(); + io:println(rec); // @output {"value":3} + io:println(rec?.value); // @output 3 + + rec = iterator.next(); + io:println(rec.toBalString()); // @output () + io:println(rec?.value.toBalString()); // @output () +} + +Test-Case: output +Description: Test int literals as expressions in range expression (inclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = 1 ... 10; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test field and member access as expressions in range expression (inclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, field-access-expr, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, mapping-constructor-expr, member-access-expr, module-type-defn, object-type, object-type-inclusion, + optional-type, range-expr, record-type + +type Record record { + int x; +}; + +function init() { + Record c = {x: 10}; + int[] d = [30, 40]; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = c.x ... d[0]; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 21 + io:println(arr); // @output [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30] +} + +Test-Case: output +Description: Test function and method call as expressions in range expression (inclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, explicit-new-expr, foreach-stmt, function-call-expr, int, + isolated-method, iterable-object, list-constructor-expr, method-call-expr, module-class-defn, object-type, + object-type-inclusion, optional-type, range-expr, record-type + +class Class { + function getInt() returns int { + return 1; + } +} + +function init() { + Class cls = new Class(); + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = cls.getInt() ... getInt(); + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +function getInt() returns int { + return 10; +} + +Test-Case: output +Description: Test type cast expression as expressions in range expression (inclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, + type-cast-expr + +function init() { + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = 1.0 ... 10.0; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test unary expressions as expressions in range expression (inclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, + unary-complement, unary-minus, unary-plus + +function init() { + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = -10 ... +2; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2] + + count = 0; + arr = []; + range = -10 ... ~2; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 8 + io:println(arr); // @output [-10,-9,-8,-7,-6,-5,-4,-3] +} + +Test-Case: output +Description: Test additive expression as expressions in range expression (inclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = 0+1 ... 12-2; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: output +Description: Test multiplicative expressions as expressions in range expression (inclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, multiplicative-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type + +function init() { + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = 1*2 ... 36/4; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 8 + io:println(arr); // @output [2,3,4,5,6,7,8,9] + + count = 0; + arr = []; + range = 34%5 ... 4*5; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 17 + io:println(arr); // @output [4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] +} + +Test-Case: output +Description: Test binary bitwise expressions as expressions in range expression (inclusive). +Labels: additive-expr, array-type, array:push, binary-bitwise-expr, DecimalNumber, foreach-stmt, int, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type + +function init() { + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = (1&2) ... (4|8); + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 13 + io:println(arr); // @output [0,1,2,3,4,5,6,7,8,9,10,11,12] + + count = 0; + arr = []; + range = (6|3) ... (2^8); + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 4 + io:println(arr); // @output [7,8,9,10] +} + +Test-Case: output +Description: Test checking expressions as expressions in range expression (inclusive). +Labels: additive-expr, array-type, array:push, check, checkpanic, DecimalNumber, error, foreach-stmt, int, isolated-method, + iterable-object, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, + record-type, union-type + +function init() returns error? { + int|error startIndex = 2; + int|error endIndex = 12; + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = check startIndex ... checkpanic endIndex; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 11 + io:println(arr); // @output [2,3,4,5,6,7,8,9,10,11,12] +} + +Test-Case: output +Description: Test let expression as expressions in range expression (inclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + let-expr, list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = (let int h1 = 10 in h1) ... (let int h1 = 25 in h1); + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 16 + io:println(arr); // @output [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25] +} + +Test-Case: output +Description: Test shift expressions as expressions in range expression (inclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, int, isolated-method, iterable-object, + list-constructor-expr, object-type, object-type-inclusion, optional-type, range-expr, record-type, shift-expr + +function init() { + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = 1<<2 ... 100>>4; + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 3 + io:println(arr); // @output [4,5,6] +} + +Test-Case: output +Description: Test conditional expressions as expressions in range expression (inclusive). +Labels: additive-expr, array-type, array:push, conditional-expr, DecimalNumber, error, foreach-stmt, int, isolated-method, + iterable-object, list-constructor-expr, nil-literal, object-type, object-type-inclusion, optional-type, + range-expr, record-type, union-type + +function init() { + int|error a = 10; + int? b = (); + int count = 0; + int[] arr = []; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = (a is error ? 5 : a) ... (b ?: 25); + + foreach int i in range { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 16 + io:println(arr); // @output [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25] +} + +Test-Case: output +Description: Test lang.int constants as expressions in range expression (inclusive). +Labels: additive-expr, foreach-stmt, int, int:SIGNED8_MAX_VALUE, int:UNSIGNED8_MAX_VALUE, isolated-method, iterable-object, + object-type, object-type-inclusion, optional-type, range-expr, record-type + +function init() { + int count = 0; + + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = int:SIGNED8_MAX_VALUE ... int:UNSIGNED8_MAX_VALUE; + + foreach int i in range { + count = count + i; + } + io:println(count); // @output 24639 +} + +Test-Case: output +Description: Test isolatedness of range expression (inclusive). +Labels: additive-expr, array-type, array:push, DecimalNumber, foreach-stmt, function-call-expr, int, isolated-method, + iterable-object, list-constructor-expr, lock-stmt, object-type, object-type-inclusion, optional-type, + range-expr, record-type + +isolated int j = 1; + +function init() { + int count = 0; + int[] arr = []; + foreach int i in getRange() { + arr.push(i); + count = count + 1; + } + io:println(count); // @output 10 + io:println(arr); // @output [1,2,3,4,5,6,7,8,9,10] +} + +function getRange() returns object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; +} { + lock { + return j ... j + 9; + } +} + +Test-Case: output +Description: Test isolatedness of the resultant object of the range expression (inclusive). +Labels: any, array-type, array:push, int, is-expr, isolated-method, list-constructor-expr, object-type, + object-type-inclusion, optional-type, range-expr, record-type, type-cast-expr + +function init() { + object { + *object:Iterable; + public isolated function iterator() returns object { + public isolated function next() returns (record {|int value;|}?); + }; + } range = 1 ... 10; + + io:println(range is isolated object {}); // @output true +} + +Test-Case: output +Description: Test isolatedness of the iterator() and next() methods of range expression (inclusive). +Labels: array-type, array:push, DecimalNumber, int, is-expr, isolated-method, list-constructor-expr, method-call-expr, + object-type, optional-type, range-expr, record-type + +type IsolatedIterable isolated object { + public isolated function iterator() returns isolated object { + public isolated function next() returns record {| int value; |}?; + }; +}; + +function init() { + object {} range = 1 ... 10; + + io:println(range is IsolatedIterable); // @output true +} + +Test-Case: output +Description: Test range expression (inclusive) with query expression. +Labels: array-type, array:push, DecimalNumber, int, iterable-inclusive, list-constructor-expr, query-expr, range-expr + +function init() { + int[] a = from int i in 1 ... 10 + select i; + + io:println(a); // @output [1,2,3,4,5,6,7,8,9,10] +} + +Test-Case: error +Description: Test range expression (inclusive) when static type of either of the expression is not a subtype of int. +Labels: DecimalFloatingPointNumber, int, range-expr, string + +function errorFunction() { + _ = 1.0 ... 10; // @error ... not defined when static type of either of the expression is not a subtype of int + _ = 1 ... 10.0; // @error ... not defined when static type of either of the expression is not a subtype of int + _ = 1.0 ... 10.0; // @error ... not defined when static type of either of the expression is not a subtype of int + + _ = "1" ... 10; // @error ... not defined when static type of either of the expression is not a subtype of int + _ = 1 ... "10"; // @error ... not defined when static type of either of the expression is not a subtype of int + _ = "1" ... "10"; // @error ... not defined when static type of either of the expression is not a subtype of int +} + +Test-Case: error +Description: Test assigning the result of range expression (inclusive) to an incompatible type. +Labels: DecimalNumber, int, isolated-method, object-type, optional-type, range-expr, record-type + +function errorFunction() { + int _ = 1 ... 10; // @error expects an int, but the result of a range expression is an object + + object { + public isolated function iterator() returns (object { + public isolated function next() returns (record {|float value;|}?); + }); + } _ = 1 ... 10; // @error expects next() returning record {|float value;|}?, but the next() of range expression's iterable object returns a record {|int value;|}? +} + +Test-Case: error +Description: Test assigning the result of range expression (inclusive) to an incompatible type when the static + type of the range expression is inferred. +Labels: DecimalNumber, float, int, isolated-method, object-type, optional-type, range-expr, record-type, var + +function errorFunction() { + var a = 1 ... 10; + + int _ = a; // @error expects an int, but the result of a range expression is an object + + object { + public isolated function iterator() returns (object { + public isolated function next() returns (record {|float value;|}?); + }); + } _ = a; // @error expects next() returning record {|float value;|}?, but the next() of range expression's iterable object returns a record {|int value;|}? +} + +Test-Case: parser-error +Description: Test range expression (inclusive) syntax errors. +Labels: DecimalNumber, range-expr + +function errorFunction() { + _ = 1..10; // @error invalid operation + // @error missing binary operator + // @error missing identifier +} diff --git a/conformance/lang/expressions/table_constructor_expr.balt b/conformance/lang/expressions/table_constructor_expr.balt index da68de64..781a6005 100644 --- a/conformance/lang/expressions/table_constructor_expr.balt +++ b/conformance/lang/expressions/table_constructor_expr.balt @@ -243,6 +243,7 @@ function init() { Test-Case: error Description: Test incompatible members in table constructor expressions with no key-specifier, when there is a single applicable contextually-expected type. +Fail-Issue: ballerina-platform/ballerina-lang#33049 Labels: boolean-literal, mapping-constructor-expr, module-type-defn, record-type, string, table-constructor-expr, table-type @@ -261,6 +262,7 @@ function errorFunction() { Test-Case: error Description: Test incompatible members in table constructor expressions with no key-specifier, when the mapping constructor has variable-name, computed-name, and spread fields +Fail-Issue: ballerina-platform/ballerina-lang#33049 Labels: boolean-literal, computed-name-field, mapping-constructor-expr, module-type-defn, record-type, spread-field, string, table-constructor-expr, table-type @@ -947,6 +949,7 @@ function init() { Test-Case: error Description: Test incompatible members in table constructor expressions with a key-specifier, when there is a single applicable contextually-expected type. +Fail-Issue: ballerina-platform/ballerina-lang#33049 Labels: boolean-literal, mapping-constructor-expr, module-type-defn, record-type-readonly-field, string, table-constructor-expr, table-constructor-key-specifier, table-type