Merge pull request #7528 from smores56/and-or-keywords

Prefer `and` and `or` for boolean operators
This commit is contained in:
Sam Mohr 2025-01-18 03:51:17 -08:00 committed by GitHub
commit 1e087b138d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
100 changed files with 1125 additions and 1055 deletions

View file

@ -148,19 +148,19 @@ is_valid_char = \c ->
is_alpha_num : U8 -> Bool
is_alpha_num = \key ->
(key >= 48 && key <= 57) || (key >= 64 && key <= 90) || (key >= 97 && key <= 122)
(key >= 48 and key <= 57) or (key >= 64 and key <= 90) or (key >= 97 and key <= 122)
# Convert a base64 character/digit to its index
# See also [Wikipedia](https://en.wikipedia.org/wiki/Base64#Base64_table)
unsafe_convert_char : U8 -> U8
unsafe_convert_char = \key ->
if key >= 65 && key <= 90 then
if key >= 65 and key <= 90 then
# A-Z
key - 65
else if key >= 97 && key <= 122 then
else if key >= 97 and key <= 122 then
# a-z
(key - 97) + 26
else if key >= 48 && key <= 57 then
else if key >= 48 and key <= 57 then
# 0-9
(key - 48) + 26 + 26
else

View file

@ -50,7 +50,7 @@ safe = \queen, diagonal, xs ->
when xs is
Nil -> Bool.true
Cons(q, t) ->
if queen != q && queen != q + diagonal && queen != q - diagonal then
if queen != q and queen != q + diagonal and queen != q - diagonal then
safe(queen, (diagonal + 1), t)
else
Bool.false

View file

@ -19,10 +19,8 @@ to_str = \@Variable(char) ->
from_utf8 : U8 -> Result Variable [InvalidVariableUtf8]
from_utf8 = \char ->
if
char
>= 0x61 # "a"
&& char
<= 0x7A # "z"
char >= 0x61 # "a"
and char <= 0x7A # "z"
then
Ok(@Variable(char))
else

View file

@ -457,21 +457,15 @@ pop_variable = \ctx ->
is_digit : U8 -> Bool
is_digit = \char ->
char
>= 0x30 # `0`
&& char
<= 0x39 # `0`
char >= 0x30 # `0`
and char <= 0x39 # `0`
is_whitespace : U8 -> Bool
is_whitespace = \char ->
char
== 0xA # new line
|| char
== 0xD # carriage return
|| char
== 0x20 # space
|| char
== 0x9 # tab
char == 0xA # new line
or char == 0xD # carriage return
or char == 0x20 # space
or char == 0x9 # tab
end_unexpected = \err ->
when err is

View file

@ -1,4 +1,4 @@
module [Bool, Eq, true, false, and, or, not, is_eq, is_not_eq]
module [Bool, Eq, true, false, not, is_eq, is_not_eq]
## Defines a type that can be compared for total equality.
##
@ -44,55 +44,6 @@ true = @Bool(True)
false : Bool
false = @Bool(False)
## Returns `Bool.true` when both inputs are `Bool.true`. This is equivalent to
## the logic [AND](https://en.wikipedia.org/wiki/Logical_conjunction)
## gate. The infix operator `&&` can also be used as shorthand for
## `Bool.and`.
##
## ```roc
## expect Bool.and(Bool.true, Bool.true) == Bool.true
## expect (Bool.true && Bool.true) == Bool.true
## expect (Bool.false && Bool.true) == Bool.false
## expect (Bool.true && Bool.false) == Bool.false
## expect (Bool.false && Bool.false) == Bool.false
## ```
##
## ## Performance Details
##
## In Roc the `&&` and `||` work the same way as any
## other function. However, in some languages `&&` and `||` are special-cased.
## In these languages the compiler will skip evaluating the expression after the
## first operator under certain circumstances. For example an expression like
## `enable_pets && likes_dogs(user)` would compile to.
## ```roc
## if enable_pets then
## likes_dogs(user)
## else
## Bool.false
## ```
## Roc does not do this because conditionals like `if` and `when` have a
## performance cost. Calling a function can sometimes be faster across the board
## than doing an `if` to decide whether to skip calling it.
and : Bool, Bool -> Bool
## Returns `Bool.true` when either input is a `Bool.true`. This is equivalent to
## the logic [OR](https://en.wikipedia.org/wiki/Logical_disjunction) gate.
## The infix operator `||` can also be used as shorthand for `Bool.or`.
## ```roc
## expect Bool.or(Bool.false, Bool.true) == Bool.true
## expect (Bool.true || Bool.true) == Bool.true
## expect (Bool.false || Bool.true) == Bool.true
## expect (Bool.true || Bool.false) == Bool.true
## expect (Bool.false || Bool.false) == Bool.false
## ```
##
## ## Performance Details
##
## In Roc the `&&` and `||` work the same way as any
## other functions. However, in some languages `&&` and `||` are special-cased.
## Refer to the note in `Bool.and` for more detail.
or : Bool, Bool -> Bool
## Returns `Bool.false` when given `Bool.true`, and vice versa. This is
## equivalent to the logic [NOT](https://en.wikipedia.org/wiki/Negation)
## gate. The operator `!` can also be used as shorthand for `Bool.not`.

View file

@ -170,7 +170,7 @@ reserve = |@Dict({ buckets, data, max_bucket_capacity: original_max_bucket_capac
size = Num.min(requested_size, max_size)
requested_shifts = calc_shifts_for_size(size, max_load_factor)
if List.is_empty(buckets) || requested_shifts > shifts then
if List.is_empty(buckets) or requested_shifts > shifts then
(buckets0, max_bucket_capacity) = alloc_buckets_from_shift(requested_shifts, max_load_factor)
buckets1 = fill_buckets_from_data(buckets0, data, requested_shifts)
@Dict(
@ -915,7 +915,7 @@ calc_shifts_for_size_helper = |shifts, size, max_load_factor|
|> Num.to_f32
|> Num.mul(max_load_factor)
|> Num.floor
if shifts > 0 && max_bucket_capacity < size then
if shifts > 0 and max_bucket_capacity < size then
calc_shifts_for_size_helper(Num.sub_wrap(shifts, 1), size, max_load_factor)
else
shifts
@ -1087,7 +1087,7 @@ expect
|> insert("bar", {})
|> insert("baz", {})
contains(dict, "baz") && !(contains(dict, "other"))
contains(dict, "baz") and !(contains(dict, "other"))
expect
dict =
@ -1145,17 +1145,17 @@ expect
|> insert("l", 11)
(get(dict, "a") == Ok(0))
&& (get(dict, "b") == Ok(1))
&& (get(dict, "c") == Ok(2))
&& (get(dict, "d") == Ok(3))
&& (get(dict, "e") == Ok(4))
&& (get(dict, "f") == Ok(5))
&& (get(dict, "g") == Ok(6))
&& (get(dict, "h") == Ok(7))
&& (get(dict, "i") == Ok(8))
&& (get(dict, "j") == Ok(9))
&& (get(dict, "k") == Ok(10))
&& (get(dict, "l") == Ok(11))
and (get(dict, "b") == Ok(1))
and (get(dict, "c") == Ok(2))
and (get(dict, "d") == Ok(3))
and (get(dict, "e") == Ok(4))
and (get(dict, "f") == Ok(5))
and (get(dict, "g") == Ok(6))
and (get(dict, "h") == Ok(7))
and (get(dict, "i") == Ok(8))
and (get(dict, "j") == Ok(9))
and (get(dict, "k") == Ok(10))
and (get(dict, "l") == Ok(11))
# Force rehash.
expect
@ -1197,18 +1197,18 @@ expect
|> insert("m", 12)
(get(dict, "a") == Ok(0))
&& (get(dict, "b") == Ok(1))
&& (get(dict, "c") == Ok(2))
&& (get(dict, "d") == Ok(3))
&& (get(dict, "e") == Ok(4))
&& (get(dict, "f") == Ok(5))
&& (get(dict, "g") == Ok(6))
&& (get(dict, "h") == Ok(7))
&& (get(dict, "i") == Ok(8))
&& (get(dict, "j") == Ok(9))
&& (get(dict, "k") == Ok(10))
&& (get(dict, "l") == Ok(11))
&& (get(dict, "m") == Ok(12))
and (get(dict, "b") == Ok(1))
and (get(dict, "c") == Ok(2))
and (get(dict, "d") == Ok(3))
and (get(dict, "e") == Ok(4))
and (get(dict, "f") == Ok(5))
and (get(dict, "g") == Ok(6))
and (get(dict, "h") == Ok(7))
and (get(dict, "i") == Ok(8))
and (get(dict, "j") == Ok(9))
and (get(dict, "k") == Ok(10))
and (get(dict, "l") == Ok(11))
and (get(dict, "m") == Ok(12))
expect
empty({})
@ -1266,7 +1266,7 @@ expect
bad_keys,
Bool.true,
|acc, k|
acc && Dict.contains(dict, k),
acc and Dict.contains(dict, k),
)
all_inserted_correctly

View file

@ -1361,7 +1361,7 @@ split_last = |list, delimiter|
## result is an empty list.
chunks_of : List a, U64 -> List (List a)
chunks_of = |list, chunk_size|
if chunk_size == 0 || List.is_empty(list) then
if chunk_size == 0 or List.is_empty(list) then
[]
else
chunk_capacity = Num.div_ceil(List.len(list), chunk_size)

View file

@ -619,9 +619,9 @@ is_gte : Num a, Num a -> Bool
## is [defined to be unordered](https://en.wikipedia.org/wiki/NaN#Comparison_with_NaN).)
is_approx_eq : Frac a, Frac a, { rtol ?? Frac a, atol ?? Frac a } -> Bool
is_approx_eq = |x, y, { rtol ?? 0.00001, atol ?? 0.00000001 }|
eq = x <= y && x >= y
eq = x <= y and x >= y
meets_tolerance = Num.abs_diff(x, y) <= Num.max(atol, (rtol * Num.max(Num.abs(x), Num.abs(y))))
eq || meets_tolerance
eq or meets_tolerance
## Returns `Bool.true` if the number is `0`, and `Bool.false` otherwise.
is_zero : Num a -> Bool

View file

@ -972,7 +972,7 @@ matches_at_help = |state|
},
)
does_this_match && does_rest_match
does_this_match and does_rest_match
## Walks over the `UTF-8` bytes of the given [Str] and calls a function to update
## state for each byte. The index for that byte in the string is provided

View file

@ -212,8 +212,6 @@ map_symbol_to_lowlevel_and_arity! {
Eq; BOOL_STRUCTURAL_EQ; 2,
NotEq; BOOL_STRUCTURAL_NOT_EQ; 2,
And; BOOL_AND; 2,
Or; BOOL_OR; 2,
Not; BOOL_NOT; 1,
BoxExpr; BOX_BOX_FUNCTION; 1,
UnboxExpr; BOX_UNBOX; 1,

View file

@ -4,7 +4,6 @@ use crate::env::Env;
use crate::scope::Scope;
use bumpalo::collections::Vec;
use roc_error_macros::internal_error;
use roc_module::called_via::BinOp::{DoubleQuestion, Pizza, SingleQuestion};
use roc_module::called_via::{BinOp, CalledVia};
use roc_module::ident::ModuleName;
use roc_parse::ast::Expr::{self, *};
@ -36,7 +35,7 @@ fn new_op_call_expr<'a>(
let value = match loc_op.value {
// Rewrite the Pizza operator into an Apply
Pizza => {
BinOp::Pizza => {
// Allow `left |> try (optional)` to desugar to `try left (optional)`
let right_without_spaces = without_spaces(&right.value);
match right_without_spaces {
@ -190,7 +189,7 @@ fn new_op_call_expr<'a>(
let args = args.into_bump_slice();
Apply(function, args, CalledVia::BinOp(Pizza))
Apply(function, args, CalledVia::BinOp(BinOp::Pizza))
}
PncApply(function, arguments) => {
let mut args = Vec::with_capacity_in(1 + arguments.len(), env.arena);
@ -200,16 +199,20 @@ fn new_op_call_expr<'a>(
let args = args.into_bump_slice();
Apply(function, args, CalledVia::BinOp(Pizza))
Apply(function, args, CalledVia::BinOp(BinOp::Pizza))
}
Dbg => *desugar_dbg_expr(env, scope, left, region),
_ => {
// e.g. `1 |> (if b then (\a -> a) else (\c -> c))`
Apply(right, env.arena.alloc([left]), CalledVia::BinOp(Pizza))
Apply(
right,
env.arena.alloc([left]),
CalledVia::BinOp(BinOp::Pizza),
)
}
}
}
DoubleQuestion => {
BinOp::DoubleQuestion => {
let left = desugar_expr(env, scope, left);
let right = desugar_expr(env, scope, right);
@ -259,7 +262,7 @@ fn new_op_call_expr<'a>(
When(left, &*env.arena.alloc([ok_branch, err_branch]))
}
SingleQuestion => {
BinOp::SingleQuestion => {
let left = desugar_expr(env, scope, left);
let right = desugar_expr(env, scope, right);
@ -340,6 +343,41 @@ fn new_op_call_expr<'a>(
When(left, &*env.arena.alloc([ok_branch, err_branch]))
}
BinOp::And => {
let left = desugar_expr(env, scope, left);
let right = desugar_expr(env, scope, right);
Expr::If {
if_thens: env.arena.alloc([(*left, *right)]),
final_else: env.arena.alloc(Loc::at(
right.region,
Expr::Var {
module_name: ModuleName::BOOL,
ident: "false",
},
)),
indented_else: false,
}
}
BinOp::Or => {
let left = desugar_expr(env, scope, left);
let right = desugar_expr(env, scope, right);
Expr::If {
if_thens: env.arena.alloc([(
*left,
Loc::at(
right.region,
Expr::Var {
module_name: ModuleName::BOOL,
ident: "true",
},
),
)]),
final_else: right,
indented_else: false,
}
}
binop => {
let left = desugar_expr(env, scope, left);
let right = desugar_expr(env, scope, right);
@ -1641,8 +1679,8 @@ fn binop_to_function(binop: BinOp) -> (&'static str, &'static str) {
GreaterThan => (ModuleName::NUM, "is_gt"),
LessThanOrEq => (ModuleName::NUM, "is_lte"),
GreaterThanOrEq => (ModuleName::NUM, "is_gte"),
And => (ModuleName::BOOL, "and"),
Or => (ModuleName::BOOL, "or"),
And => unreachable!("Cannot desugar the `and` operator"),
Or => unreachable!("Cannot desugar the `or` operator"),
Pizza => unreachable!("Cannot desugar the |> operator"),
DoubleQuestion => unreachable!("Cannot desugar the ?? operator"),
SingleQuestion => unreachable!("Cannot desugar the ? operator"),

View file

@ -972,7 +972,59 @@ mod test_can {
}
#[test]
fn try_desugar_double_question_binop() {
fn try_desugar_works_elsewhere() {
let src = indoc!(
r#"
when Foo 123 is
Foo try -> try
"#
);
let arena = Bump::new();
let out = can_expr_with(&arena, test_home(), src);
assert_eq!(out.problems, Vec::new());
// Assert that we don't treat `try` as a keyword here
// by desugaring to:
//
// when Foo 123 is
// Foo try -> try
let (cond_expr, branches) = assert_when_expr(&out.loc_expr.value);
match cond_expr {
Expr::Tag {
name, arguments, ..
} => {
assert_eq!(name.0.to_string(), "Foo");
assert_eq!(arguments.len(), 1);
assert_num_value(&arguments[0].1.value, 123);
}
_ => panic!("cond_expr was not a Tag: {:?}", cond_expr),
}
assert_eq!(branches.len(), 1);
assert_eq!(branches[0].patterns.len(), 1);
assert!(!branches[0].patterns[0].degenerate);
match &branches[0].patterns[0].pattern.value {
Pattern::AppliedTag {
tag_name,
arguments,
..
} => {
assert_eq!(tag_name.0.to_string(), "Foo");
assert_eq!(arguments.len(), 1);
assert_pattern_name(&arguments[0].1.value, "try", &out.interns);
}
other => panic!("First argument was not an applied tag: {:?}", other),
}
assert_var_usage(&branches[0].value.value, "try", &out.interns);
assert!(&branches[0].guard.is_none());
}
#[test]
fn desugar_double_question_binop() {
let src = indoc!(
r#"
Str.to_u64("123") ?? Num.max_u64
@ -989,7 +1041,7 @@ mod test_can {
// Ok(#double_question_ok_0_17) -> Ok(#double_question_ok_0_17)
// Err(_) -> Num.max_u64
let (cond_expr, branches) = assert_when(&out.loc_expr.value);
let (cond_expr, branches) = assert_when_expr(&out.loc_expr.value);
let cond_args = assert_func_call(cond_expr, "to_u64", CalledVia::Space, &out.interns);
assert_eq!(cond_args.len(), 1);
@ -1016,7 +1068,7 @@ mod test_can {
}
#[test]
fn try_desugar_single_question_binop() {
fn desugar_single_question_binop() {
let src = indoc!(
r#"
Str.to_u64("123") ? FailedToConvert
@ -1033,7 +1085,7 @@ mod test_can {
// Ok(#single_question_ok_0_17) -> #single_question_ok_0_17
// Err(#single_question_err_0_17) -> return Err(FailedToConvert(#single_question_err_0_17))
let (cond_expr, branches) = assert_when(&out.loc_expr.value);
let (cond_expr, branches) = assert_when_expr(&out.loc_expr.value);
let cond_args = assert_func_call(cond_expr, "to_u64", CalledVia::Space, &out.interns);
assert_eq!(cond_args.len(), 1);
@ -1075,11 +1127,13 @@ mod test_can {
}
#[test]
fn try_desugar_works_elsewhere() {
fn desugar_and_operator() {
let src = indoc!(
r#"
when Foo 123 is
Foo try -> try
left = Bool.true
right = Bool.false
left and right
"#
);
let arena = Bump::new();
@ -1087,43 +1141,49 @@ mod test_can {
assert_eq!(out.problems, Vec::new());
// Assert that we don't treat `try` as a keyword here
// by desugaring to:
// Assert that we desugar to:
//
// when Foo 123 is
// Foo try -> try
// if left then right else Bool.false
let (cond_expr, branches) = assert_when(&out.loc_expr.value);
match cond_expr {
Expr::Tag {
name, arguments, ..
} => {
assert_eq!(name.0.to_string(), "Foo");
assert_eq!(arguments.len(), 1);
assert_num_value(&arguments[0].1.value, 123);
}
_ => panic!("cond_expr was not a Tag: {:?}", cond_expr),
}
let continuation1 = assert_let_expr(&out.loc_expr.value);
let continuation2 = assert_let_expr(&continuation1.value);
let (branches, final_else) = assert_if_expr(&continuation2.value);
assert_eq!(branches.len(), 1);
assert_eq!(branches[0].patterns.len(), 1);
assert!(!branches[0].patterns[0].degenerate);
match &branches[0].patterns[0].pattern.value {
Pattern::AppliedTag {
tag_name,
arguments,
..
} => {
assert_eq!(tag_name.0.to_string(), "Foo");
assert_eq!(arguments.len(), 1);
assert_pattern_name(&arguments[0].1.value, "try", &out.interns);
}
other => panic!("First argument was not an applied tag: {:?}", other),
}
assert_var_usage(&branches[0].0.value, "left", &out.interns);
assert_var_usage(&branches[0].1.value, "right", &out.interns);
assert_var_usage(&final_else.value, "false", &out.interns);
}
assert_var_usage(&branches[0].value.value, "try", &out.interns);
assert!(&branches[0].guard.is_none());
#[test]
fn desugar_or_operator() {
let src = indoc!(
r#"
left = Bool.true
right = Bool.false
left or right
"#
);
let arena = Bump::new();
let out = can_expr_with(&arena, test_home(), src);
assert_eq!(out.problems, Vec::new());
// Assert that we desugar to:
//
// if left then Bool.true else right
let continuation1 = assert_let_expr(&out.loc_expr.value);
let continuation2 = assert_let_expr(&continuation1.value);
let (branches, final_else) = assert_if_expr(&continuation2.value);
assert_eq!(branches.len(), 1);
assert_var_usage(&branches[0].0.value, "left", &out.interns);
assert_var_usage(&branches[0].1.value, "true", &out.interns);
assert_var_usage(&final_else.value, "right", &out.interns);
}
fn assert_num_value(expr: &Expr, num: usize) {
@ -1238,7 +1298,14 @@ mod test_can {
}
}
fn assert_when(expr: &Expr) -> (&Expr, &Vec<WhenBranch>) {
fn assert_let_expr(expr: &Expr) -> &Loc<Expr> {
match expr {
Expr::LetNonRec(_, continuation) | Expr::LetRec(_, continuation, _) => continuation,
_ => panic!("Expr was not a Let(Non)?Rec: {expr:?}",),
}
}
fn assert_when_expr(expr: &Expr) -> (&Expr, &Vec<WhenBranch>) {
match expr {
Expr::When {
loc_cond, branches, ..
@ -1247,6 +1314,18 @@ mod test_can {
}
}
#[allow(clippy::type_complexity)]
fn assert_if_expr(expr: &Expr) -> (&[(Loc<Expr>, Loc<Expr>)], &Loc<Expr>) {
match expr {
Expr::If {
branches,
final_else,
..
} => (&branches, &**final_else),
_ => panic!("Expr was not a When: {:?}", expr),
}
}
fn assert_try_expr(expr: &Expr) -> &Expr {
match expr {
Expr::Try { result_expr, .. } => &result_expr.value,

View file

@ -959,8 +959,8 @@ fn push_op(buf: &mut Buf, op: BinOp) {
called_via::BinOp::GreaterThan => buf.push('>'),
called_via::BinOp::LessThanOrEq => buf.push_str("<="),
called_via::BinOp::GreaterThanOrEq => buf.push_str(">="),
called_via::BinOp::And => buf.push_str("&&"),
called_via::BinOp::Or => buf.push_str("||"),
called_via::BinOp::Or => buf.push_str("or"),
called_via::BinOp::And => buf.push_str("and"),
called_via::BinOp::Pizza => buf.push_str("|>"),
called_via::BinOp::DoubleQuestion => buf.push_str("??"),
called_via::BinOp::SingleQuestion => buf.push_str("?"),

View file

@ -1268,20 +1268,6 @@ trait Backend<'a> {
internal_error!("bitwise xor on a non-integer")
}
}
LowLevel::And => {
if let LayoutRepr::Builtin(Builtin::Bool) = self.interner().get_repr(*ret_layout) {
self.build_int_bitwise_and(sym, &args[0], &args[1], IntWidth::U8)
} else {
internal_error!("bitwise and on a non-integer")
}
}
LowLevel::Or => {
if let LayoutRepr::Builtin(Builtin::Bool) = self.interner().get_repr(*ret_layout) {
self.build_int_bitwise_or(sym, &args[0], &args[1], IntWidth::U8)
} else {
internal_error!("bitwise or on a non-integer")
}
}
LowLevel::NumShiftLeftBy => {
if let LayoutRepr::Builtin(Builtin::Int(int_width)) =
self.interner().get_repr(*ret_layout)

View file

@ -1284,30 +1284,6 @@ pub(crate) fn run_low_level<'a, 'ctx>(
rhs_layout,
)
}
And => {
// The (&&) operator
arguments!(lhs_arg, rhs_arg);
let bool_val = env.builder.new_build_and(
lhs_arg.into_int_value(),
rhs_arg.into_int_value(),
"bool_and",
);
BasicValueEnum::IntValue(bool_val)
}
Or => {
// The (||) operator
arguments!(lhs_arg, rhs_arg);
let bool_val = env.builder.new_build_or(
lhs_arg.into_int_value(),
rhs_arg.into_int_value(),
"bool_or",
);
BasicValueEnum::IntValue(bool_val)
}
Not => {
// The (!) operator
arguments!(arg);

View file

@ -2163,14 +2163,6 @@ impl<'a> LowLevelCall<'a> {
NumF64ToParts => self.load_args_and_call_zig(backend, bitcode::NUM_F64_TO_PARTS),
NumF32FromParts => self.load_args_and_call_zig(backend, bitcode::NUM_F32_FROM_PARTS),
NumF64FromParts => self.load_args_and_call_zig(backend, bitcode::NUM_F64_FROM_PARTS),
And => {
self.load_args(backend);
backend.code_builder.i32_and();
}
Or => {
self.load_args(backend);
backend.code_builder.i32_or();
}
Not => {
self.load_args(backend);
backend.code_builder.i32_eqz();

View file

@ -6036,7 +6036,7 @@ All branches in an `if` must have the same type!
double_binop,
indoc!(
r"
key >= 97 && <= 122
key >= 97 and <= 122
"
),
@r"

View file

@ -62,8 +62,8 @@ const DISPLAY_STRINGS: [(BinOp, &str); 18] = [
(GreaterThan, ">"),
(LessThanOrEq, "<="),
(GreaterThanOrEq, ">="),
(And, "&&"),
(Or, "||"),
(And, "and"),
(Or, "or"),
];
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
@ -199,7 +199,7 @@ pub enum Associativity {
/// right-associative operators:
///
/// exponentiation: ^
/// boolean: && ||
/// boolean: and or
/// application: <|
RightAssociative,

View file

@ -109,8 +109,6 @@ pub enum LowLevel {
NumF64FromParts,
Eq,
NotEq,
And,
Or,
Not,
Hash,
PtrCast,
@ -343,8 +341,6 @@ map_symbol_to_lowlevel! {
NumF64FromParts <= NUM_F64_FROM_PARTS;
Eq <= BOOL_STRUCTURAL_EQ;
NotEq <= BOOL_STRUCTURAL_NOT_EQ;
And <= BOOL_AND;
Or <= BOOL_OR;
Not <= BOOL_NOT;
Unreachable <= LIST_UNREACHABLE;
DictPseudoSeed <= DICT_PSEUDO_SEED;

View file

@ -1355,16 +1355,14 @@ define_builtins! {
0 BOOL_BOOL: "Bool" exposed_type=true // the Bool.Bool type alias
1 BOOL_FALSE: "false"
2 BOOL_TRUE: "true"
3 BOOL_AND: "and"
4 BOOL_OR: "or"
5 BOOL_NOT: "not"
6 BOOL_XOR: "xor"
7 BOOL_NEQ: "is_not_eq"
8 BOOL_EQ: "Eq" exposed_type=true
9 BOOL_IS_EQ: "is_eq"
10 BOOL_IS_EQ_IMPL: "bool_is_eq"
unexposed 11 BOOL_STRUCTURAL_EQ: "structural_eq"
unexposed 12 BOOL_STRUCTURAL_NOT_EQ: "structural_not_eq"
3 BOOL_NOT: "not"
4 BOOL_XOR: "xor"
5 BOOL_NEQ: "is_not_eq"
6 BOOL_EQ: "Eq" exposed_type=true
7 BOOL_IS_EQ: "is_eq"
8 BOOL_IS_EQ_IMPL: "bool_is_eq"
unexposed 9 BOOL_STRUCTURAL_EQ: "structural_eq"
unexposed 10 BOOL_STRUCTURAL_NOT_EQ: "structural_not_eq"
}
5 STR: "Str" => {
0 STR_STR: "Str" exposed_apply_type=true // the Str.Str type alias

View file

@ -1562,7 +1562,7 @@ fn low_level_no_rc(lowlevel: &LowLevel) -> RC {
Eq | NotEq => RC::NoRc,
And | Or | NumAdd | NumAddWrap | NumAddChecked | NumAddSaturated | NumSub | NumSubWrap
NumAdd | NumAddWrap | NumAddChecked | NumAddSaturated | NumSub | NumSubWrap
| NumSubChecked | NumSubSaturated | NumMul | NumMulWrap | NumMulSaturated
| NumMulChecked | NumGt | NumGte | NumLt | NumLte | NumCompare | NumDivFrac
| NumDivTruncUnchecked | NumDivCeilUnchecked | NumRemUnchecked | NumIsMultipleOf

View file

@ -1261,7 +1261,7 @@ pub(crate) fn lowlevel_borrow_signature(op: LowLevel) -> &'static [Ownership] {
Eq | NotEq => &[BORROWED, BORROWED],
And | Or | NumAdd | NumAddWrap | NumAddChecked | NumAddSaturated | NumSub | NumSubWrap
NumAdd | NumAddWrap | NumAddChecked | NumAddSaturated | NumSub | NumSubWrap
| NumSubChecked | NumSubSaturated | NumMul | NumMulWrap | NumMulSaturated
| NumMulChecked | NumGt | NumGte | NumLt | NumLte | NumCompare | NumDivFrac
| NumDivTruncUnchecked | NumDivCeilUnchecked | NumRemUnchecked | NumIsMultipleOf

View file

@ -738,7 +738,7 @@ fn parse_stmt_operator_chain<'a>(
| Expr::Apply(
Loc {
region: _,
value: Expr::Tag(..)
value: Expr::Tag(_)
},
&[],
_
@ -752,7 +752,7 @@ fn parse_stmt_operator_chain<'a>(
// try an operator
return parse_stmt_after_apply(
arena,
state.clone(),
state,
min_indent,
call_min_indent,
expr_state,
@ -1934,43 +1934,6 @@ fn parse_stmt_after_apply<'a>(
}
}
// #[allow(clippy::too_many_arguments)]
// fn parse_expr_after_apply<'a>(
// arena: &'a Bump,
// state: State<'a>,
// min_indent: u32,
// call_min_indent: u32,
// check_for_arrow: CheckForArrow,
// check_for_defs: bool,
// mut expr_state: ExprState<'a>,
// before_op: State<'a>,
// initial_state: State<'a>,
// ) -> Result<(Progress, Expr<'a>, State<'a>), (Progress, EExpr<'a>)> {
// match loc(bin_op(check_for_defs)).parse(arena, state.clone(), call_min_indent) {
// Err((MadeProgress, f)) => Err((MadeProgress, f)),
// Ok((_, loc_op, state)) => {
// expr_state.consume_spaces(arena);
// let initial_state = before_op;
// parse_expr_operator(
// arena,
// state,
// min_indent,
// call_min_indent,
// options,
// check_for_defs,
// expr_state,
// loc_op,
// initial_state,
// )
// }
// Err((NoProgress, _)) => {
// let expr = parse_expr_final(expr_state, arena);
// // roll back space parsing
// Ok((MadeProgress, expr, initial_state))
// }
// }
// }
#[allow(clippy::too_many_arguments)]
fn parse_apply_arg<'a>(
arena: &'a Bump,
@ -4069,6 +4032,24 @@ where
G: Fn(&'a str, Position) -> E,
E: 'a,
{
match *state.bytes() {
[b'o', b'r', ..] => {
return Ok((
MadeProgress,
OperatorOrDef::BinOp(BinOp::Or),
state.advance(2),
))
}
[b'a', b'n', b'd', ..] => {
return Ok((
MadeProgress,
OperatorOrDef::BinOp(BinOp::And),
state.advance(3),
))
}
_ => {}
}
let chomped = chomp_ops(state.bytes());
macro_rules! good {

View file

@ -10,6 +10,8 @@ pub const IMPORT: &str = "import";
pub const EXPECT: &str = "expect";
pub const RETURN: &str = "return";
pub const CRASH: &str = "crash";
pub const AND: &str = "and";
pub const OR: &str = "or";
// These keywords are valid in imports
pub const EXPOSING: &str = "exposing";
@ -21,8 +23,8 @@ pub const WHERE: &str = "where";
// These keywords are valid in headers
pub const PLATFORM: &str = "platform";
pub const KEYWORDS: [&str; 11] = [
IF, THEN, ELSE, WHEN, AS, IS, DBG, IMPORT, EXPECT, RETURN, CRASH,
pub const KEYWORDS: [&str; 13] = [
IF, THEN, ELSE, WHEN, AS, IS, DBG, IMPORT, EXPECT, RETURN, CRASH, AND, OR,
];
pub fn is_allowed_identifier(mut ident: &str) -> bool {

View file

@ -2095,13 +2095,13 @@ mod eq {
LyingEq := U8 implements [Eq {is_eq}]
is_eq = \@LyingEq m, @LyingEq n -> m != n
is_eq = \@LyingEq(m), @LyingEq(n) -> m != n
main =
a = @LyingEq 10
b = @LyingEq 5
c = @LyingEq 5
if Bool.is_eq a b && !(Bool.is_eq b c) then
a = @LyingEq(10)
b = @LyingEq(5)
c = @LyingEq(5)
if Bool.is_eq(a, b) and !(Bool.is_eq(b, c)) then
"okay"
else
"fail"

View file

@ -121,7 +121,7 @@ fn bool_logic() {
bool2 = Bool.false
bool3 = !bool1
(bool1 && bool2) || bool2 && bool3
(bool1 and bool2) or bool2 and bool3
"#
),
false,
@ -132,19 +132,19 @@ fn bool_logic() {
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn and_bool() {
assert_evals_to!("Bool.true && Bool.true", true, bool);
assert_evals_to!("Bool.true && Bool.false", false, bool);
assert_evals_to!("Bool.false && Bool.true", false, bool);
assert_evals_to!("Bool.false && Bool.false", false, bool);
assert_evals_to!("Bool.true and Bool.true", true, bool);
assert_evals_to!("Bool.true and Bool.false", false, bool);
assert_evals_to!("Bool.false and Bool.true", false, bool);
assert_evals_to!("Bool.false and Bool.false", false, bool);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn or_bool() {
assert_evals_to!("Bool.true || Bool.true", true, bool);
assert_evals_to!("Bool.true || Bool.false", true, bool);
assert_evals_to!("Bool.false || Bool.true", true, bool);
assert_evals_to!("Bool.false || Bool.false", false, bool);
assert_evals_to!("Bool.true or Bool.true", true, bool);
assert_evals_to!("Bool.true or Bool.false", true, bool);
assert_evals_to!("Bool.false or Bool.true", true, bool);
assert_evals_to!("Bool.false or Bool.false", false, bool);
}
#[test]
@ -544,7 +544,7 @@ fn eq_different_rosetrees() {
cd = c2 == d2
ab && cd
ab and cd
"#
),
true,

View file

@ -158,19 +158,19 @@ fn even_odd() {
assert_evals_to!(
indoc!(
r"
even = \n ->
even = |n|
when n is
0 -> Bool.true
1 -> Bool.false
_ -> odd (n - 1)
_ -> odd(n - 1)
odd = \n ->
odd = |n|
when n is
0 -> Bool.false
1 -> Bool.true
_ -> even (n - 1)
_ -> even(n - 1)
odd 5 && even 42
odd(5) and even(42)
"
),
true,
@ -2315,12 +2315,12 @@ fn recursive_tag_id_in_allocation_eq() {
]
x : Value
x = G 42
x = G(42)
y : Value
y = H 42
y = H(42)
main = (x == x) && (x != y) && (y == y)
main = x == x and x != y and y == y
"#
),
true,

View file

@ -66,7 +66,7 @@ fn build_app_mono<'a>(
let or1_expr = Expr::Call(Call {
call_type: CallType::LowLevel {
op: LowLevel::Or,
op: LowLevel::NumBitwiseOr,
update_mode: UpdateModeId::BACKEND_DUMMY,
},
arguments: arena.alloc([js_call_result, host_call_result]),
@ -74,7 +74,7 @@ fn build_app_mono<'a>(
let or2_expr = Expr::Call(Call {
call_type: CallType::LowLevel {
op: LowLevel::Or,
op: LowLevel::NumBitwiseOr,
update_mode: UpdateModeId::BACKEND_DUMMY,
},
arguments: arena.alloc([or1, bitflag]),

View file

@ -1,6 +1,6 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.21 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.21;
procedure List.116 (List.563, List.564, List.565):
let List.693 : U64 = 0i64;
@ -95,7 +95,7 @@ procedure Test.1 (Test.2):
let Test.14 : {} = Struct {};
let Test.3 : U64 = CallByName List.26 Test.2 Test.13 Test.14;
let Test.12 : U64 = 0i64;
let Test.10 : Int1 = CallByName Bool.11 Test.3 Test.12;
let Test.10 : Int1 = CallByName Bool.9 Test.3 Test.12;
if Test.10 then
ret Test.2;
else

View file

@ -1,6 +1,6 @@
procedure Bool.1 ():
let Bool.23 : Int1 = false;
ret Bool.23;
let Bool.21 : Int1 = false;
ret Bool.21;
procedure Test.2 (Test.6):
let Test.22 : U8 = 1i64;

View file

@ -1,6 +1,6 @@
procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
let Bool.21 : Int1 = true;
ret Bool.21;
procedure List.101 (#Derived_gen.5, #Derived_gen.6, #Derived_gen.7, #Derived_gen.8, #Derived_gen.9):
joinpoint List.678 List.175 List.176 List.177 List.178 List.179:

View file

@ -1,17 +1,17 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.25 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.25;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.26 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.26;
procedure Bool.1 ():
let Bool.22 : Int1 = false;
ret Bool.22;
procedure Bool.2 ():
let Bool.23 : Int1 = true;
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23;
procedure Bool.3 (#Attr.2, #Attr.3):
let Bool.24 : Int1 = lowlevel And #Attr.2 #Attr.3;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.24 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.24;
procedure Inspect.245 (Inspect.246, Inspect.244):
@ -104,16 +104,16 @@ procedure Num.77 (#Attr.2, #Attr.3):
ret Num.293;
procedure Str.20 (#Attr.2):
let Str.313 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.313;
let Str.314 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.314;
procedure Str.3 (#Attr.2, #Attr.3):
let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.246;
procedure Str.35 (#Attr.2, #Attr.3):
let Str.303 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.303;
let Str.304 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.304;
procedure Str.36 (#Attr.2):
let Str.266 : U64 = lowlevel StrCountUtf8Bytes #Attr.2;
@ -151,24 +151,24 @@ procedure Str.38 (Str.112, Str.113):
procedure Str.45 (Str.91, Str.92, Str.93):
inc Str.91;
let Str.341 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.349 : U8 = 1i64;
let Str.350 : U8 = GetTagId Str.341;
let Str.351 : Int1 = lowlevel Eq Str.349 Str.350;
if Str.351 then
let Str.348 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.341;
let Str.95 : Str = StructAtIndex 0 Str.348;
let Str.94 : Str = StructAtIndex 1 Str.348;
let Str.346 : U64 = CallByName Str.36 Str.91;
let Str.342 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.350 : U8 = 1i64;
let Str.351 : U8 = GetTagId Str.342;
let Str.352 : Int1 = lowlevel Eq Str.350 Str.351;
if Str.352 then
let Str.349 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.342;
let Str.95 : Str = StructAtIndex 0 Str.349;
let Str.94 : Str = StructAtIndex 1 Str.349;
let Str.347 : U64 = CallByName Str.36 Str.91;
dec Str.91;
let Str.345 : Str = CallByName Str.20 Str.346;
let Str.344 : Str = CallByName Str.3 Str.345 Str.94;
let Str.346 : Str = CallByName Str.20 Str.347;
let Str.345 : Str = CallByName Str.3 Str.346 Str.94;
dec Str.94;
let Str.343 : Str = CallByName Str.3 Str.344 Str.93;
let Str.342 : Str = CallByName Str.56 Str.343 Str.95 Str.92 Str.93;
ret Str.342;
let Str.344 : Str = CallByName Str.3 Str.345 Str.93;
let Str.343 : Str = CallByName Str.56 Str.344 Str.95 Str.92 Str.93;
ret Str.343;
else
dec Str.341;
dec Str.342;
ret Str.91;
procedure Str.56 (#Derived_gen.5, #Derived_gen.6, #Derived_gen.7, #Derived_gen.8):
@ -232,8 +232,8 @@ procedure Str.58 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4
jump Str.278 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4;
procedure Str.61 (Str.152, Str.153):
let Str.308 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.308 then
let Str.309 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.309 then
ret Str.152;
else
ret Str.153;
@ -241,12 +241,12 @@ procedure Str.61 (Str.152, Str.153):
procedure Str.62 (Str.154, Str.155, Str.156):
let Str.157 : U64 = CallByName Str.36 Str.154;
let Str.158 : U64 = CallByName Str.36 Str.156;
let Str.306 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.306 Str.157;
let Str.305 : U64 = 0i64;
let Str.307 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.307 Str.157;
let Str.306 : U64 = 0i64;
inc Str.156;
inc Str.154;
let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.305, Str.158};
let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.306, Str.158};
let Str.286 : Int1 = CallByName Str.63 Str.287;
ret Str.286;
@ -261,24 +261,27 @@ procedure Str.63 (Str.160):
if Str.167 then
dec Str.163;
dec Str.161;
let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165;
let Str.168 : Int1 = CallByName Bool.9 Str.164 Str.165;
ret Str.168;
else
let Str.301 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.302 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.11 Str.301 Str.302;
let Str.291 : U64 = StructAtIndex 0 Str.160;
let Str.292 : Str = StructAtIndex 1 Str.160;
let Str.294 : Str = StructAtIndex 3 Str.160;
let Str.296 : U64 = StructAtIndex 5 Str.160;
let Str.302 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.303 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.9 Str.302 Str.303;
let Str.292 : U64 = StructAtIndex 0 Str.160;
let Str.293 : Str = StructAtIndex 1 Str.160;
let Str.295 : Str = StructAtIndex 3 Str.160;
let Str.297 : U64 = StructAtIndex 5 Str.160;
let Str.301 : U64 = 1i64;
let Str.299 : U64 = CallByName Num.51 Str.164 Str.301;
let Str.300 : U64 = 1i64;
let Str.298 : U64 = CallByName Num.51 Str.164 Str.300;
let Str.299 : U64 = 1i64;
let Str.297 : U64 = CallByName Num.51 Str.162 Str.299;
let Str.290 : {U64, Str, U64, Str, U64, U64} = Struct {Str.291, Str.292, Str.297, Str.294, Str.298, Str.296};
let Str.170 : Int1 = CallByName Str.63 Str.290;
let Str.289 : Int1 = CallByName Bool.3 Str.169 Str.170;
ret Str.289;
let Str.298 : U64 = CallByName Num.51 Str.162 Str.300;
let Str.291 : {U64, Str, U64, Str, U64, U64} = Struct {Str.292, Str.293, Str.298, Str.295, Str.299, Str.297};
let Str.170 : Int1 = CallByName Str.63 Str.291;
if Str.169 then
ret Str.170;
else
let Str.289 : Int1 = CallByName Bool.1;
ret Str.289;
procedure Test.1 ():
let Test.4 : Str = "";

View file

@ -1,13 +1,13 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.24 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.24;
procedure Bool.1 ():
let Bool.21 : Int1 = false;
ret Bool.21;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.25 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.25;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.22 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.22;
procedure Bool.3 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel And #Attr.2 #Attr.3;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23;
procedure Inspect.245 (Inspect.246, Inspect.244):
@ -100,16 +100,16 @@ procedure Num.77 (#Attr.2, #Attr.3):
ret Num.293;
procedure Str.20 (#Attr.2):
let Str.315 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.315;
let Str.316 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.316;
procedure Str.3 (#Attr.2, #Attr.3):
let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.248;
procedure Str.35 (#Attr.2, #Attr.3):
let Str.305 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.305;
let Str.306 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.306;
procedure Str.36 (#Attr.2):
let Str.268 : U64 = lowlevel StrCountUtf8Bytes #Attr.2;
@ -147,24 +147,24 @@ procedure Str.38 (Str.112, Str.113):
procedure Str.45 (Str.91, Str.92, Str.93):
inc Str.91;
let Str.343 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.351 : U8 = 1i64;
let Str.352 : U8 = GetTagId Str.343;
let Str.353 : Int1 = lowlevel Eq Str.351 Str.352;
if Str.353 then
let Str.350 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.343;
let Str.95 : Str = StructAtIndex 0 Str.350;
let Str.94 : Str = StructAtIndex 1 Str.350;
let Str.348 : U64 = CallByName Str.36 Str.91;
let Str.344 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.352 : U8 = 1i64;
let Str.353 : U8 = GetTagId Str.344;
let Str.354 : Int1 = lowlevel Eq Str.352 Str.353;
if Str.354 then
let Str.351 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.344;
let Str.95 : Str = StructAtIndex 0 Str.351;
let Str.94 : Str = StructAtIndex 1 Str.351;
let Str.349 : U64 = CallByName Str.36 Str.91;
dec Str.91;
let Str.347 : Str = CallByName Str.20 Str.348;
let Str.346 : Str = CallByName Str.3 Str.347 Str.94;
let Str.348 : Str = CallByName Str.20 Str.349;
let Str.347 : Str = CallByName Str.3 Str.348 Str.94;
dec Str.94;
let Str.345 : Str = CallByName Str.3 Str.346 Str.93;
let Str.344 : Str = CallByName Str.56 Str.345 Str.95 Str.92 Str.93;
ret Str.344;
let Str.346 : Str = CallByName Str.3 Str.347 Str.93;
let Str.345 : Str = CallByName Str.56 Str.346 Str.95 Str.92 Str.93;
ret Str.345;
else
dec Str.343;
dec Str.344;
ret Str.91;
procedure Str.56 (#Derived_gen.5, #Derived_gen.6, #Derived_gen.7, #Derived_gen.8):
@ -228,8 +228,8 @@ procedure Str.58 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4
jump Str.280 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4;
procedure Str.61 (Str.152, Str.153):
let Str.310 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.310 then
let Str.311 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.311 then
ret Str.152;
else
ret Str.153;
@ -237,12 +237,12 @@ procedure Str.61 (Str.152, Str.153):
procedure Str.62 (Str.154, Str.155, Str.156):
let Str.157 : U64 = CallByName Str.36 Str.154;
let Str.158 : U64 = CallByName Str.36 Str.156;
let Str.308 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.308 Str.157;
let Str.307 : U64 = 0i64;
let Str.309 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.309 Str.157;
let Str.308 : U64 = 0i64;
inc Str.156;
inc Str.154;
let Str.289 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.307, Str.158};
let Str.289 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.308, Str.158};
let Str.288 : Int1 = CallByName Str.63 Str.289;
ret Str.288;
@ -257,24 +257,27 @@ procedure Str.63 (Str.160):
if Str.167 then
dec Str.163;
dec Str.161;
let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165;
let Str.168 : Int1 = CallByName Bool.9 Str.164 Str.165;
ret Str.168;
else
let Str.303 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.304 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.11 Str.303 Str.304;
let Str.293 : U64 = StructAtIndex 0 Str.160;
let Str.294 : Str = StructAtIndex 1 Str.160;
let Str.296 : Str = StructAtIndex 3 Str.160;
let Str.298 : U64 = StructAtIndex 5 Str.160;
let Str.304 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.305 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.9 Str.304 Str.305;
let Str.294 : U64 = StructAtIndex 0 Str.160;
let Str.295 : Str = StructAtIndex 1 Str.160;
let Str.297 : Str = StructAtIndex 3 Str.160;
let Str.299 : U64 = StructAtIndex 5 Str.160;
let Str.303 : U64 = 1i64;
let Str.301 : U64 = CallByName Num.51 Str.164 Str.303;
let Str.302 : U64 = 1i64;
let Str.300 : U64 = CallByName Num.51 Str.164 Str.302;
let Str.301 : U64 = 1i64;
let Str.299 : U64 = CallByName Num.51 Str.162 Str.301;
let Str.292 : {U64, Str, U64, Str, U64, U64} = Struct {Str.293, Str.294, Str.299, Str.296, Str.300, Str.298};
let Str.170 : Int1 = CallByName Str.63 Str.292;
let Str.291 : Int1 = CallByName Bool.3 Str.169 Str.170;
ret Str.291;
let Str.300 : U64 = CallByName Num.51 Str.162 Str.302;
let Str.293 : {U64, Str, U64, Str, U64, U64} = Struct {Str.294, Str.295, Str.300, Str.297, Str.301, Str.299};
let Str.170 : Int1 = CallByName Str.63 Str.293;
if Str.169 then
ret Str.170;
else
let Str.291 : Int1 = CallByName Bool.1;
ret Str.291;
procedure Test.0 ():
let Test.5 : Str = "Hello ";

View file

@ -1,13 +1,13 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.24 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.24;
procedure Bool.1 ():
let Bool.21 : Int1 = false;
ret Bool.21;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.25 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.25;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.22 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.22;
procedure Bool.3 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel And #Attr.2 #Attr.3;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23;
procedure Inspect.245 (Inspect.246, Inspect.244):
@ -100,16 +100,16 @@ procedure Num.77 (#Attr.2, #Attr.3):
ret Num.293;
procedure Str.20 (#Attr.2):
let Str.313 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.313;
let Str.314 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.314;
procedure Str.3 (#Attr.2, #Attr.3):
let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.246;
procedure Str.35 (#Attr.2, #Attr.3):
let Str.303 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.303;
let Str.304 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.304;
procedure Str.36 (#Attr.2):
let Str.266 : U64 = lowlevel StrCountUtf8Bytes #Attr.2;
@ -147,24 +147,24 @@ procedure Str.38 (Str.112, Str.113):
procedure Str.45 (Str.91, Str.92, Str.93):
inc Str.91;
let Str.341 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.349 : U8 = 1i64;
let Str.350 : U8 = GetTagId Str.341;
let Str.351 : Int1 = lowlevel Eq Str.349 Str.350;
if Str.351 then
let Str.348 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.341;
let Str.95 : Str = StructAtIndex 0 Str.348;
let Str.94 : Str = StructAtIndex 1 Str.348;
let Str.346 : U64 = CallByName Str.36 Str.91;
let Str.342 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.350 : U8 = 1i64;
let Str.351 : U8 = GetTagId Str.342;
let Str.352 : Int1 = lowlevel Eq Str.350 Str.351;
if Str.352 then
let Str.349 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.342;
let Str.95 : Str = StructAtIndex 0 Str.349;
let Str.94 : Str = StructAtIndex 1 Str.349;
let Str.347 : U64 = CallByName Str.36 Str.91;
dec Str.91;
let Str.345 : Str = CallByName Str.20 Str.346;
let Str.344 : Str = CallByName Str.3 Str.345 Str.94;
let Str.346 : Str = CallByName Str.20 Str.347;
let Str.345 : Str = CallByName Str.3 Str.346 Str.94;
dec Str.94;
let Str.343 : Str = CallByName Str.3 Str.344 Str.93;
let Str.342 : Str = CallByName Str.56 Str.343 Str.95 Str.92 Str.93;
ret Str.342;
let Str.344 : Str = CallByName Str.3 Str.345 Str.93;
let Str.343 : Str = CallByName Str.56 Str.344 Str.95 Str.92 Str.93;
ret Str.343;
else
dec Str.341;
dec Str.342;
ret Str.91;
procedure Str.56 (#Derived_gen.5, #Derived_gen.6, #Derived_gen.7, #Derived_gen.8):
@ -228,8 +228,8 @@ procedure Str.58 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4
jump Str.278 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4;
procedure Str.61 (Str.152, Str.153):
let Str.308 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.308 then
let Str.309 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.309 then
ret Str.152;
else
ret Str.153;
@ -237,12 +237,12 @@ procedure Str.61 (Str.152, Str.153):
procedure Str.62 (Str.154, Str.155, Str.156):
let Str.157 : U64 = CallByName Str.36 Str.154;
let Str.158 : U64 = CallByName Str.36 Str.156;
let Str.306 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.306 Str.157;
let Str.305 : U64 = 0i64;
let Str.307 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.307 Str.157;
let Str.306 : U64 = 0i64;
inc Str.156;
inc Str.154;
let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.305, Str.158};
let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.306, Str.158};
let Str.286 : Int1 = CallByName Str.63 Str.287;
ret Str.286;
@ -257,24 +257,27 @@ procedure Str.63 (Str.160):
if Str.167 then
dec Str.163;
dec Str.161;
let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165;
let Str.168 : Int1 = CallByName Bool.9 Str.164 Str.165;
ret Str.168;
else
let Str.301 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.302 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.11 Str.301 Str.302;
let Str.291 : U64 = StructAtIndex 0 Str.160;
let Str.292 : Str = StructAtIndex 1 Str.160;
let Str.294 : Str = StructAtIndex 3 Str.160;
let Str.296 : U64 = StructAtIndex 5 Str.160;
let Str.302 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.303 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.9 Str.302 Str.303;
let Str.292 : U64 = StructAtIndex 0 Str.160;
let Str.293 : Str = StructAtIndex 1 Str.160;
let Str.295 : Str = StructAtIndex 3 Str.160;
let Str.297 : U64 = StructAtIndex 5 Str.160;
let Str.301 : U64 = 1i64;
let Str.299 : U64 = CallByName Num.51 Str.164 Str.301;
let Str.300 : U64 = 1i64;
let Str.298 : U64 = CallByName Num.51 Str.164 Str.300;
let Str.299 : U64 = 1i64;
let Str.297 : U64 = CallByName Num.51 Str.162 Str.299;
let Str.290 : {U64, Str, U64, Str, U64, U64} = Struct {Str.291, Str.292, Str.297, Str.294, Str.298, Str.296};
let Str.170 : Int1 = CallByName Str.63 Str.290;
let Str.289 : Int1 = CallByName Bool.3 Str.169 Str.170;
ret Str.289;
let Str.298 : U64 = CallByName Num.51 Str.162 Str.300;
let Str.291 : {U64, Str, U64, Str, U64, U64} = Struct {Str.292, Str.293, Str.298, Str.295, Str.299, Str.297};
let Str.170 : Int1 = CallByName Str.63 Str.291;
if Str.169 then
ret Str.170;
else
let Str.289 : Int1 = CallByName Bool.1;
ret Str.289;
procedure Test.0 ():
let Test.3 : Str = "";

View file

@ -1,6 +1,6 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.24 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.24;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.22 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.22;
procedure Num.19 (#Attr.2, #Attr.3):
let Num.285 : I64 = lowlevel NumAdd #Attr.2 #Attr.3;
@ -25,7 +25,7 @@ procedure Test.1 (Test.2):
ret Test.8;
in
let Test.22 : I64 = 1i64;
let Test.20 : Int1 = CallByName Bool.11 Test.2 Test.22;
let Test.20 : Int1 = CallByName Bool.9 Test.2 Test.22;
if Test.20 then
dec Test.3;
let Test.21 : Str = "early 1";
@ -38,7 +38,7 @@ procedure Test.1 (Test.2):
jump Test.12 Test.11;
in
let Test.17 : I64 = 2i64;
let Test.15 : Int1 = CallByName Bool.11 Test.2 Test.17;
let Test.15 : Int1 = CallByName Bool.9 Test.2 Test.17;
if Test.15 then
dec Test.3;
dec Test.5;

View file

@ -1,6 +1,6 @@
procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Test.2 (Test.5):
let Test.6 : Int1 = CallByName Bool.2;

View file

@ -1,6 +1,6 @@
procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Test.2 (Test.5):
let Test.6 : Int1 = CallByName Bool.2;

View file

@ -1,6 +1,6 @@
procedure Bool.1 ():
let Bool.23 : Int1 = false;
ret Bool.23;
let Bool.21 : Int1 = false;
ret Bool.21;
procedure List.2 (List.120, List.121):
let List.681 : U64 = CallByName List.6 List.120;

View file

@ -1,6 +1,6 @@
procedure Bool.1 ():
let Bool.23 : Int1 = false;
ret Bool.23;
let Bool.21 : Int1 = false;
ret Bool.21;
procedure Test.1 (Test.2):
let Test.5 : I64 = 2i64;

View file

@ -1,6 +1,6 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.21 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.21;
procedure Test.1 (Test.3):
let Test.6 : I64 = 10i64;
@ -13,7 +13,7 @@ procedure Test.1 (Test.3):
ret Test.8;
in
let Test.12 : I64 = 5i64;
let Test.11 : Int1 = CallByName Bool.11 Test.6 Test.12;
let Test.11 : Int1 = CallByName Bool.9 Test.6 Test.12;
jump Test.10 Test.11;
procedure Test.0 ():

View file

@ -1,10 +1,10 @@
procedure Bool.1 ():
let Bool.23 : Int1 = false;
ret Bool.23;
let Bool.21 : Int1 = false;
ret Bool.21;
procedure Bool.2 ():
let Bool.24 : Int1 = true;
ret Bool.24;
let Bool.22 : Int1 = true;
ret Bool.22;
procedure Test.0 ():
let Test.4 : Int1 = CallByName Bool.2;

View file

@ -1,6 +1,6 @@
procedure Bool.1 ():
let Bool.23 : Int1 = false;
ret Bool.23;
let Bool.21 : Int1 = false;
ret Bool.21;
procedure Num.19 (#Attr.2, #Attr.3):
let Num.283 : I64 = lowlevel NumAdd #Attr.2 #Attr.3;

View file

@ -1,47 +1,43 @@
procedure Bool.1 ():
let Bool.32 : Int1 = false;
ret Bool.32;
let Bool.31 : Int1 = false;
ret Bool.31;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.28 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.28;
procedure Bool.10 (#Attr.2, #Attr.3):
let Bool.22 : Int1 = lowlevel NotEq #Attr.2 #Attr.3;
ret Bool.22;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.29 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.29;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.34 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.34;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.35 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.35;
procedure Bool.12 (#Attr.2, #Attr.3):
procedure Bool.10 (#Attr.2, #Attr.3):
let Bool.24 : Int1 = lowlevel NotEq #Attr.2 #Attr.3;
ret Bool.24;
procedure Bool.12 (#Attr.2, #Attr.3):
let Bool.26 : Int1 = lowlevel NotEq #Attr.2 #Attr.3;
ret Bool.26;
procedure Bool.2 ():
let Bool.31 : Int1 = true;
ret Bool.31;
let Bool.29 : Int1 = true;
ret Bool.29;
procedure Bool.3 (#Attr.2, #Attr.3):
let Bool.33 : Int1 = lowlevel And #Attr.2 #Attr.3;
ret Bool.33;
procedure Bool.5 (Bool.17, Bool.18):
let Bool.23 : Int1 = CallByName Bool.10 Bool.17 Bool.18;
ret Bool.23;
procedure Bool.7 (Bool.19, Bool.20):
let Bool.25 : Int1 = CallByName Bool.12 Bool.19 Bool.20;
procedure Bool.5 (Bool.17, Bool.18):
let Bool.25 : Int1 = CallByName Bool.10 Bool.17 Bool.18;
ret Bool.25;
procedure Bool.7 (Bool.19, Bool.20):
let Bool.27 : Int1 = CallByName Bool.12 Bool.19 Bool.20;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.26 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.26;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.27 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.27;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.32 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.32;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.33 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.33;
procedure Dict.1 (Dict.732):
let Dict.894 : List {U32, U32} = Array [];
let Dict.895 : List {Str, I64} = Array [];
@ -157,13 +153,13 @@ procedure Dict.45 (#Derived_gen.39, #Derived_gen.40, #Derived_gen.41, #Derived_g
joinpoint Dict.745 Dict.228 Dict.229 Dict.230 Dict.231 Dict.232 Dict.233 Dict.234 Dict.235 Dict.236:
let Dict.237 : {U32, U32} = CallByName Dict.22 Dict.228 Dict.230;
let Dict.792 : U32 = StructAtIndex 1 Dict.237;
let Dict.780 : Int1 = CallByName Bool.11 Dict.231 Dict.792;
let Dict.780 : Int1 = CallByName Bool.9 Dict.231 Dict.792;
if Dict.780 then
let Dict.791 : U32 = StructAtIndex 0 Dict.237;
let Dict.789 : U64 = CallByName Num.133 Dict.791;
let Dict.788 : {Str, I64} = CallByName Dict.22 Dict.229 Dict.789;
let Dict.238 : Str = StructAtIndex 0 Dict.788;
let Dict.783 : Int1 = CallByName Bool.11 Dict.238 Dict.232;
let Dict.783 : Int1 = CallByName Bool.9 Dict.238 Dict.232;
if Dict.783 then
let Dict.787 : U32 = StructAtIndex 0 Dict.237;
let Dict.785 : U64 = CallByName Num.133 Dict.787;
@ -250,7 +246,7 @@ procedure Dict.66 (Dict.728):
let #Derived_gen.71 : List {U32, U32} = StructAtIndex 0 Dict.728;
dec #Derived_gen.71;
let Dict.886 : U64 = CallByName Dict.54;
let Dict.845 : Int1 = CallByName Bool.7 Dict.386 Dict.886;
let Dict.845 : Int1 = CallByName Bool.5 Dict.386 Dict.886;
if Dict.845 then
let Dict.885 : U8 = 1i64;
let Dict.389 : U8 = CallByName Num.75 Dict.388 Dict.885;
@ -275,7 +271,7 @@ procedure Dict.66 (Dict.728):
procedure Dict.67 (Dict.393, Dict.394):
let Dict.395 : U64 = CallByName Dict.70 Dict.393;
let Dict.878 : U64 = CallByName Dict.54;
let Dict.873 : Int1 = CallByName Bool.11 Dict.395 Dict.878;
let Dict.873 : Int1 = CallByName Bool.9 Dict.395 Dict.878;
if Dict.873 then
let Dict.876 : {U32, U32} = CallByName Dict.48;
let Dict.877 : U64 = CallByName Dict.54;
@ -335,7 +331,7 @@ procedure Dict.74 (#Derived_gen.48, #Derived_gen.49, #Derived_gen.50):
let Dict.426 : {U32, U32} = CallByName Dict.22 Dict.423 Dict.425;
let Dict.772 : U32 = StructAtIndex 1 Dict.426;
let Dict.773 : U32 = 0i64;
let Dict.764 : Int1 = CallByName Bool.7 Dict.772 Dict.773;
let Dict.764 : Int1 = CallByName Bool.5 Dict.772 Dict.773;
if Dict.764 then
let Dict.427 : List {U32, U32} = CallByName List.3 Dict.423 Dict.425 Dict.424;
let Dict.769 : U32 = StructAtIndex 0 Dict.426;
@ -354,7 +350,7 @@ procedure Dict.74 (#Derived_gen.48, #Derived_gen.49, #Derived_gen.50):
procedure Dict.75 (Dict.428, Dict.429):
let Dict.758 : U64 = 1i64;
let Dict.757 : U64 = CallByName Num.51 Dict.428 Dict.758;
let Dict.754 : Int1 = CallByName Bool.7 Dict.757 Dict.429;
let Dict.754 : Int1 = CallByName Bool.5 Dict.757 Dict.429;
if Dict.754 then
let Dict.756 : U64 = 1i64;
let Dict.755 : U64 = CallByName Num.51 Dict.428 Dict.756;
@ -1212,16 +1208,16 @@ procedure Str.12 (#Attr.2):
ret Str.248;
procedure Str.20 (#Attr.2):
let Str.316 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.316;
let Str.317 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.317;
procedure Str.3 (#Attr.2, #Attr.3):
let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.249;
procedure Str.35 (#Attr.2, #Attr.3):
let Str.306 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.306;
let Str.307 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.307;
procedure Str.36 (#Attr.2):
let Str.269 : U64 = lowlevel StrCountUtf8Bytes #Attr.2;
@ -1259,24 +1255,24 @@ procedure Str.38 (Str.112, Str.113):
procedure Str.45 (Str.91, Str.92, Str.93):
inc Str.91;
let Str.344 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.352 : U8 = 1i64;
let Str.353 : U8 = GetTagId Str.344;
let Str.354 : Int1 = lowlevel Eq Str.352 Str.353;
if Str.354 then
let Str.351 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.344;
let Str.95 : Str = StructAtIndex 0 Str.351;
let Str.94 : Str = StructAtIndex 1 Str.351;
let Str.349 : U64 = CallByName Str.36 Str.91;
let Str.345 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.353 : U8 = 1i64;
let Str.354 : U8 = GetTagId Str.345;
let Str.355 : Int1 = lowlevel Eq Str.353 Str.354;
if Str.355 then
let Str.352 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.345;
let Str.95 : Str = StructAtIndex 0 Str.352;
let Str.94 : Str = StructAtIndex 1 Str.352;
let Str.350 : U64 = CallByName Str.36 Str.91;
dec Str.91;
let Str.348 : Str = CallByName Str.20 Str.349;
let Str.347 : Str = CallByName Str.3 Str.348 Str.94;
let Str.349 : Str = CallByName Str.20 Str.350;
let Str.348 : Str = CallByName Str.3 Str.349 Str.94;
dec Str.94;
let Str.346 : Str = CallByName Str.3 Str.347 Str.93;
let Str.345 : Str = CallByName Str.56 Str.346 Str.95 Str.92 Str.93;
ret Str.345;
let Str.347 : Str = CallByName Str.3 Str.348 Str.93;
let Str.346 : Str = CallByName Str.56 Str.347 Str.95 Str.92 Str.93;
ret Str.346;
else
dec Str.344;
dec Str.345;
ret Str.91;
procedure Str.56 (#Derived_gen.56, #Derived_gen.57, #Derived_gen.58, #Derived_gen.59):
@ -1340,8 +1336,8 @@ procedure Str.58 (#Derived_gen.33, #Derived_gen.34, #Derived_gen.35, #Derived_ge
jump Str.281 #Derived_gen.33 #Derived_gen.34 #Derived_gen.35 #Derived_gen.36;
procedure Str.61 (Str.152, Str.153):
let Str.311 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.311 then
let Str.312 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.312 then
ret Str.152;
else
ret Str.153;
@ -1349,12 +1345,12 @@ procedure Str.61 (Str.152, Str.153):
procedure Str.62 (Str.154, Str.155, Str.156):
let Str.157 : U64 = CallByName Str.36 Str.154;
let Str.158 : U64 = CallByName Str.36 Str.156;
let Str.309 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.309 Str.157;
let Str.308 : U64 = 0i64;
let Str.310 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.310 Str.157;
let Str.309 : U64 = 0i64;
inc Str.156;
inc Str.154;
let Str.290 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.308, Str.158};
let Str.290 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.309, Str.158};
let Str.289 : Int1 = CallByName Str.63 Str.290;
ret Str.289;
@ -1369,24 +1365,27 @@ procedure Str.63 (Str.160):
if Str.167 then
dec Str.163;
dec Str.161;
let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165;
let Str.168 : Int1 = CallByName Bool.9 Str.164 Str.165;
ret Str.168;
else
let Str.304 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.305 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.11 Str.304 Str.305;
let Str.294 : U64 = StructAtIndex 0 Str.160;
let Str.295 : Str = StructAtIndex 1 Str.160;
let Str.297 : Str = StructAtIndex 3 Str.160;
let Str.299 : U64 = StructAtIndex 5 Str.160;
let Str.305 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.306 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.9 Str.305 Str.306;
let Str.295 : U64 = StructAtIndex 0 Str.160;
let Str.296 : Str = StructAtIndex 1 Str.160;
let Str.298 : Str = StructAtIndex 3 Str.160;
let Str.300 : U64 = StructAtIndex 5 Str.160;
let Str.304 : U64 = 1i64;
let Str.302 : U64 = CallByName Num.51 Str.164 Str.304;
let Str.303 : U64 = 1i64;
let Str.301 : U64 = CallByName Num.51 Str.164 Str.303;
let Str.302 : U64 = 1i64;
let Str.300 : U64 = CallByName Num.51 Str.162 Str.302;
let Str.293 : {U64, Str, U64, Str, U64, U64} = Struct {Str.294, Str.295, Str.300, Str.297, Str.301, Str.299};
let Str.170 : Int1 = CallByName Str.63 Str.293;
let Str.292 : Int1 = CallByName Bool.3 Str.169 Str.170;
ret Str.292;
let Str.301 : U64 = CallByName Num.51 Str.162 Str.303;
let Str.294 : {U64, Str, U64, Str, U64, U64} = Struct {Str.295, Str.296, Str.301, Str.298, Str.302, Str.300};
let Str.170 : Int1 = CallByName Str.63 Str.294;
if Str.169 then
ret Str.170;
else
let Str.292 : Int1 = CallByName Bool.1;
ret Str.292;
procedure Test.0 ():
let Test.8 : Str = "a";

View file

@ -14,12 +14,12 @@ procedure #Derived.4 (#Derived.5, #Derived.1):
ret #Derived_gen.3;
procedure Bool.1 ():
let Bool.24 : Int1 = false;
ret Bool.24;
let Bool.22 : Int1 = false;
ret Bool.22;
procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Inspect.156 (Inspect.157, #Attr.12):
let Inspect.155 : {} = StructAtIndex 2 #Attr.12;

View file

@ -27,23 +27,19 @@ procedure #Derived.6 (#Derived.7, #Derived.5):
ret #Derived_gen.13;
procedure Bool.1 ():
let Bool.26 : Int1 = false;
ret Bool.26;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.28 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.28;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.29 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.29;
procedure Bool.2 ():
let Bool.25 : Int1 = true;
let Bool.25 : Int1 = false;
ret Bool.25;
procedure Bool.3 (#Attr.2, #Attr.3):
let Bool.27 : Int1 = lowlevel And #Attr.2 #Attr.3;
procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.26 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.26;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.27 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.27;
procedure Inspect.225 (Inspect.226, Inspect.224):
@ -326,16 +322,16 @@ procedure Num.77 (#Attr.2, #Attr.3):
ret Num.295;
procedure Str.20 (#Attr.2):
let Str.314 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.314;
let Str.315 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.315;
procedure Str.3 (#Attr.2, #Attr.3):
let Str.247 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.247;
procedure Str.35 (#Attr.2, #Attr.3):
let Str.304 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.304;
let Str.305 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.305;
procedure Str.36 (#Attr.2):
let Str.267 : U64 = lowlevel StrCountUtf8Bytes #Attr.2;
@ -373,24 +369,24 @@ procedure Str.38 (Str.112, Str.113):
procedure Str.45 (Str.91, Str.92, Str.93):
inc Str.91;
let Str.342 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.350 : U8 = 1i64;
let Str.351 : U8 = GetTagId Str.342;
let Str.352 : Int1 = lowlevel Eq Str.350 Str.351;
if Str.352 then
let Str.349 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.342;
let Str.95 : Str = StructAtIndex 0 Str.349;
let Str.94 : Str = StructAtIndex 1 Str.349;
let Str.347 : U64 = CallByName Str.36 Str.91;
let Str.343 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.351 : U8 = 1i64;
let Str.352 : U8 = GetTagId Str.343;
let Str.353 : Int1 = lowlevel Eq Str.351 Str.352;
if Str.353 then
let Str.350 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.343;
let Str.95 : Str = StructAtIndex 0 Str.350;
let Str.94 : Str = StructAtIndex 1 Str.350;
let Str.348 : U64 = CallByName Str.36 Str.91;
dec Str.91;
let Str.346 : Str = CallByName Str.20 Str.347;
let Str.345 : Str = CallByName Str.3 Str.346 Str.94;
let Str.347 : Str = CallByName Str.20 Str.348;
let Str.346 : Str = CallByName Str.3 Str.347 Str.94;
dec Str.94;
let Str.344 : Str = CallByName Str.3 Str.345 Str.93;
let Str.343 : Str = CallByName Str.56 Str.344 Str.95 Str.92 Str.93;
ret Str.343;
let Str.345 : Str = CallByName Str.3 Str.346 Str.93;
let Str.344 : Str = CallByName Str.56 Str.345 Str.95 Str.92 Str.93;
ret Str.344;
else
dec Str.342;
dec Str.343;
ret Str.91;
procedure Str.56 (#Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30):
@ -454,8 +450,8 @@ procedure Str.58 (#Derived_gen.33, #Derived_gen.34, #Derived_gen.35, #Derived_ge
jump Str.279 #Derived_gen.33 #Derived_gen.34 #Derived_gen.35 #Derived_gen.36;
procedure Str.61 (Str.152, Str.153):
let Str.309 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.309 then
let Str.310 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.310 then
ret Str.152;
else
ret Str.153;
@ -463,12 +459,12 @@ procedure Str.61 (Str.152, Str.153):
procedure Str.62 (Str.154, Str.155, Str.156):
let Str.157 : U64 = CallByName Str.36 Str.154;
let Str.158 : U64 = CallByName Str.36 Str.156;
let Str.307 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.307 Str.157;
let Str.306 : U64 = 0i64;
let Str.308 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.308 Str.157;
let Str.307 : U64 = 0i64;
inc Str.156;
inc Str.154;
let Str.288 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.306, Str.158};
let Str.288 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.307, Str.158};
let Str.287 : Int1 = CallByName Str.63 Str.288;
ret Str.287;
@ -483,24 +479,27 @@ procedure Str.63 (Str.160):
if Str.167 then
dec Str.163;
dec Str.161;
let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165;
let Str.168 : Int1 = CallByName Bool.9 Str.164 Str.165;
ret Str.168;
else
let Str.302 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.303 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.11 Str.302 Str.303;
let Str.292 : U64 = StructAtIndex 0 Str.160;
let Str.293 : Str = StructAtIndex 1 Str.160;
let Str.295 : Str = StructAtIndex 3 Str.160;
let Str.297 : U64 = StructAtIndex 5 Str.160;
let Str.303 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.304 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.9 Str.303 Str.304;
let Str.293 : U64 = StructAtIndex 0 Str.160;
let Str.294 : Str = StructAtIndex 1 Str.160;
let Str.296 : Str = StructAtIndex 3 Str.160;
let Str.298 : U64 = StructAtIndex 5 Str.160;
let Str.302 : U64 = 1i64;
let Str.300 : U64 = CallByName Num.51 Str.164 Str.302;
let Str.301 : U64 = 1i64;
let Str.299 : U64 = CallByName Num.51 Str.164 Str.301;
let Str.300 : U64 = 1i64;
let Str.298 : U64 = CallByName Num.51 Str.162 Str.300;
let Str.291 : {U64, Str, U64, Str, U64, U64} = Struct {Str.292, Str.293, Str.298, Str.295, Str.299, Str.297};
let Str.170 : Int1 = CallByName Str.63 Str.291;
let Str.290 : Int1 = CallByName Bool.3 Str.169 Str.170;
ret Str.290;
let Str.299 : U64 = CallByName Num.51 Str.162 Str.301;
let Str.292 : {U64, Str, U64, Str, U64, U64} = Struct {Str.293, Str.294, Str.299, Str.296, Str.300, Str.298};
let Str.170 : Int1 = CallByName Str.63 Str.292;
if Str.169 then
ret Str.170;
else
let Str.290 : Int1 = CallByName Bool.1;
ret Str.290;
procedure Test.0 ():
let Test.4 : Str = "bar";

View file

@ -18,12 +18,12 @@ procedure #Derived.2 (#Derived.3, #Derived.1):
ret #Derived_gen.3;
procedure Bool.1 ():
let Bool.24 : Int1 = false;
ret Bool.24;
let Bool.22 : Int1 = false;
ret Bool.22;
procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Inspect.225 (Inspect.226, Inspect.224):
let Inspect.339 : Str = "{";

View file

@ -13,23 +13,19 @@ procedure #Derived.2 (#Derived.3, #Derived.1):
ret #Derived_gen.3;
procedure Bool.1 ():
let Bool.24 : Int1 = false;
ret Bool.24;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.26 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.26;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.27 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.27;
procedure Bool.2 ():
let Bool.23 : Int1 = true;
let Bool.23 : Int1 = false;
ret Bool.23;
procedure Bool.3 (#Attr.2, #Attr.3):
let Bool.25 : Int1 = lowlevel And #Attr.2 #Attr.3;
procedure Bool.2 ():
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.24 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.24;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.25 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.25;
procedure Inspect.225 (Inspect.226, Inspect.224):
@ -220,16 +216,16 @@ procedure Num.77 (#Attr.2, #Attr.3):
ret Num.293;
procedure Str.20 (#Attr.2):
let Str.313 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.313;
let Str.314 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.314;
procedure Str.3 (#Attr.2, #Attr.3):
let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.246;
procedure Str.35 (#Attr.2, #Attr.3):
let Str.303 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.303;
let Str.304 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.304;
procedure Str.36 (#Attr.2):
let Str.266 : U64 = lowlevel StrCountUtf8Bytes #Attr.2;
@ -267,24 +263,24 @@ procedure Str.38 (Str.112, Str.113):
procedure Str.45 (Str.91, Str.92, Str.93):
inc Str.91;
let Str.341 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.349 : U8 = 1i64;
let Str.350 : U8 = GetTagId Str.341;
let Str.351 : Int1 = lowlevel Eq Str.349 Str.350;
if Str.351 then
let Str.348 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.341;
let Str.95 : Str = StructAtIndex 0 Str.348;
let Str.94 : Str = StructAtIndex 1 Str.348;
let Str.346 : U64 = CallByName Str.36 Str.91;
let Str.342 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.350 : U8 = 1i64;
let Str.351 : U8 = GetTagId Str.342;
let Str.352 : Int1 = lowlevel Eq Str.350 Str.351;
if Str.352 then
let Str.349 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.342;
let Str.95 : Str = StructAtIndex 0 Str.349;
let Str.94 : Str = StructAtIndex 1 Str.349;
let Str.347 : U64 = CallByName Str.36 Str.91;
dec Str.91;
let Str.345 : Str = CallByName Str.20 Str.346;
let Str.344 : Str = CallByName Str.3 Str.345 Str.94;
let Str.346 : Str = CallByName Str.20 Str.347;
let Str.345 : Str = CallByName Str.3 Str.346 Str.94;
dec Str.94;
let Str.343 : Str = CallByName Str.3 Str.344 Str.93;
let Str.342 : Str = CallByName Str.56 Str.343 Str.95 Str.92 Str.93;
ret Str.342;
let Str.344 : Str = CallByName Str.3 Str.345 Str.93;
let Str.343 : Str = CallByName Str.56 Str.344 Str.95 Str.92 Str.93;
ret Str.343;
else
dec Str.341;
dec Str.342;
ret Str.91;
procedure Str.56 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27):
@ -348,8 +344,8 @@ procedure Str.58 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_ge
jump Str.278 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23;
procedure Str.61 (Str.152, Str.153):
let Str.308 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.308 then
let Str.309 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.309 then
ret Str.152;
else
ret Str.153;
@ -357,12 +353,12 @@ procedure Str.61 (Str.152, Str.153):
procedure Str.62 (Str.154, Str.155, Str.156):
let Str.157 : U64 = CallByName Str.36 Str.154;
let Str.158 : U64 = CallByName Str.36 Str.156;
let Str.306 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.306 Str.157;
let Str.305 : U64 = 0i64;
let Str.307 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.307 Str.157;
let Str.306 : U64 = 0i64;
inc Str.156;
inc Str.154;
let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.305, Str.158};
let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.306, Str.158};
let Str.286 : Int1 = CallByName Str.63 Str.287;
ret Str.286;
@ -377,24 +373,27 @@ procedure Str.63 (Str.160):
if Str.167 then
dec Str.163;
dec Str.161;
let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165;
let Str.168 : Int1 = CallByName Bool.9 Str.164 Str.165;
ret Str.168;
else
let Str.301 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.302 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.11 Str.301 Str.302;
let Str.291 : U64 = StructAtIndex 0 Str.160;
let Str.292 : Str = StructAtIndex 1 Str.160;
let Str.294 : Str = StructAtIndex 3 Str.160;
let Str.296 : U64 = StructAtIndex 5 Str.160;
let Str.302 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.303 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.9 Str.302 Str.303;
let Str.292 : U64 = StructAtIndex 0 Str.160;
let Str.293 : Str = StructAtIndex 1 Str.160;
let Str.295 : Str = StructAtIndex 3 Str.160;
let Str.297 : U64 = StructAtIndex 5 Str.160;
let Str.301 : U64 = 1i64;
let Str.299 : U64 = CallByName Num.51 Str.164 Str.301;
let Str.300 : U64 = 1i64;
let Str.298 : U64 = CallByName Num.51 Str.164 Str.300;
let Str.299 : U64 = 1i64;
let Str.297 : U64 = CallByName Num.51 Str.162 Str.299;
let Str.290 : {U64, Str, U64, Str, U64, U64} = Struct {Str.291, Str.292, Str.297, Str.294, Str.298, Str.296};
let Str.170 : Int1 = CallByName Str.63 Str.290;
let Str.289 : Int1 = CallByName Bool.3 Str.169 Str.170;
ret Str.289;
let Str.298 : U64 = CallByName Num.51 Str.162 Str.300;
let Str.291 : {U64, Str, U64, Str, U64, U64} = Struct {Str.292, Str.293, Str.298, Str.295, Str.299, Str.297};
let Str.170 : Int1 = CallByName Str.63 Str.291;
if Str.169 then
ret Str.170;
else
let Str.289 : Int1 = CallByName Bool.1;
ret Str.289;
procedure Test.0 ():
let Test.3 : Str = "foo";

View file

@ -20,23 +20,19 @@ procedure #Derived.2 (#Derived.3, #Derived.1):
ret #Derived_gen.3;
procedure Bool.1 ():
let Bool.24 : Int1 = false;
ret Bool.24;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.26 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.26;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.27 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.27;
procedure Bool.2 ():
let Bool.23 : Int1 = true;
let Bool.23 : Int1 = false;
ret Bool.23;
procedure Bool.3 (#Attr.2, #Attr.3):
let Bool.25 : Int1 = lowlevel And #Attr.2 #Attr.3;
procedure Bool.2 ():
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.24 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.24;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.25 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.25;
procedure Inspect.225 (Inspect.226, Inspect.224):
@ -227,16 +223,16 @@ procedure Num.77 (#Attr.2, #Attr.3):
ret Num.293;
procedure Str.20 (#Attr.2):
let Str.313 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.313;
let Str.314 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.314;
procedure Str.3 (#Attr.2, #Attr.3):
let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.246;
procedure Str.35 (#Attr.2, #Attr.3):
let Str.303 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.303;
let Str.304 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.304;
procedure Str.36 (#Attr.2):
let Str.266 : U64 = lowlevel StrCountUtf8Bytes #Attr.2;
@ -274,24 +270,24 @@ procedure Str.38 (Str.112, Str.113):
procedure Str.45 (Str.91, Str.92, Str.93):
inc Str.91;
let Str.385 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.393 : U8 = 1i64;
let Str.394 : U8 = GetTagId Str.385;
let Str.395 : Int1 = lowlevel Eq Str.393 Str.394;
if Str.395 then
let Str.392 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.385;
let Str.95 : Str = StructAtIndex 0 Str.392;
let Str.94 : Str = StructAtIndex 1 Str.392;
let Str.390 : U64 = CallByName Str.36 Str.91;
let Str.386 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.394 : U8 = 1i64;
let Str.395 : U8 = GetTagId Str.386;
let Str.396 : Int1 = lowlevel Eq Str.394 Str.395;
if Str.396 then
let Str.393 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.386;
let Str.95 : Str = StructAtIndex 0 Str.393;
let Str.94 : Str = StructAtIndex 1 Str.393;
let Str.391 : U64 = CallByName Str.36 Str.91;
dec Str.91;
let Str.389 : Str = CallByName Str.20 Str.390;
let Str.388 : Str = CallByName Str.3 Str.389 Str.94;
let Str.390 : Str = CallByName Str.20 Str.391;
let Str.389 : Str = CallByName Str.3 Str.390 Str.94;
dec Str.94;
let Str.387 : Str = CallByName Str.3 Str.388 Str.93;
let Str.386 : Str = CallByName Str.56 Str.387 Str.95 Str.92 Str.93;
ret Str.386;
let Str.388 : Str = CallByName Str.3 Str.389 Str.93;
let Str.387 : Str = CallByName Str.56 Str.388 Str.95 Str.92 Str.93;
ret Str.387;
else
dec Str.385;
dec Str.386;
ret Str.91;
procedure Str.56 (#Derived_gen.28, #Derived_gen.29, #Derived_gen.30, #Derived_gen.31):
@ -355,8 +351,8 @@ procedure Str.58 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_ge
jump Str.278 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27;
procedure Str.61 (Str.152, Str.153):
let Str.308 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.308 then
let Str.309 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.309 then
ret Str.152;
else
ret Str.153;
@ -364,12 +360,12 @@ procedure Str.61 (Str.152, Str.153):
procedure Str.62 (Str.154, Str.155, Str.156):
let Str.157 : U64 = CallByName Str.36 Str.154;
let Str.158 : U64 = CallByName Str.36 Str.156;
let Str.306 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.306 Str.157;
let Str.305 : U64 = 0i64;
let Str.307 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.307 Str.157;
let Str.306 : U64 = 0i64;
inc Str.156;
inc Str.154;
let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.305, Str.158};
let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.306, Str.158};
let Str.286 : Int1 = CallByName Str.63 Str.287;
ret Str.286;
@ -384,24 +380,27 @@ procedure Str.63 (Str.160):
if Str.167 then
dec Str.163;
dec Str.161;
let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165;
let Str.168 : Int1 = CallByName Bool.9 Str.164 Str.165;
ret Str.168;
else
let Str.301 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.302 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.11 Str.301 Str.302;
let Str.291 : U64 = StructAtIndex 0 Str.160;
let Str.292 : Str = StructAtIndex 1 Str.160;
let Str.294 : Str = StructAtIndex 3 Str.160;
let Str.296 : U64 = StructAtIndex 5 Str.160;
let Str.302 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.303 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.9 Str.302 Str.303;
let Str.292 : U64 = StructAtIndex 0 Str.160;
let Str.293 : Str = StructAtIndex 1 Str.160;
let Str.295 : Str = StructAtIndex 3 Str.160;
let Str.297 : U64 = StructAtIndex 5 Str.160;
let Str.301 : U64 = 1i64;
let Str.299 : U64 = CallByName Num.51 Str.164 Str.301;
let Str.300 : U64 = 1i64;
let Str.298 : U64 = CallByName Num.51 Str.164 Str.300;
let Str.299 : U64 = 1i64;
let Str.297 : U64 = CallByName Num.51 Str.162 Str.299;
let Str.290 : {U64, Str, U64, Str, U64, U64} = Struct {Str.291, Str.292, Str.297, Str.294, Str.298, Str.296};
let Str.170 : Int1 = CallByName Str.63 Str.290;
let Str.289 : Int1 = CallByName Bool.3 Str.169 Str.170;
ret Str.289;
let Str.298 : U64 = CallByName Num.51 Str.162 Str.300;
let Str.291 : {U64, Str, U64, Str, U64, U64} = Struct {Str.292, Str.293, Str.298, Str.295, Str.299, Str.297};
let Str.170 : Int1 = CallByName Str.63 Str.291;
if Str.169 then
ret Str.170;
else
let Str.289 : Int1 = CallByName Bool.1;
ret Str.289;
procedure Test.0 ():
let Test.3 : Str = "foo";

View file

@ -1,13 +1,13 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.24 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.24;
procedure Bool.1 ():
let Bool.21 : Int1 = false;
ret Bool.21;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.25 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.25;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.22 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.22;
procedure Bool.3 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel And #Attr.2 #Attr.3;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23;
procedure Inspect.245 (Inspect.246, Inspect.244):
@ -100,16 +100,16 @@ procedure Num.77 (#Attr.2, #Attr.3):
ret Num.293;
procedure Str.20 (#Attr.2):
let Str.313 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.313;
let Str.314 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.314;
procedure Str.3 (#Attr.2, #Attr.3):
let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.246;
procedure Str.35 (#Attr.2, #Attr.3):
let Str.303 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.303;
let Str.304 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.304;
procedure Str.36 (#Attr.2):
let Str.266 : U64 = lowlevel StrCountUtf8Bytes #Attr.2;
@ -147,24 +147,24 @@ procedure Str.38 (Str.112, Str.113):
procedure Str.45 (Str.91, Str.92, Str.93):
inc Str.91;
let Str.341 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.349 : U8 = 1i64;
let Str.350 : U8 = GetTagId Str.341;
let Str.351 : Int1 = lowlevel Eq Str.349 Str.350;
if Str.351 then
let Str.348 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.341;
let Str.95 : Str = StructAtIndex 0 Str.348;
let Str.94 : Str = StructAtIndex 1 Str.348;
let Str.346 : U64 = CallByName Str.36 Str.91;
let Str.342 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.350 : U8 = 1i64;
let Str.351 : U8 = GetTagId Str.342;
let Str.352 : Int1 = lowlevel Eq Str.350 Str.351;
if Str.352 then
let Str.349 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.342;
let Str.95 : Str = StructAtIndex 0 Str.349;
let Str.94 : Str = StructAtIndex 1 Str.349;
let Str.347 : U64 = CallByName Str.36 Str.91;
dec Str.91;
let Str.345 : Str = CallByName Str.20 Str.346;
let Str.344 : Str = CallByName Str.3 Str.345 Str.94;
let Str.346 : Str = CallByName Str.20 Str.347;
let Str.345 : Str = CallByName Str.3 Str.346 Str.94;
dec Str.94;
let Str.343 : Str = CallByName Str.3 Str.344 Str.93;
let Str.342 : Str = CallByName Str.56 Str.343 Str.95 Str.92 Str.93;
ret Str.342;
let Str.344 : Str = CallByName Str.3 Str.345 Str.93;
let Str.343 : Str = CallByName Str.56 Str.344 Str.95 Str.92 Str.93;
ret Str.343;
else
dec Str.341;
dec Str.342;
ret Str.91;
procedure Str.56 (#Derived_gen.5, #Derived_gen.6, #Derived_gen.7, #Derived_gen.8):
@ -228,8 +228,8 @@ procedure Str.58 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4
jump Str.278 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4;
procedure Str.61 (Str.152, Str.153):
let Str.308 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.308 then
let Str.309 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.309 then
ret Str.152;
else
ret Str.153;
@ -237,12 +237,12 @@ procedure Str.61 (Str.152, Str.153):
procedure Str.62 (Str.154, Str.155, Str.156):
let Str.157 : U64 = CallByName Str.36 Str.154;
let Str.158 : U64 = CallByName Str.36 Str.156;
let Str.306 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.306 Str.157;
let Str.305 : U64 = 0i64;
let Str.307 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.307 Str.157;
let Str.306 : U64 = 0i64;
inc Str.156;
inc Str.154;
let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.305, Str.158};
let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.306, Str.158};
let Str.286 : Int1 = CallByName Str.63 Str.287;
ret Str.286;
@ -257,24 +257,27 @@ procedure Str.63 (Str.160):
if Str.167 then
dec Str.163;
dec Str.161;
let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165;
let Str.168 : Int1 = CallByName Bool.9 Str.164 Str.165;
ret Str.168;
else
let Str.301 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.302 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.11 Str.301 Str.302;
let Str.291 : U64 = StructAtIndex 0 Str.160;
let Str.292 : Str = StructAtIndex 1 Str.160;
let Str.294 : Str = StructAtIndex 3 Str.160;
let Str.296 : U64 = StructAtIndex 5 Str.160;
let Str.302 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.303 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.9 Str.302 Str.303;
let Str.292 : U64 = StructAtIndex 0 Str.160;
let Str.293 : Str = StructAtIndex 1 Str.160;
let Str.295 : Str = StructAtIndex 3 Str.160;
let Str.297 : U64 = StructAtIndex 5 Str.160;
let Str.301 : U64 = 1i64;
let Str.299 : U64 = CallByName Num.51 Str.164 Str.301;
let Str.300 : U64 = 1i64;
let Str.298 : U64 = CallByName Num.51 Str.164 Str.300;
let Str.299 : U64 = 1i64;
let Str.297 : U64 = CallByName Num.51 Str.162 Str.299;
let Str.290 : {U64, Str, U64, Str, U64, U64} = Struct {Str.291, Str.292, Str.297, Str.294, Str.298, Str.296};
let Str.170 : Int1 = CallByName Str.63 Str.290;
let Str.289 : Int1 = CallByName Bool.3 Str.169 Str.170;
ret Str.289;
let Str.298 : U64 = CallByName Num.51 Str.162 Str.300;
let Str.291 : {U64, Str, U64, Str, U64, U64} = Struct {Str.292, Str.293, Str.298, Str.295, Str.299, Str.297};
let Str.170 : Int1 = CallByName Str.63 Str.291;
if Str.169 then
ret Str.170;
else
let Str.289 : Int1 = CallByName Bool.1;
ret Str.289;
procedure Test.0 ():
let Test.2 : Str = "abc";

View file

@ -15,18 +15,18 @@ procedure #Derived.3 (#Derived.4, #Derived.1):
dec #Derived_gen.7;
jump #Derived_gen.5 #Derived_gen.6;
procedure Bool.11 (#Attr.2, #Attr.3):
procedure Bool.1 ():
let Bool.21 : Int1 = false;
ret Bool.21;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.22 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.22;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.24 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.24;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.26 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.26;
procedure Bool.3 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel And #Attr.2 #Attr.3;
ret Bool.23;
procedure Inspect.201 (Inspect.202, #Attr.12):
let Inspect.335 : Str = UnionAtIndex (Id 0) (Index 0) #Attr.12;
let Inspect.334 : Str = CallByName Inspect.63 Inspect.202 Inspect.335;
@ -159,7 +159,7 @@ procedure Inspect.64 (Inspect.297):
procedure List.1 (List.119):
let List.688 : U64 = CallByName List.6 List.119;
let List.689 : U64 = 0i64;
let List.687 : Int1 = CallByName Bool.11 List.688 List.689;
let List.687 : Int1 = CallByName Bool.9 List.688 List.689;
ret List.687;
procedure List.101 (#Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14, #Derived_gen.15):
@ -223,16 +223,16 @@ procedure Num.77 (#Attr.2, #Attr.3):
ret Num.293;
procedure Str.20 (#Attr.2):
let Str.313 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.313;
let Str.314 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.314;
procedure Str.3 (#Attr.2, #Attr.3):
let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.246;
procedure Str.35 (#Attr.2, #Attr.3):
let Str.303 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.303;
let Str.304 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.304;
procedure Str.36 (#Attr.2):
let Str.266 : U64 = lowlevel StrCountUtf8Bytes #Attr.2;
@ -270,24 +270,24 @@ procedure Str.38 (Str.112, Str.113):
procedure Str.45 (Str.91, Str.92, Str.93):
inc Str.91;
let Str.341 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.349 : U8 = 1i64;
let Str.350 : U8 = GetTagId Str.341;
let Str.351 : Int1 = lowlevel Eq Str.349 Str.350;
if Str.351 then
let Str.348 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.341;
let Str.95 : Str = StructAtIndex 0 Str.348;
let Str.94 : Str = StructAtIndex 1 Str.348;
let Str.346 : U64 = CallByName Str.36 Str.91;
let Str.342 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.350 : U8 = 1i64;
let Str.351 : U8 = GetTagId Str.342;
let Str.352 : Int1 = lowlevel Eq Str.350 Str.351;
if Str.352 then
let Str.349 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.342;
let Str.95 : Str = StructAtIndex 0 Str.349;
let Str.94 : Str = StructAtIndex 1 Str.349;
let Str.347 : U64 = CallByName Str.36 Str.91;
dec Str.91;
let Str.345 : Str = CallByName Str.20 Str.346;
let Str.344 : Str = CallByName Str.3 Str.345 Str.94;
let Str.346 : Str = CallByName Str.20 Str.347;
let Str.345 : Str = CallByName Str.3 Str.346 Str.94;
dec Str.94;
let Str.343 : Str = CallByName Str.3 Str.344 Str.93;
let Str.342 : Str = CallByName Str.56 Str.343 Str.95 Str.92 Str.93;
ret Str.342;
let Str.344 : Str = CallByName Str.3 Str.345 Str.93;
let Str.343 : Str = CallByName Str.56 Str.344 Str.95 Str.92 Str.93;
ret Str.343;
else
dec Str.341;
dec Str.342;
ret Str.91;
procedure Str.56 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27):
@ -351,8 +351,8 @@ procedure Str.58 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_ge
jump Str.278 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21;
procedure Str.61 (Str.152, Str.153):
let Str.308 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.308 then
let Str.309 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.309 then
ret Str.152;
else
ret Str.153;
@ -360,12 +360,12 @@ procedure Str.61 (Str.152, Str.153):
procedure Str.62 (Str.154, Str.155, Str.156):
let Str.157 : U64 = CallByName Str.36 Str.154;
let Str.158 : U64 = CallByName Str.36 Str.156;
let Str.306 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.306 Str.157;
let Str.305 : U64 = 0i64;
let Str.307 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.307 Str.157;
let Str.306 : U64 = 0i64;
inc Str.156;
inc Str.154;
let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.305, Str.158};
let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.306, Str.158};
let Str.286 : Int1 = CallByName Str.63 Str.287;
ret Str.286;
@ -380,24 +380,27 @@ procedure Str.63 (Str.160):
if Str.167 then
dec Str.163;
dec Str.161;
let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165;
let Str.168 : Int1 = CallByName Bool.9 Str.164 Str.165;
ret Str.168;
else
let Str.301 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.302 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.11 Str.301 Str.302;
let Str.291 : U64 = StructAtIndex 0 Str.160;
let Str.292 : Str = StructAtIndex 1 Str.160;
let Str.294 : Str = StructAtIndex 3 Str.160;
let Str.296 : U64 = StructAtIndex 5 Str.160;
let Str.302 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.303 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.9 Str.302 Str.303;
let Str.292 : U64 = StructAtIndex 0 Str.160;
let Str.293 : Str = StructAtIndex 1 Str.160;
let Str.295 : Str = StructAtIndex 3 Str.160;
let Str.297 : U64 = StructAtIndex 5 Str.160;
let Str.301 : U64 = 1i64;
let Str.299 : U64 = CallByName Num.51 Str.164 Str.301;
let Str.300 : U64 = 1i64;
let Str.298 : U64 = CallByName Num.51 Str.164 Str.300;
let Str.299 : U64 = 1i64;
let Str.297 : U64 = CallByName Num.51 Str.162 Str.299;
let Str.290 : {U64, Str, U64, Str, U64, U64} = Struct {Str.291, Str.292, Str.297, Str.294, Str.298, Str.296};
let Str.170 : Int1 = CallByName Str.63 Str.290;
let Str.289 : Int1 = CallByName Bool.3 Str.169 Str.170;
ret Str.289;
let Str.298 : U64 = CallByName Num.51 Str.162 Str.300;
let Str.291 : {U64, Str, U64, Str, U64, U64} = Struct {Str.292, Str.293, Str.298, Str.295, Str.299, Str.297};
let Str.170 : Int1 = CallByName Str.63 Str.291;
if Str.169 then
ret Str.170;
else
let Str.289 : Int1 = CallByName Bool.1;
ret Str.289;
procedure Test.0 ():
let Test.4 : Str = "foo";

View file

@ -18,18 +18,18 @@ procedure #Derived.4 (#Derived.5, #Derived.1):
dec #Derived_gen.7;
jump #Derived_gen.5 #Derived_gen.6;
procedure Bool.11 (#Attr.2, #Attr.3):
procedure Bool.1 ():
let Bool.21 : Int1 = false;
ret Bool.21;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.22 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.22;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.24 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.24;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.26 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.26;
procedure Bool.3 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel And #Attr.2 #Attr.3;
ret Bool.23;
procedure Inspect.201 (Inspect.202, #Attr.12):
let Inspect.335 : Str = UnionAtIndex (Id 0) (Index 0) #Attr.12;
let Inspect.334 : Str = CallByName Inspect.63 Inspect.202 Inspect.335;
@ -162,7 +162,7 @@ procedure Inspect.64 (Inspect.297):
procedure List.1 (List.119):
let List.688 : U64 = CallByName List.6 List.119;
let List.689 : U64 = 0i64;
let List.687 : Int1 = CallByName Bool.11 List.688 List.689;
let List.687 : Int1 = CallByName Bool.9 List.688 List.689;
ret List.687;
procedure List.101 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30):
@ -226,16 +226,16 @@ procedure Num.77 (#Attr.2, #Attr.3):
ret Num.293;
procedure Str.20 (#Attr.2):
let Str.313 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.313;
let Str.314 : Str = lowlevel StrWithCapacity #Attr.2;
ret Str.314;
procedure Str.3 (#Attr.2, #Attr.3):
let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.246;
procedure Str.35 (#Attr.2, #Attr.3):
let Str.303 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.303;
let Str.304 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3;
ret Str.304;
procedure Str.36 (#Attr.2):
let Str.266 : U64 = lowlevel StrCountUtf8Bytes #Attr.2;
@ -273,24 +273,24 @@ procedure Str.38 (Str.112, Str.113):
procedure Str.45 (Str.91, Str.92, Str.93):
inc Str.91;
let Str.385 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.393 : U8 = 1i64;
let Str.394 : U8 = GetTagId Str.385;
let Str.395 : Int1 = lowlevel Eq Str.393 Str.394;
if Str.395 then
let Str.392 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.385;
let Str.95 : Str = StructAtIndex 0 Str.392;
let Str.94 : Str = StructAtIndex 1 Str.392;
let Str.390 : U64 = CallByName Str.36 Str.91;
let Str.386 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92;
let Str.394 : U8 = 1i64;
let Str.395 : U8 = GetTagId Str.386;
let Str.396 : Int1 = lowlevel Eq Str.394 Str.395;
if Str.396 then
let Str.393 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.386;
let Str.95 : Str = StructAtIndex 0 Str.393;
let Str.94 : Str = StructAtIndex 1 Str.393;
let Str.391 : U64 = CallByName Str.36 Str.91;
dec Str.91;
let Str.389 : Str = CallByName Str.20 Str.390;
let Str.388 : Str = CallByName Str.3 Str.389 Str.94;
let Str.390 : Str = CallByName Str.20 Str.391;
let Str.389 : Str = CallByName Str.3 Str.390 Str.94;
dec Str.94;
let Str.387 : Str = CallByName Str.3 Str.388 Str.93;
let Str.386 : Str = CallByName Str.56 Str.387 Str.95 Str.92 Str.93;
ret Str.386;
let Str.388 : Str = CallByName Str.3 Str.389 Str.93;
let Str.387 : Str = CallByName Str.56 Str.388 Str.95 Str.92 Str.93;
ret Str.387;
else
dec Str.385;
dec Str.386;
ret Str.91;
procedure Str.56 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23):
@ -354,8 +354,8 @@ procedure Str.58 (#Derived_gen.13, #Derived_gen.14, #Derived_gen.15, #Derived_ge
jump Str.278 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16;
procedure Str.61 (Str.152, Str.153):
let Str.308 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.308 then
let Str.309 : Int1 = CallByName Num.22 Str.152 Str.153;
if Str.309 then
ret Str.152;
else
ret Str.153;
@ -363,12 +363,12 @@ procedure Str.61 (Str.152, Str.153):
procedure Str.62 (Str.154, Str.155, Str.156):
let Str.157 : U64 = CallByName Str.36 Str.154;
let Str.158 : U64 = CallByName Str.36 Str.156;
let Str.306 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.306 Str.157;
let Str.305 : U64 = 0i64;
let Str.307 : U64 = CallByName Num.53 Str.155 Str.158;
let Str.159 : U64 = CallByName Str.61 Str.307 Str.157;
let Str.306 : U64 = 0i64;
inc Str.156;
inc Str.154;
let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.305, Str.158};
let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.306, Str.158};
let Str.286 : Int1 = CallByName Str.63 Str.287;
ret Str.286;
@ -383,24 +383,27 @@ procedure Str.63 (Str.160):
if Str.167 then
dec Str.163;
dec Str.161;
let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165;
let Str.168 : Int1 = CallByName Bool.9 Str.164 Str.165;
ret Str.168;
else
let Str.301 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.302 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.11 Str.301 Str.302;
let Str.291 : U64 = StructAtIndex 0 Str.160;
let Str.292 : Str = StructAtIndex 1 Str.160;
let Str.294 : Str = StructAtIndex 3 Str.160;
let Str.296 : U64 = StructAtIndex 5 Str.160;
let Str.302 : U8 = CallByName Str.35 Str.161 Str.162;
let Str.303 : U8 = CallByName Str.35 Str.163 Str.164;
let Str.169 : Int1 = CallByName Bool.9 Str.302 Str.303;
let Str.292 : U64 = StructAtIndex 0 Str.160;
let Str.293 : Str = StructAtIndex 1 Str.160;
let Str.295 : Str = StructAtIndex 3 Str.160;
let Str.297 : U64 = StructAtIndex 5 Str.160;
let Str.301 : U64 = 1i64;
let Str.299 : U64 = CallByName Num.51 Str.164 Str.301;
let Str.300 : U64 = 1i64;
let Str.298 : U64 = CallByName Num.51 Str.164 Str.300;
let Str.299 : U64 = 1i64;
let Str.297 : U64 = CallByName Num.51 Str.162 Str.299;
let Str.290 : {U64, Str, U64, Str, U64, U64} = Struct {Str.291, Str.292, Str.297, Str.294, Str.298, Str.296};
let Str.170 : Int1 = CallByName Str.63 Str.290;
let Str.289 : Int1 = CallByName Bool.3 Str.169 Str.170;
ret Str.289;
let Str.298 : U64 = CallByName Num.51 Str.162 Str.300;
let Str.291 : {U64, Str, U64, Str, U64, U64} = Struct {Str.292, Str.293, Str.298, Str.295, Str.299, Str.297};
let Str.170 : Int1 = CallByName Str.63 Str.291;
if Str.169 then
ret Str.170;
else
let Str.289 : Int1 = CallByName Bool.1;
ret Str.289;
procedure Test.0 ():
let Test.5 : Str = "foo";

View file

@ -1,10 +1,10 @@
procedure Bool.1 ():
let Bool.24 : Int1 = false;
ret Bool.24;
let Bool.22 : Int1 = false;
ret Bool.22;
procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Test.2 (Test.4):
let Test.11 : U8 = 1i64;

View file

@ -1,10 +1,10 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.24 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.24;
procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.22 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.22;
procedure List.2 (List.120, List.121):
let List.689 : U64 = CallByName List.6 List.120;
@ -57,7 +57,7 @@ procedure Str.66 (Str.191):
let Str.192 : {I64, U8} = CallByName Str.42 Str.191;
let Str.252 : U8 = StructAtIndex 1 Str.192;
let Str.253 : U8 = 0i64;
let Str.249 : Int1 = CallByName Bool.11 Str.252 Str.253;
let Str.249 : Int1 = CallByName Bool.9 Str.252 Str.253;
if Str.249 then
let Str.251 : I64 = StructAtIndex 0 Str.192;
let Str.250 : [C Int1, C I64] = TagId(1) Str.251;

View file

@ -1,6 +1,6 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.21 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.21;
procedure Test.2 (#Derived_gen.0):
joinpoint Test.13 Test.7:
@ -28,6 +28,6 @@ procedure Test.0 ():
let Test.12 : [<rnu><null>, C *self] = TagId(1) ;
let Test.10 : {} = CallByName Test.2 Test.12;
let Test.11 : {} = Struct {};
let Test.8 : Int1 = CallByName Bool.11 Test.10 Test.11;
let Test.8 : Int1 = CallByName Bool.9 Test.10 Test.11;
let Test.9 : Str = "";
ret Test.9;

View file

@ -1,45 +1,48 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.24 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.24;
procedure Bool.2 ():
let Bool.22 : Int1 = true;
ret Bool.22;
procedure Bool.4 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Or #Attr.2 #Attr.3;
ret Bool.23;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.21 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.21;
procedure Test.1 (Test.2, Test.3):
let Test.17 : {Int1, Int1} = Struct {Test.2, Test.3};
let Test.32 : Int1 = StructAtIndex 0 Test.17;
let Test.31 : Int1 = StructAtIndex 1 Test.17;
let Test.19 : Int1 = CallByName Test.1 Test.31 Test.32;
let Test.26 : {} = Struct {};
joinpoint Test.27 Test.21:
let Test.23 : {} = Struct {};
joinpoint Test.24 Test.22:
let Test.20 : Int1 = CallByName Bool.11 Test.21 Test.22;
dec Test.21;
dec Test.22;
let Test.18 : Int1 = CallByName Bool.4 Test.19 Test.20;
ret Test.18;
let Test.27 : Int1 = CallByName Test.1 Test.31 Test.32;
if Test.27 then
let Test.28 : Int1 = CallByName Bool.2;
ret Test.28;
else
let Test.24 : {} = Struct {};
joinpoint Test.25 Test.19:
let Test.21 : {} = Struct {};
joinpoint Test.22 Test.20:
let Test.18 : Int1 = CallByName Bool.9 Test.19 Test.20;
dec Test.20;
dec Test.19;
ret Test.18;
in
switch Test.31:
case 0:
let Test.23 : Str = CallByName Test.9 Test.21;
jump Test.22 Test.23;
default:
let Test.23 : Str = CallByName Test.11 Test.21;
jump Test.22 Test.23;
in
switch Test.31:
switch Test.32:
case 0:
let Test.25 : Str = CallByName Test.9 Test.23;
jump Test.24 Test.25;
let Test.26 : Str = CallByName Test.9 Test.24;
jump Test.25 Test.26;
default:
let Test.25 : Str = CallByName Test.11 Test.23;
jump Test.24 Test.25;
let Test.26 : Str = CallByName Test.11 Test.24;
jump Test.25 Test.26;
in
switch Test.32:
case 0:
let Test.28 : Str = CallByName Test.9 Test.26;
jump Test.27 Test.28;
default:
let Test.28 : Str = CallByName Test.11 Test.26;
jump Test.27 Test.28;
procedure Test.11 (Test.34):
let Test.35 : Str = "a";

View file

@ -1,6 +1,6 @@
procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Test.0 (Test.4):
let Test.7 : Int1 = CallByName Bool.2;

View file

@ -1,17 +1,17 @@
procedure Bool.12 (#Attr.2, #Attr.3):
let Bool.24 : Int1 = lowlevel NotEq #Attr.2 #Attr.3;
ret Bool.24;
procedure Bool.10 (#Attr.2, #Attr.3):
let Bool.22 : Int1 = lowlevel NotEq #Attr.2 #Attr.3;
ret Bool.22;
procedure Bool.7 (Bool.19, Bool.20):
let Bool.23 : Int1 = CallByName Bool.12 Bool.19 Bool.20;
ret Bool.23;
procedure Bool.5 (Bool.17, Bool.18):
let Bool.21 : Int1 = CallByName Bool.10 Bool.17 Bool.18;
ret Bool.21;
procedure Test.6 ():
let Test.10 : Int1 = false;
let Test.0 : [C Int1, C Int1, C Int1] = TagId(2) Test.10;
let Test.9 : Int1 = false;
let Test.1 : [C Int1, C Int1, C Int1] = TagId(0) Test.9;
let Test.8 : Int1 = CallByName Bool.7 Test.0 Test.1;
let Test.8 : Int1 = CallByName Bool.5 Test.0 Test.1;
expect Test.8;
let Test.7 : {} = Struct {};
ret Test.7;

View file

@ -1,10 +1,10 @@
procedure Bool.1 ():
let Bool.25 : Int1 = false;
ret Bool.25;
let Bool.23 : Int1 = false;
ret Bool.23;
procedure Bool.2 ():
let Bool.24 : Int1 = true;
ret Bool.24;
let Bool.22 : Int1 = true;
ret Bool.22;
procedure List.106 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4, #Derived_gen.5, #Derived_gen.6):
joinpoint List.713 List.291 List.292 List.293 List.294 List.295 List.296:

View file

@ -1,10 +1,10 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.21 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.21;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.24 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.24;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.22 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.22;
procedure Decode.24 (Decode.105):
ret Decode.105;
@ -34,7 +34,7 @@ procedure Str.66 (Str.191):
let Str.192 : {I64, U8} = CallByName Str.42 Str.191;
let Str.252 : U8 = StructAtIndex 1 Str.192;
let Str.253 : U8 = 0i64;
let Str.249 : Int1 = CallByName Bool.11 Str.252 Str.253;
let Str.249 : Int1 = CallByName Bool.9 Str.252 Str.253;
if Str.249 then
let Str.251 : I64 = StructAtIndex 0 Str.192;
let Str.250 : [C {}, C I64] = TagId(1) Str.251;
@ -50,7 +50,7 @@ procedure Test.103 ():
let Test.116 : I64 = -1234i64;
let Test.114 : {List U8, I64} = Struct {Test.115, Test.116};
let Test.113 : [C Str, C {List U8, I64}] = TagId(1) Test.114;
let Test.112 : Int1 = CallByName Bool.11 Test.101 Test.113;
let Test.112 : Int1 = CallByName Bool.9 Test.101 Test.113;
dec Test.114;
expect Test.112;
dec Test.101;

View file

@ -1,6 +1,6 @@
procedure Bool.1 ():
let Bool.23 : Int1 = false;
ret Bool.23;
let Bool.21 : Int1 = false;
ret Bool.21;
procedure Test.2 (Test.11, Test.1):
if Test.1 then

View file

@ -1,6 +1,6 @@
procedure Bool.1 ():
let Bool.24 : Int1 = false;
ret Bool.24;
let Bool.22 : Int1 = false;
ret Bool.22;
procedure Test.1 (Test.4):
let Test.9 : I64 = 0i64;

View file

@ -1,6 +1,6 @@
procedure Bool.1 ():
let Bool.24 : Int1 = false;
ret Bool.24;
let Bool.22 : Int1 = false;
ret Bool.22;
procedure Test.1 (Test.4):
let Test.9 : I64 = 0i64;

View file

@ -1,10 +1,10 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23;
procedure Bool.2 ():
let Bool.24 : Int1 = true;
ret Bool.24;
let Bool.22 : Int1 = true;
ret Bool.22;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.21 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.21;
procedure Num.19 (#Attr.2, #Attr.3):
let Num.283 : U64 = lowlevel NumAdd #Attr.2 #Attr.3;
@ -40,7 +40,7 @@ procedure Test.7 ():
let Test.14 : Int1 = CallByName Test.0 Test.15;
let Test.11 : U64 = CallByName Test.5 Test.13 Test.14;
let Test.12 : U64 = 9i64;
let Test.10 : Int1 = CallByName Bool.11 Test.11 Test.12;
let Test.10 : Int1 = CallByName Bool.9 Test.11 Test.12;
expect Test.10;
let Test.9 : {} = Struct {};
ret Test.9;

View file

@ -1,6 +1,6 @@
procedure Bool.1 ():
let Bool.24 : Int1 = false;
ret Bool.24;
let Bool.22 : Int1 = false;
ret Bool.22;
procedure Test.4 (Test.6):
let Test.8 : U64 = 1i64;

View file

@ -1,6 +1,6 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.21 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.21;
procedure Test.2 (Test.5):
let Test.14 : U8 = GetTagId Test.5;
@ -23,7 +23,7 @@ procedure Test.0 ():
let Test.10 : [<rnw><null>, C Str, C *self] = TagId(0) ;
let Test.8 : Str = CallByName Test.2 Test.10;
let Test.9 : Str = "c";
let Test.7 : Int1 = CallByName Bool.11 Test.8 Test.9;
let Test.7 : Int1 = CallByName Bool.9 Test.8 Test.9;
dec Test.8;
dec Test.9;
ret Test.7;

View file

@ -1,10 +1,10 @@
procedure Bool.1 ():
let Bool.24 : Int1 = false;
ret Bool.24;
let Bool.22 : Int1 = false;
ret Bool.22;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.21 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.21;
procedure Test.1 ():
let Test.9 : I64 = 42i64;
@ -23,7 +23,7 @@ procedure Test.0 ():
if Test.17 then
let Test.13 : {I64, Str} = StructAtIndex 0 Test.5;
let Test.7 : {I64, Str} = CallByName Test.1;
let Test.6 : Int1 = CallByName Bool.11 Test.7 Test.13;
let Test.6 : Int1 = CallByName Bool.9 Test.7 Test.13;
dec Test.13;
dec Test.7;
ret Test.6;

View file

@ -1,9 +1,9 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.21 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.21;
procedure Test.0 ():
let Test.3 : Str = "foo";
let Test.4 : Int1 = CallByName Bool.11 Test.3 Test.3;
let Test.4 : Int1 = CallByName Bool.9 Test.3 Test.3;
dec Test.3;
ret Test.4;

View file

@ -1,10 +1,10 @@
procedure Bool.1 ():
let Bool.24 : Int1 = false;
ret Bool.24;
let Bool.22 : Int1 = false;
ret Bool.22;
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.21 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.21;
procedure Test.1 ():
let Test.8 : I64 = 42i64;
@ -19,7 +19,7 @@ procedure Test.0 ():
let Test.13 : Int1 = lowlevel Eq Test.12 Test.11;
if Test.13 then
let Test.6 : {I64, Str} = CallByName Test.1;
let Test.5 : Int1 = CallByName Bool.11 Test.6 Test.4;
let Test.5 : Int1 = CallByName Bool.9 Test.6 Test.4;
dec Test.6;
let #Derived_gen.0 : Str = StructAtIndex 1 Test.4;
dec #Derived_gen.0;

View file

@ -1,6 +1,6 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.21 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.21;
procedure Str.3 (#Attr.2, #Attr.3):
let Str.247 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
@ -29,7 +29,7 @@ procedure Test.0 ():
let Test.14 : [<r>C List *self, C Str] = CallByName Test.3;
let Test.16 : Str = "";
let Test.15 : [<r>C List *self, C Str] = TagId(1) Test.16;
let Test.13 : Int1 = CallByName Bool.11 Test.14 Test.15;
let Test.13 : Int1 = CallByName Bool.9 Test.14 Test.15;
joinpoint #Derived_gen.0:
dec Test.14;
ret Test.13;

View file

@ -1,6 +1,6 @@
procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Num.19 (#Attr.2, #Attr.3):
let Num.283 : U32 = lowlevel NumAdd #Attr.2 #Attr.3;

View file

@ -1,6 +1,6 @@
procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Test.10 (Test.26):
let Test.30 : Int1 = CallByName Bool.2;

View file

@ -1,6 +1,6 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.21 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.21;
procedure Num.20 (#Attr.2, #Attr.3):
let Num.284 : U8 = lowlevel NumSub #Attr.2 #Attr.3;
@ -13,7 +13,7 @@ procedure Num.21 (#Attr.2, #Attr.3):
procedure Test.1 (#Derived_gen.0, #Derived_gen.1):
joinpoint Test.11 Test.2 Test.3:
let Test.26 : U8 = 0i64;
let Test.22 : Int1 = CallByName Bool.11 Test.2 Test.26;
let Test.22 : Int1 = CallByName Bool.9 Test.2 Test.26;
if Test.22 then
let Test.24 : U8 = 1i64;
let Test.25 : U8 = GetTagId Test.3;

View file

@ -1,6 +1,6 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.21 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.21;
procedure Str.26 (Str.83):
let Str.246 : [C {}, C U64] = CallByName Str.66 Str.83;
@ -14,7 +14,7 @@ procedure Str.66 (Str.191):
let Str.192 : {U64, U8} = CallByName Str.42 Str.191;
let Str.252 : U8 = StructAtIndex 1 Str.192;
let Str.253 : U8 = 0i64;
let Str.249 : Int1 = CallByName Bool.11 Str.252 Str.253;
let Str.249 : Int1 = CallByName Bool.9 Str.252 Str.253;
if Str.249 then
let Str.251 : U64 = StructAtIndex 0 Str.192;
let Str.250 : [C {}, C U64] = TagId(1) Str.251;

View file

@ -1,6 +1,6 @@
procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Test.0 ():
let Test.2 : Int1 = CallByName Bool.2;

View file

@ -1,6 +1,6 @@
procedure Bool.2 ():
let Bool.24 : Int1 = true;
ret Bool.24;
let Bool.22 : Int1 = true;
ret Bool.22;
procedure Num.19 (#Attr.2, #Attr.3):
let Num.284 : I64 = lowlevel NumAdd #Attr.2 #Attr.3;

View file

@ -1,6 +1,6 @@
procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Num.19 (#Attr.2, #Attr.3):
let Num.284 : I64 = lowlevel NumAdd #Attr.2 #Attr.3;

View file

@ -1,6 +1,6 @@
procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Test.0 ():
let Test.6 : Int1 = CallByName Bool.2;

View file

@ -1,6 +1,6 @@
procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Encode.23 (Encode.100):
ret Encode.100;

View file

@ -1,6 +1,6 @@
procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Test.12 (Test.52):
let Test.72 : Int1 = false;

View file

@ -31,8 +31,8 @@ procedure #Derived.7 (#Derived.8, #Derived.9, #Attr.12):
jump #Derived_gen.5 #Derived_gen.6;
procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Encode.23 (Encode.100):
ret Encode.100;

View file

@ -1,6 +1,6 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23;
procedure Bool.9 (#Attr.2, #Attr.3):
let Bool.21 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.21;
procedure List.116 (List.563, List.564, List.565):
let List.693 : U64 = 0i64;
@ -99,7 +99,7 @@ procedure Test.0 (Test.1):
let Test.11 : {} = Struct {};
let Test.2 : U64 = CallByName List.26 Test.1 Test.10 Test.11;
let Test.9 : U64 = 0i64;
let Test.7 : Int1 = CallByName Bool.11 Test.2 Test.9;
let Test.7 : Int1 = CallByName Bool.9 Test.2 Test.9;
if Test.7 then
ret Test.1;
else

View file

@ -1,6 +1,6 @@
procedure Bool.2 ():
let Bool.25 : Int1 = true;
ret Bool.25;
let Bool.23 : Int1 = true;
ret Bool.23;
procedure Num.19 (#Attr.2, #Attr.3):
let Num.283 : U8 = lowlevel NumAdd #Attr.2 #Attr.3;

View file

@ -2460,7 +2460,7 @@ fn issue_4557() {
app "test" provides [main] to "./platform"
is_eq_q = \q1, q2 -> when T q1 q2 is
T (U f1) (U f2) -> Bool.or (is_eq_q (U f2) (U f1)) (f1 {} == f2 {})
T (U f1) (U f2) -> (is_eq_q (U f2) (U f1)) or (f1 {} == f2 {})
main = is_eq_q (U \{} -> "a") (U \{} -> "a")
"#

View file

@ -7,6 +7,8 @@
"expect"
"dbg"
"implements"
"and"
"or"
"app"
"platform"

View file

@ -1,3 +1,3 @@
when x is
Foo.and -> 1
Foo.val -> 1
_ -> 4

View file

@ -9,7 +9,7 @@
patterns: [
@14-21 SpaceBefore(
Malformed(
"Foo.and",
"Foo.val",
),
[
Newline,

View file

@ -1,3 +1,3 @@
when x is
Foo.and -> 1
Foo.val -> 1
_ -> 4

View file

@ -0,0 +1,20 @@
expect
html : Html {}
html =
Element "a" 43 [HtmlAttr "href" "https://www.roc-lang.org/"] [Text "Roc"]
actual : { nodes : List RenderedNode, siblingIds : List U64 }
actual =
indexNodes { nodes: [], siblingIds: [] } html
expected : { nodes : List RenderedNode, siblingIds : List U64 }
expected = {
nodes: [
RenderedText "Roc",
RenderedElement "a" { emptyRenderedAttrs & htmlAttrs: Dict.fromList [("href", "https://www.roc-lang.org/")] } [0],
],
siblingIds: [1],
}
(actual.nodes == expected.nodes)
and (actual.siblingIds == expected.siblingIds)

View file

@ -1,4 +1,4 @@
my_var =
some_var # c
|| other_thing # ^D
or other_thing # ^D
final_expr

View file

@ -5022,8 +5022,8 @@ mod test_fmt {
r#"
if
(1 == 1)
&& (2 == 1)
&& (3 == 2)
and (2 == 1)
and (3 == 2)
then
"true"
else
@ -5317,18 +5317,63 @@ mod test_fmt {
}
#[test]
fn multi_line_binary_op_1() {
fn multi_line_binary_op_and() {
expr_formats_to(
indoc!(
r"
is_last
&& is_empty
&& is_loaded
"
),
indoc!(
r"
is_last
and is_empty
and is_loaded
"
),
);
expr_formats_same(indoc!(
r"
isLast
&& isEmpty
&& isLoaded
is_last
and is_empty
and is_loaded
"
));
}
#[test]
fn multi_line_binary_op_2() {
fn multi_line_binary_op_or() {
expr_formats_to(
indoc!(
r"
is_last
|| is_empty
|| is_loaded
"
),
indoc!(
r"
is_last
or is_empty
or is_loaded
"
),
);
expr_formats_same(indoc!(
r"
is_last
or is_empty
or is_loaded
"
));
}
#[test]
fn multi_line_binary_op_symbol() {
expr_formats_to(
indoc!(
r"
@ -5398,15 +5443,15 @@ mod test_fmt {
expr_formats_to(
indoc!(
r"
isGreenLight
&& isRedLight && isYellowLight
is_green_light
&& is_red_light && is_yellow_light
"
),
indoc!(
r"
isGreenLight
&& isRedLight
&& isYellowLight
is_green_light
and is_red_light
and is_yellow_light
"
),
);

View file

@ -1,4 +1,4 @@
app "test" provides [main] to "./platform"
main = Bool.is_eq Bool.true Bool.false
# ^^^^^^^^^^ Eq#Bool.is_eq(9): Bool, Bool -[[Bool.structural_eq(11)]]-> Bool
# ^^^^^^^^^^ Eq#Bool.is_eq(7): Bool, Bool -[[Bool.structural_eq(9)]]-> Bool

View file

@ -2,11 +2,11 @@ app "test" provides [main] to "./platform"
main =
s1 : Set U8
s1 = Set.empty {}
s1 = Set.empty({})
s2 : Set Str
s2 = Set.empty {}
s2 = Set.empty({})
Bool.is_eq s1 s1 && Bool.is_eq s2 s2
# ^^^^^^^^^^ Set#Bool.is_eq(31): Set Str, Set Str -[[Set.is_eq(31)]]-> Bool
Bool.is_eq(s1, s1) and Bool.is_eq(s2, s2)
# ^^^^^^^^^^ Set#Bool.is_eq(31): Set Str, Set Str -[[Set.is_eq(31)]]-> Bool
# ^^^^^^^^^^ Set#Bool.is_eq(31): Set U8, Set U8 -[[Set.is_eq(31)]]-> Bool

View file

@ -14,8 +14,8 @@ main = (f "") {}
# -emit:mono
procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
let Bool.21 : Int1 = true;
ret Bool.21;
procedure Test.1 (Test.2):
let Test.34 : Int1 = CallByName Bool.2;

View file

@ -1797,7 +1797,7 @@ generate_derive_str = \buf, types, type, include_debug ->
can_support_eq_hash_ord : Types, Shape -> Bool
can_support_eq_hash_ord = \types, type ->
!(has_float(types, type)) && (can_support_partial_eq_ord(types, type))
!(has_float(types, type)) and (can_support_partial_eq_ord(types, type))
can_support_partial_eq_ord : Types, Shape -> Bool
can_support_partial_eq_ord = \types, type ->
@ -1817,7 +1817,7 @@ can_support_partial_eq_ord = \types, type ->
k_type = Types.shape(types, k)
v_type = Types.shape(types, v)
can_support_partial_eq_ord(types, k_type) && can_support_partial_eq_ord(types, v_type)
can_support_partial_eq_ord(types, k_type) and can_support_partial_eq_ord(types, v_type)
TagUnion(Recursive({ tags })) ->
List.all(tags, \{ payload } ->
@ -1854,7 +1854,7 @@ can_support_partial_eq_ord = \types, type ->
ok_shape = Types.shape(types, ok_id)
err_shape = Types.shape(types, err_id)
can_support_partial_eq_ord(types, ok_shape) && can_support_partial_eq_ord(types, err_shape)
can_support_partial_eq_ord(types, ok_shape) and can_support_partial_eq_ord(types, err_shape)
Struct({ fields: HasNoClosure(fields) }) | TagUnionPayload({ fields: HasNoClosure(fields) }) ->
List.all(fields, \{ id } -> can_support_partial_eq_ord(types, Types.shape(types, id)))
@ -1891,7 +1891,7 @@ can_derive_copy = \types, type ->
RocResult(ok_id, err_id) ->
can_derive_copy(types, Types.shape(types, ok_id))
&& can_derive_copy(types, Types.shape(types, err_id))
and can_derive_copy(types, Types.shape(types, err_id))
Struct({ fields: HasNoClosure(fields) }) | TagUnionPayload({ fields: HasNoClosure(fields) }) ->
List.all(fields, \{ id } -> can_derive_copy(types, Types.shape(types, id)))
@ -1909,7 +1909,7 @@ cannot_support_default = \types, type ->
TagUnionPayload({ fields: HasClosure(_) }) -> Bool.true
RocDict(key_id, val_id) ->
cannot_support_copy(types, Types.shape(types, key_id))
|| cannot_support_copy(types, Types.shape(types, val_id))
or cannot_support_copy(types, Types.shape(types, val_id))
Struct({ fields: HasClosure(_) }) -> Bool.true
Struct({ fields: HasNoClosure(fields) }) | TagUnionPayload({ fields: HasNoClosure(fields) }) ->
@ -1934,7 +1934,7 @@ has_float_help = \types, type, do_not_recurse ->
RocDict(id0, id1) | RocResult(id0, id1) ->
has_float_help(types, Types.shape(types, id0), do_not_recurse)
|| has_float_help(types, Types.shape(types, id1), do_not_recurse)
or has_float_help(types, Types.shape(types, id1), do_not_recurse)
Struct({ fields: HasNoClosure(fields) }) | TagUnionPayload({ fields: HasNoClosure(fields) }) ->
List.any(fields, \{ id } -> has_float_help(types, Types.shape(types, id), do_not_recurse))
@ -2160,7 +2160,7 @@ contains_refcounted_help = \types, type, do_not_recurse ->
RocResult(id0, id1) ->
contains_refcounted_help(types, Types.shape(types, id0), do_not_recurse)
|| contains_refcounted_help(types, Types.shape(types, id1), do_not_recurse)
or contains_refcounted_help(types, Types.shape(types, id1), do_not_recurse)
Struct({ fields: HasNoClosure(fields) }) | TagUnionPayload({ fields: HasNoClosure(fields) }) ->
List.any(fields, \{ id } -> contains_refcounted_help(types, Types.shape(types, id), do_not_recurse))

View file

@ -247,8 +247,6 @@ fn to_expr_report<'a>(
let suggestion = match *op {
"|" => vec![
alloc.reflow("Maybe you want "),
alloc.parser_suggestion("||"),
alloc.reflow(" or "),
alloc.parser_suggestion("|>"),
alloc.reflow(" instead?"),
],

View file

@ -73,7 +73,7 @@ tokens_to_str : List Token -> Str
tokens_to_str = \tokens ->
List.walk(tokens, "", \buf, token ->
buf_with_space =
if Str.is_empty(buf) || token == Literal(",") then
if Str.is_empty(buf) or token == Literal(",") then
buf
else
Str.concat(buf, " ")

View file

@ -242,14 +242,14 @@ fromU8 = \r, g, b, a -> @Color (RgbaU8 r g b a)
fromI16 : I16, I16, I16, I16 -> Result Color [OutOfRange]
fromI16 = \r, g, b, a ->
if r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255 || a < 0 || a > 255 then
if r < 0 or r > 255 or g < 0 or g > 255 or b < 0 or b > 255 or a < 0 or a > 255 then
Err OutOfRange
else
Ok (@Color (RgbaU8 (Num.toU8 r) (Num.toU8 g) (Num.toU8 b) (Num.toU8 a)))
fromF32 : F32, F32, F32, F32 -> Result Color [OutOfRange]
fromF32 = \r, g, b, a ->
if r < 0.0 || r > 1.0 || g < 0.0 || g > 1.0 || b < 0.0 || b > 1.0 || a < 0.0 || a > 1.0 then
if r < 0.0 or r > 1.0 or g < 0.0 or g > 1.0 or b < 0.0 or b > 1.0 or a < 0.0 or a > 1.0 then
Err OutOfRange
else
Ok (@Color (RgbaF32 r g b a))

View file

@ -359,8 +359,8 @@ As a historical note, these stylistic benefits (of `|> Num.sub 1` working as exp
### [Currying and learning curve](#curried-learning-curve) {#curried-learning-curve}
Currying leads to function signatures that look surprising to beginners. For example, in Roc, the
[`Bool.and`](https://www.roc-lang.org/builtins/Bool#and) function has the type `Bool, Bool -> Bool`. If Roc were a
curried language, this function would instead have the type `Bool -> Bool -> Bool`. Since no mainstream programming
[`Str.concat`](https://www.roc-lang.org/builtins/Str#concat) function has the type `Str, Str -> Str`. If Roc were a
curried language, this function would instead have the type `Str -> Str -> Str`. Since no mainstream programming
languages today are curried, anyone who knows a mainstream language and is learning their first curried language will
require additional explanation about why function types look this way.

View file

@ -640,7 +640,7 @@ We refer to whatever comes before a `->` in a `when` expression as a _pattern_
In many programming languages, `true` and `false` are special language keywords that refer to the two [boolean](https://en.wikipedia.org/wiki/Boolean_data_type) values. In Roc, booleans do not get special keywords; instead, they are exposed as the ordinary values `Bool.true` and `Bool.false`.
This design is partly to keep the number of special keywords in the language smaller, but mainly to suggest how booleans are intended to be used in Roc: for [_boolean logic_](https://en.wikipedia.org/wiki/Boolean_algebra) (`&&`, `||`, and so on) as opposed to for data modeling. Tags are the preferred choice for data modeling, and having tag values be more concise than boolean values helps make this preference clear.
This design is partly to keep the number of special keywords in the language smaller, but mainly to suggest how booleans are intended to be used in Roc: for [_boolean logic_](https://en.wikipedia.org/wiki/Boolean_algebra) (`and`, `or`, and so on) as opposed to for data modeling. Tags are the preferred choice for data modeling, and having tag values be more concise than boolean values helps make this preference clear.
As an example of why tags are encouraged for data modeling, in many languages it would be common to write a record like `{ name: "Richard", isAdmin: Bool.true }`, but in Roc it would be preferable to write something like `{ name: "Richard", role: Admin }`. At first, the `role` field might only ever be set to `Admin` or `Normal`, but because the data has been modeled using tags instead of booleans, it's much easier to add other alternatives in the future, like `Guest` or `Moderator` - some of which might also want payloads.
@ -2369,22 +2369,21 @@ Here are various Roc expressions involving operators, and what they desugar to.
| Expression | Desugars To |
| ---------------------------- | ---------------------------------------------------------------------------- |
| `a + b` | `Num.add a b` |
| `a - b` | `Num.sub a b` |
| `a * b` | `Num.mul a b` |
| `a / b` | `Num.div a b` |
| `a // b` | `Num.divTrunc a b` |
| `a ^ b` | `Num.pow a b` |
| `a % b` | `Num.rem a b` |
| `-a` | `Num.neg a` |
| `a == b` | `Bool.isEq a b` |
| `a != b` | `Bool.isNotEq a b` |
| `a && b` | `Bool.and a b` |
| <code>a \|\| b</code> | `Bool.or a b` |
| `!a` | `Bool.not a` |
| <code>a \|> f</code> | `f a` |
| <code>f a b \|> g x y</code> | `g (f a b) x y` |
| `f!` | [see example](https://www.roc-lang.org/examples/DesugaringAwait/README.html) |
| `a + b` | `Num.add(a, b)` |
| `a - b` | `Num.sub(a, b)` |
| `a * b` | `Num.mul(a, b)` |
| `a / b` | `Num.div(a, b)` |
| `a // b` | `Num.div_trunc(a, b)` |
| `a ^ b` | `Num.pow(a, b)` |
| `a % b` | `Num.rem(a, b)` |
| `-a` | `Num.neg(a)` |
| `a == b` | `Bool.is_eq(a, b)` |
| `a != b` | `Bool.is_not_eq(a, b)` |
| `a and b` | `if a then b else Bool.false` |
| `a or b` | `if a then Bool.true else b` |
| `!a` | `Bool.not(a)` |
| <code>a \|> f</code> | `f(a)` |
| <code>f a b \|> g x y</code> | `g(f(a, b), x, y)` |
| `f?` | [see example](https://www.roc-lang.org/examples/DesugaringTry/README.html) |
### [Additional Resources](#additional-resources) {#additional-resources}

View file

@ -111,7 +111,7 @@ view = \page_path_str, html_content ->
"/index.html" -> [id("homepage-main")]
"/tutorial.html" -> [id("tutorial-main"), class("article-layout")]
_ ->
if Str.starts_with(page_path_str, "/examples/") && page_path_str != "/examples/index.html" then
if Str.starts_with(page_path_str, "/examples/") and page_path_str != "/examples/index.html" then
# Individual examples should render wider than articles.
# Otherwise the width is unreasonably low for the code blocks,
# and those pages don't tend to have big paragraphs anyway.