Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jclark committed Jun 2, 2022
2 parents f6fc79f + 7998a8f commit 29a325c
Show file tree
Hide file tree
Showing 6 changed files with 12,062 additions and 16 deletions.
17 changes: 12 additions & 5 deletions conformance/lang/expressions/is-expr/is_expr.balt
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ function init() {
];
io:println(i is any); // @output true

table<map<int|error>> j = table key(a) [
table<map<int|error>> j = table [
{a: 1, b: error("E1")},
{a: 2, b: error("E2")}
];
Expand Down Expand Up @@ -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<map<float|string>>); // @output false
io:println(e is table<Record> key<int>); // @output true
io:println(e is anydata); // @output true
io:println(e is table<Record> key<int>); // @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<Record> key<int>); // @output true
io:println(h is table<Record>); // @output true
io:println(h is table<record {|readonly int x; [float, string] y;|}>); // @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
Expand Down
17 changes: 12 additions & 5 deletions conformance/lang/expressions/is-expr/negation_is_expr.balt
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,7 @@ function init() {
];
io:println(i !is any); // @output false

table<map<int|error>> j = table key(a) [
table<map<int|error>> j = table [
{a: 1, b: error("E1")},
{a: 2, b: error("E2")}
];
Expand Down Expand Up @@ -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<map<float|string>>); // @output true
io:println(e !is table<Record> key<int>); // @output false
io:println(e !is anydata); // @output false
io:println(e !is table<Record>); // @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<Record> key<int>); // @output false
io:println(h !is table<Record>); // @output false
io:println(h !is table<record {|readonly int x; [float, string] y;|}>); // @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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 29a325c

Please sign in to comment.