merge main

This commit is contained in:
Bryce Miller 2023-06-10 15:04:25 -04:00
commit 0132df9b5a
No known key found for this signature in database
GPG key ID: F1E97BF8DF152350
38 changed files with 6287 additions and 5728 deletions

View file

@ -1,41 +1,6 @@
## JSON is a data format that is easy for humans to read and write. It is
## commonly used to exchange data between two systems such as a server and a
## client (e.g. web browser).
##
## This module implements functionality to serialize and de-serialize Roc types
## to and from JSON data. Using the `Encode` and `Decode` builtins this process
## can be achieved without the need to write custom encoder and decoder functions
## to parse UTF-8 strings.
##
## Here is a basic example which shows how to parse a JSON record into a Roc
## type named `Language` which includes a `name` field. The JSON string is
## decoded and then the field is encoded back into a UTF-8 string.
##
## ```
## Language : {
## name : Str,
## }
##
## jsonStr = Str.toUtf8 "{\"name\":\"Röc Lang\"}"
##
## result : Result Language _
## result =
## jsonStr
## |> Decode.fromBytes Json.json # returns `Ok {name : "Röc Lang"}`
##
## name =
## decodedValue <- Result.map result
##
## Encode.toBytes decodedValue.name Json.json
##
## expect name == Ok (Str.toUtf8 "\"Röc Lang\"")
## ```
##
## **Note:** This module is likely to be moved out of the builtins in future.
## It is currently located here to facilitate development of the Abilities
## language feature and testing. You are welcome to use this module, just note
## that it will be moved into a package in a future update.
interface Json
## THIS MODULE IS DEPRECATED AND CURRENTLY IN THE PROCESS OF BEING REMOVED
## FROM STD LIBRARY
interface TotallyNotJson
exposes [
Json,
json,

View file

@ -1,3 +1,3 @@
package "builtins"
exposes [Str, Num, Bool, Result, List, Dict, Set, Decode, Encode, Hash, Set, Box, Json]
exposes [Str, Num, Bool, Result, List, Dict, Set, Decode, Encode, Hash, Set, Box, TotallyNotJson]
packages {}

View file

@ -34,4 +34,4 @@ const BOOL: &str = include_str!("../roc/Bool.roc");
const ENCODE: &str = include_str!("../roc/Encode.roc");
const DECODE: &str = include_str!("../roc/Decode.roc");
const HASH: &str = include_str!("../roc/Hash.roc");
const JSON: &str = include_str!("../roc/Json.roc");
const JSON: &str = include_str!("../roc/TotallyNotJson.roc");

View file

@ -458,11 +458,6 @@ impl CallConv<AArch64GeneralReg, AArch64FloatReg, AArch64Assembler> for AArch64C
}
impl Assembler<AArch64GeneralReg, AArch64FloatReg> for AArch64Assembler {
#[inline(always)]
fn base_pointer() -> AArch64GeneralReg {
AArch64GeneralReg::FP
}
#[inline(always)]
fn abs_reg64_reg64(buf: &mut Vec<'_, u8>, dst: AArch64GeneralReg, src: AArch64GeneralReg) {
cmp_reg64_imm12(buf, src, 0);
@ -668,12 +663,17 @@ impl Assembler<AArch64GeneralReg, AArch64FloatReg> for AArch64Assembler {
}
#[inline(always)]
fn jne_reg64_imm64_imm32(
buf: &mut Vec<'_, u8>,
fn jne_reg64_imm64_imm32<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
_storage_manager: &mut StorageManager<'a, '_, AArch64GeneralReg, AArch64FloatReg, ASM, CC>,
reg: AArch64GeneralReg,
imm: u64,
offset: i32,
) -> usize {
) -> usize
where
ASM: Assembler<AArch64GeneralReg, AArch64FloatReg>,
CC: CallConv<AArch64GeneralReg, AArch64FloatReg, ASM>,
{
if imm < (1 << 12) {
cmp_reg64_imm12(buf, reg, imm as u16);
} else {
@ -790,6 +790,16 @@ impl Assembler<AArch64GeneralReg, AArch64FloatReg> for AArch64Assembler {
todo!("move with sign extension");
}
#[inline(always)]
fn movzx_reg_reg(
_buf: &mut Vec<'_, u8>,
_input_width: RegisterWidth,
_dst: AArch64GeneralReg,
_src: AArch64GeneralReg,
) {
todo!("move with zero extension");
}
#[inline(always)]
fn mov_freg64_base32(_buf: &mut Vec<'_, u8>, _dst: AArch64FloatReg, _offset: i32) {
todo!("loading floating point reg from base offset for AArch64");
@ -1081,6 +1091,28 @@ impl Assembler<AArch64GeneralReg, AArch64FloatReg> for AArch64Assembler {
cset_reg64_cond(buf, dst, ConditionCode::NE);
}
fn eq_freg_freg_reg64(
buf: &mut Vec<'_, u8>,
dst: AArch64GeneralReg,
src1: AArch64FloatReg,
src2: AArch64FloatReg,
width: FloatWidth,
) {
fcmp_freg_freg(buf, width, src1, src2);
cset_reg64_cond(buf, dst, ConditionCode::EQ);
}
fn neq_freg_freg_reg64(
buf: &mut Vec<'_, u8>,
dst: AArch64GeneralReg,
src1: AArch64FloatReg,
src2: AArch64FloatReg,
width: FloatWidth,
) {
fcmp_freg_freg(buf, width, src1, src2);
cset_reg64_cond(buf, dst, ConditionCode::NE);
}
#[inline(always)]
fn cmp_freg_freg_reg64(
buf: &mut Vec<'_, u8>,

View file

@ -150,8 +150,6 @@ pub enum CompareOperation {
/// Generally, I prefer explicit sources, as opposed to dst being one of the sources. Ex: `x = x + y` would be `add x, x, y` instead of `add x, y`.
/// dst should always come before sources.
pub trait Assembler<GeneralReg: RegTrait, FloatReg: RegTrait>: Sized + Copy {
fn base_pointer() -> GeneralReg;
fn abs_reg64_reg64(buf: &mut Vec<'_, u8>, dst: GeneralReg, src: GeneralReg);
fn abs_freg64_freg64(
buf: &mut Vec<'_, u8>,
@ -250,12 +248,16 @@ pub trait Assembler<GeneralReg: RegTrait, FloatReg: RegTrait>: Sized + Copy {
/// Jumps by an offset of offset bytes if reg is not equal to imm.
/// It should always generate the same number of bytes to enable replacement if offset changes.
/// It returns the base offset to calculate the jump from (generally the instruction after the jump).
fn jne_reg64_imm64_imm32(
buf: &mut Vec<'_, u8>,
fn jne_reg64_imm64_imm32<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<'a, '_, GeneralReg, FloatReg, ASM, CC>,
reg: GeneralReg,
imm: u64,
offset: i32,
) -> usize;
) -> usize
where
ASM: Assembler<GeneralReg, FloatReg>,
CC: CallConv<GeneralReg, FloatReg, ASM>;
fn mov_freg32_imm32(
buf: &mut Vec<'_, u8>,
@ -302,6 +304,14 @@ pub trait Assembler<GeneralReg: RegTrait, FloatReg: RegTrait>: Sized + Copy {
src: GeneralReg,
);
// move with zero extension
fn movzx_reg_reg(
buf: &mut Vec<'_, u8>,
input_width: RegisterWidth,
dst: GeneralReg,
src: GeneralReg,
);
// base32 is similar to stack based instructions but they reference the base/frame pointer.
fn mov_freg64_base32(buf: &mut Vec<'_, u8>, dst: FloatReg, offset: i32);
@ -545,6 +555,22 @@ pub trait Assembler<GeneralReg: RegTrait, FloatReg: RegTrait>: Sized + Copy {
src2: GeneralReg,
);
fn eq_freg_freg_reg64(
buf: &mut Vec<'_, u8>,
dst: GeneralReg,
src1: FloatReg,
src2: FloatReg,
width: FloatWidth,
);
fn neq_freg_freg_reg64(
buf: &mut Vec<'_, u8>,
dst: GeneralReg,
src1: FloatReg,
src2: FloatReg,
width: FloatWidth,
);
fn cmp_freg_freg_reg64(
buf: &mut Vec<'_, u8>,
dst: GeneralReg,
@ -894,7 +920,7 @@ impl<
let width = RegisterWidth::try_from_layout(ret_repr).unwrap();
let dst_reg = self.storage_manager.claim_general_reg(&mut self.buf, dst);
ASM::mov_reg_reg(&mut self.buf, width, dst_reg, CC::GENERAL_RETURN_REGS[0]);
ASM::movzx_reg_reg(&mut self.buf, width, dst_reg, CC::GENERAL_RETURN_REGS[0]);
}
single_register_floats!() => {
let dst_reg = self.storage_manager.claim_float_reg(&mut self.buf, dst);
@ -964,7 +990,13 @@ impl<
// Create jump to next branch if cond_sym not equal to value.
// Since we don't know the offset yet, set it to 0 and overwrite later.
let jne_location = self.buf.len();
let start_offset = ASM::jne_reg64_imm64_imm32(&mut self.buf, cond_reg, *val, 0);
let start_offset = ASM::jne_reg64_imm64_imm32(
&mut self.buf,
&mut self.storage_manager,
cond_reg,
*val,
0,
);
// Build all statements in this branch. Using storage as from before any branch.
self.storage_manager = base_storage.clone();
@ -980,7 +1012,13 @@ impl<
// Overwrite the original jne with the correct offset.
let end_offset = self.buf.len();
let jne_offset = end_offset - start_offset;
ASM::jne_reg64_imm64_imm32(&mut tmp, cond_reg, *val, jne_offset as i32);
ASM::jne_reg64_imm64_imm32(
&mut tmp,
&mut self.storage_manager,
cond_reg,
*val,
jne_offset as i32,
);
for (i, byte) in tmp.iter().enumerate() {
self.buf[jne_location + i] = *byte;
}
@ -1451,20 +1489,19 @@ impl<
ASM::eq_reg_reg_reg(&mut self.buf, width, dst_reg, src1_reg, src2_reg);
}
LayoutRepr::U128 | LayoutRepr::I128 => {
let buf = &mut self.buf;
let dst_reg = self.storage_manager.claim_general_reg(buf, dst);
let dst_reg = self.storage_manager.claim_general_reg(&mut self.buf, dst);
// put the arguments on the stack
let (src1_offset, _) = self.storage_manager.stack_offset_and_size(src1);
let (src2_offset, _) = self.storage_manager.stack_offset_and_size(src2);
let tmp1 = self
.storage_manager
.claim_general_reg(buf, &Symbol::DEV_TMP);
let tmp2 = self
.storage_manager
.claim_general_reg(buf, &Symbol::DEV_TMP2);
let tmp1_symbol = self.debug_symbol("eq_tmp1");
let tmp2_symbol = self.debug_symbol("eq_tmp2");
let buf = &mut self.buf;
let tmp1 = self.storage_manager.claim_general_reg(buf, &tmp1_symbol);
let tmp2 = self.storage_manager.claim_general_reg(buf, &tmp2_symbol);
// move the upper 8 bytes of both arguments into a register
ASM::mov_reg64_base32(buf, tmp1, src1_offset);
@ -1483,11 +1520,25 @@ impl<
// now and dst and tmp1, storing the result in dst
ASM::and_reg64_reg64_reg64(buf, dst_reg, dst_reg, tmp1);
self.storage_manager.free_symbol(&Symbol::DEV_TMP);
self.storage_manager.free_symbol(&Symbol::DEV_TMP2);
self.storage_manager.free_symbol(&tmp1_symbol);
self.storage_manager.free_symbol(&tmp2_symbol);
}
LayoutRepr::F32 | LayoutRepr::F64 => {
let float_width = if repr == LayoutRepr::F32 {
FloatWidth::F32
} else {
FloatWidth::F64
};
let buf = &mut self.buf;
let dst_reg = self.storage_manager.claim_general_reg(buf, dst);
let src_reg1 = self.storage_manager.load_to_float_reg(buf, src1);
let src_reg2 = self.storage_manager.load_to_float_reg(buf, src2);
ASM::eq_freg_freg_reg64(&mut self.buf, dst_reg, src_reg1, src_reg2, float_width)
}
LayoutRepr::F32 => todo!("NumEq: layout, {:?}", self.layout_interner.dbg(Layout::F32)),
LayoutRepr::F64 => todo!("NumEq: layout, {:?}", self.layout_interner.dbg(Layout::F64)),
LayoutRepr::DEC => todo!("NumEq: layout, {:?}", self.layout_interner.dbg(Layout::DEC)),
LayoutRepr::STR => {
// use a zig call
@ -1508,6 +1559,8 @@ impl<
let width = RegisterWidth::W8; // we're comparing booleans
let dst_reg = self.storage_manager.load_to_general_reg(&mut self.buf, dst);
ASM::eq_reg_reg_reg(&mut self.buf, width, dst_reg, dst_reg, tmp_reg);
self.free_symbol(tmp);
}
_ => {
let ident_ids = self
@ -1582,8 +1635,25 @@ impl<
let width = RegisterWidth::W8; // we're comparing booleans
let dst_reg = self.storage_manager.load_to_general_reg(&mut self.buf, dst);
ASM::neq_reg_reg_reg(&mut self.buf, width, dst_reg, dst_reg, tmp_reg);
self.free_symbol(tmp)
}
_ => {
// defer to equality
self.build_eq(dst, src1, src2, arg_layout);
let dst_reg = self.storage_manager.load_to_general_reg(&mut self.buf, dst);
self.storage_manager
.with_tmp_general_reg(&mut self.buf, |_, buf, tmp| {
ASM::mov_reg64_imm64(buf, tmp, -1);
ASM::xor_reg64_reg64_reg64(buf, dst_reg, tmp, dst_reg);
ASM::mov_reg64_imm64(buf, tmp, 1);
ASM::and_reg64_reg64_reg64(buf, dst_reg, tmp, dst_reg);
})
}
x => todo!("NumNeq: layout, {:?}", x),
}
}
@ -2604,6 +2674,28 @@ impl<
tag_layouts[tag_id as usize],
);
}
UnionLayout::NonNullableUnwrapped(field_layouts) => {
let element_layout = field_layouts[index as usize];
let ptr_reg = self
.storage_manager
.load_to_general_reg(&mut self.buf, structure);
let mut offset = 0;
for field in &field_layouts[..index as usize] {
offset += self.layout_interner.stack_size(*field);
}
Self::ptr_read(
&mut self.buf,
&mut self.storage_manager,
self.layout_interner,
ptr_reg,
offset as i32,
element_layout,
*sym,
);
}
UnionLayout::NullableUnwrapped {
nullable_id,
other_fields,
@ -2674,15 +2766,39 @@ impl<
*sym,
);
}
UnionLayout::Recursive(tag_layouts) => {
let other_fields = tag_layouts[tag_id as usize];
let element_layout = other_fields[index as usize];
_ => {
let union_in_layout = self
.layout_interner
.insert_direct_no_semantic(LayoutRepr::Union(*union_layout));
todo!(
"loading from union type: {:?}",
self.layout_interner.dbg(union_in_layout)
)
let ptr_reg = self
.storage_manager
.load_to_general_reg(&mut self.buf, structure);
// mask out the tag id bits
if !union_layout.stores_tag_id_as_data(self.storage_manager.target_info) {
let mask_symbol = self.debug_symbol("tag_id_mask");
let mask_reg = self
.storage_manager
.claim_general_reg(&mut self.buf, &mask_symbol);
ASM::mov_reg64_imm64(&mut self.buf, mask_reg, (!0b111) as _);
ASM::and_reg64_reg64_reg64(&mut self.buf, ptr_reg, ptr_reg, mask_reg);
}
let mut offset = 0;
for field in &other_fields[..index as usize] {
offset += self.layout_interner.stack_size(*field);
}
Self::ptr_read(
&mut self.buf,
&mut self.storage_manager,
self.layout_interner,
ptr_reg,
offset as i32,
element_layout,
*sym,
);
}
}
}
@ -2791,6 +2907,10 @@ impl<
tags,
);
}
UnionLayout::NonNullableUnwrapped(_) => {
let dst_reg = self.storage_manager.claim_general_reg(&mut self.buf, sym);
ASM::mov_reg64_imm64(&mut self.buf, dst_reg, 0);
}
UnionLayout::NullableUnwrapped { nullable_id, .. } => {
// simple is_null check on the pointer
let tmp = Symbol::DEV_TMP5;
@ -2879,8 +2999,7 @@ impl<
);
// index into the table
let base_pointer = ASM::base_pointer();
ASM::add_reg64_reg64_reg64(&mut self.buf, dst_reg, dst_reg, base_pointer);
ASM::add_reg64_reg64_reg64(&mut self.buf, dst_reg, dst_reg, CC::BASE_PTR_REG);
// load the 16-bit value at the pointer
ASM::mov_reg16_mem16_offset32(&mut self.buf, dst_reg, dst_reg, table_offset);
@ -2892,7 +3011,46 @@ impl<
self.free_symbol(&tmp);
}
x => todo!("getting tag id of union with layout ({:?})", x),
UnionLayout::Recursive(_) => {
let dst_reg = self.storage_manager.claim_general_reg(&mut self.buf, sym);
let target_info = self.storage_manager.target_info;
if union_layout.stores_tag_id_as_data(target_info) {
let offset = union_layout
.tag_id_offset(self.interner(), target_info)
.unwrap() as i32;
let ptr_reg = self
.storage_manager
.load_to_general_reg(&mut self.buf, structure);
match union_layout.tag_id_layout() {
Layout::U8 => {
ASM::mov_reg8_mem8_offset32(&mut self.buf, dst_reg, ptr_reg, offset);
ASM::movzx_reg_reg(&mut self.buf, RegisterWidth::W8, dst_reg, dst_reg)
}
Layout::U16 => {
ASM::mov_reg16_mem16_offset32(&mut self.buf, dst_reg, ptr_reg, offset);
ASM::movzx_reg_reg(&mut self.buf, RegisterWidth::W16, dst_reg, dst_reg)
}
_ => unreachable!(),
}
} else {
// mask the 3 lowest bits
let tmp = Symbol::DEV_TMP5;
let reg = self.storage_manager.claim_general_reg(&mut self.buf, &tmp);
ASM::mov_reg64_imm64(&mut self.buf, reg, 0b111);
let src1_reg = reg;
let src2_reg = self
.storage_manager
.load_to_general_reg(&mut self.buf, structure);
ASM::and_reg64_reg64_reg64(&mut self.buf, dst_reg, src1_reg, src2_reg);
self.free_symbol(&tmp);
}
}
};
}
@ -2947,6 +3105,27 @@ impl<
}
});
}
UnionLayout::NonNullableUnwrapped(field_layouts) => {
// construct the payload as a struct on the stack
let temp_sym = Symbol::DEV_TMP5;
let layout = self
.layout_interner
.insert_direct_no_semantic(LayoutRepr::Struct(field_layouts));
self.load_literal_symbols(fields);
self.storage_manager.create_struct(
self.layout_interner,
&mut self.buf,
&temp_sym,
&layout,
fields,
);
// now effectively box this struct
self.expr_box(*sym, temp_sym, layout, reuse);
self.free_symbol(&temp_sym);
}
UnionLayout::NullableUnwrapped {
nullable_id,
other_fields,
@ -3038,7 +3217,92 @@ impl<
self.free_symbol(&tag_id_symbol);
}
}
x => todo!("creating unions with layout: {:?}", x),
UnionLayout::Recursive(tags) => {
self.load_literal_symbols(fields);
let whole_struct_symbol = self.debug_symbol("whole_struct_symbol");
let tag_id_symbol = self.debug_symbol("tag_id_symbol");
let other_fields = tags[tag_id as usize];
let stores_tag_id_as_data =
union_layout.stores_tag_id_as_data(self.storage_manager.target_info);
// construct the payload as a struct on the stack
let data_struct_layout = self
.layout_interner
.insert_direct_no_semantic(LayoutRepr::Struct(other_fields));
let tag_id_layout = union_layout.tag_id_layout();
if stores_tag_id_as_data {
let inner_struct_symbol = self.debug_symbol("inner_struct_symbol");
self.storage_manager.create_struct(
self.layout_interner,
&mut self.buf,
&inner_struct_symbol,
&data_struct_layout,
fields,
);
self.load_literal_i64(&tag_id_symbol, tag_id as _);
let arena = self.env.arena;
let whole_struct_layout =
self.layout_interner
.insert_direct_no_semantic(LayoutRepr::Struct(
arena.alloc([data_struct_layout, tag_id_layout]),
));
self.storage_manager.create_struct(
self.layout_interner,
&mut self.buf,
&whole_struct_symbol,
&whole_struct_layout,
arena.alloc([inner_struct_symbol, tag_id_symbol]),
);
self.expr_box(*sym, whole_struct_symbol, whole_struct_layout, reuse);
self.free_symbol(&tag_id_symbol);
self.free_symbol(&whole_struct_symbol);
self.free_symbol(&inner_struct_symbol);
} else {
self.load_literal_symbols(fields);
self.storage_manager.create_struct(
self.layout_interner,
&mut self.buf,
&whole_struct_symbol,
&data_struct_layout,
fields,
);
// now effectively box this struct
let untagged_pointer_symbol = self.debug_symbol("untagged_pointer");
self.expr_box(
untagged_pointer_symbol,
whole_struct_symbol,
data_struct_layout,
reuse,
);
self.free_symbol(&whole_struct_symbol);
// finally, we need to tag the pointer
debug_assert!(tag_id < 8);
self.load_literal_i64(&tag_id_symbol, tag_id as _);
self.build_int_bitwise_or(
sym,
&untagged_pointer_symbol,
&tag_id_symbol,
IntWidth::U64,
);
self.free_symbol(&untagged_pointer_symbol);
self.free_symbol(&tag_id_symbol);
}
}
}
}
@ -3464,6 +3728,8 @@ impl<
ASM::mov_base32_reg64(buf, base_offset + 8, src_reg);
self.free_symbol(&tmp);
return;
}
@ -3624,7 +3890,8 @@ impl<
// jump to where the pointer is valid, because it is already valid if non-zero
let jmp_start_index = self.buf.len();
let jmp_end_index = ASM::jne_reg64_imm64_imm32(&mut self.buf, src_reg, 0x0, 0);
let jmp_end_index =
ASM::jne_reg64_imm64_imm32(&mut self.buf, &mut self.storage_manager, src_reg, 0x0, 0);
self.free_symbol(&dst);
@ -3647,6 +3914,7 @@ impl<
let destination_index = self.buf.len();
ASM::jne_reg64_imm64_imm32(
&mut tmp,
&mut self.storage_manager,
src_reg,
0x0,
(destination_index - jmp_end_index) as i32,

View file

@ -1139,11 +1139,6 @@ where
}
impl Assembler<X86_64GeneralReg, X86_64FloatReg> for X86_64Assembler {
#[inline(always)]
fn base_pointer() -> X86_64GeneralReg {
X86_64GeneralReg::RBP
}
// These functions should map to the raw assembly functions below.
// In some cases, that means you can just directly call one of the direct assembly functions.
#[inline(always)]
@ -1432,18 +1427,29 @@ impl Assembler<X86_64GeneralReg, X86_64FloatReg> for X86_64Assembler {
}
#[inline(always)]
fn jne_reg64_imm64_imm32(
buf: &mut Vec<'_, u8>,
fn jne_reg64_imm64_imm32<'a, ASM, CC>(
buf: &mut Vec<'a, u8>,
storage_manager: &mut StorageManager<'a, '_, X86_64GeneralReg, X86_64FloatReg, ASM, CC>,
reg: X86_64GeneralReg,
imm: u64,
offset: i32,
) -> usize {
) -> usize
where
ASM: Assembler<X86_64GeneralReg, X86_64FloatReg>,
CC: CallConv<X86_64GeneralReg, X86_64FloatReg, ASM>,
{
buf.reserve(13);
if imm > i32::MAX as u64 {
todo!("comparison with values greater than i32::max");
storage_manager.with_tmp_general_reg(buf, |_, buf, tmp| {
mov_reg64_imm64(buf, tmp, imm as _);
cmp_reg64_reg64(buf, RegisterWidth::W64, reg, tmp);
})
} else {
cmp_reg64_imm32(buf, reg, imm as i32);
}
cmp_reg64_imm32(buf, reg, imm as i32);
jne_imm32(buf, offset);
buf.len()
}
@ -1500,6 +1506,7 @@ impl Assembler<X86_64GeneralReg, X86_64FloatReg> for X86_64Assembler {
) {
mov_reg_reg(buf, register_width, dst, src);
}
#[inline(always)]
fn movsx_reg_reg(
buf: &mut Vec<'_, u8>,
@ -1507,7 +1514,27 @@ impl Assembler<X86_64GeneralReg, X86_64FloatReg> for X86_64Assembler {
dst: X86_64GeneralReg,
src: X86_64GeneralReg,
) {
raw_movsx_reg_reg(buf, input_width, dst, src);
use RegisterWidth::*;
match input_width {
W8 | W16 | W32 => raw_movsx_reg_reg(buf, input_width, dst, src),
W64 => mov_reg_reg(buf, input_width, dst, src),
}
}
#[inline(always)]
fn movzx_reg_reg(
buf: &mut Vec<'_, u8>,
input_width: RegisterWidth,
dst: X86_64GeneralReg,
src: X86_64GeneralReg,
) {
use RegisterWidth::*;
match input_width {
W8 | W16 => raw_movzx_reg_reg(buf, input_width, dst, src),
W32 | W64 => mov_reg_reg(buf, input_width, dst, src),
}
}
#[inline(always)]
@ -1796,6 +1823,36 @@ impl Assembler<X86_64GeneralReg, X86_64FloatReg> for X86_64Assembler {
}
}
fn eq_freg_freg_reg64(
buf: &mut Vec<'_, u8>,
dst: X86_64GeneralReg,
src1: X86_64FloatReg,
src2: X86_64FloatReg,
width: FloatWidth,
) {
match width {
FloatWidth::F32 => cmp_freg32_freg32(buf, src1, src2),
FloatWidth::F64 => cmp_freg64_freg64(buf, src1, src2),
}
sete_reg64(buf, dst);
}
fn neq_freg_freg_reg64(
buf: &mut Vec<'_, u8>,
dst: X86_64GeneralReg,
src1: X86_64FloatReg,
src2: X86_64FloatReg,
width: FloatWidth,
) {
match width {
FloatWidth::F32 => cmp_freg32_freg32(buf, src1, src2),
FloatWidth::F64 => cmp_freg64_freg64(buf, src1, src2),
}
setne_reg64(buf, dst);
}
#[inline(always)]
fn cmp_freg_freg_reg64(
buf: &mut Vec<'_, u8>,
@ -2636,6 +2693,35 @@ fn raw_movsx_reg_reg(
}
}
#[allow(unused)]
fn raw_movzx_reg_reg(
buf: &mut Vec<u8>,
input_width: RegisterWidth,
dst: X86_64GeneralReg,
src: X86_64GeneralReg,
) {
let dst_high = dst as u8 > 7;
let dst_mod = dst as u8 % 8;
let src_high = src as u8 > 7;
let src_mod = src as u8 % 8;
// NOTE src and dst seem to be flipped here. It works this way though
let mod_rm = 0xC0 | (dst_mod << 3) | src_mod;
let rex = add_rm_extension(src, REX_W);
let rex = add_reg_extension(dst, rex);
match input_width {
RegisterWidth::W8 => {
buf.extend([rex, 0x0f, 0xb6, mod_rm]);
}
RegisterWidth::W16 => {
buf.extend([rex, 0x0f, 0xb7, mod_rm]);
}
RegisterWidth::W32 | RegisterWidth::W64 => { /* do nothing */ }
}
}
/// `MOV r/m64,r64` -> Move r64 to r/m64.
/// This will not generate anything if dst and src are the same.
#[inline(always)]
@ -3811,6 +3897,32 @@ mod tests {
);
}
#[test]
fn test_movzx_reg64_reg64() {
disassembler_test!(
raw_movzx_reg_reg,
|w, reg1, reg2| {
match w {
RegisterWidth::W8 => format!(
"movzx {}, {}",
reg1,
X86_64GeneralReg::low_8bits_string(&reg2)
),
RegisterWidth::W16 => format!(
"movzx {}, {}",
reg1,
X86_64GeneralReg::low_16bits_string(&reg2)
),
RegisterWidth::W32 => String::new(),
RegisterWidth::W64 => String::new(),
}
},
ALL_REGISTER_WIDTHS,
ALL_GENERAL_REGS,
ALL_GENERAL_REGS
);
}
#[test]
fn test_movsd_freg64_base64_offset32() {
disassembler_test!(

View file

@ -1121,14 +1121,17 @@ trait Backend<'a> {
}
LowLevel::Eq => {
debug_assert_eq!(2, args.len(), "Eq: expected to have exactly two argument");
let a = Layout::runtime_representation_in(arg_layouts[0], self.interner());
let b = Layout::runtime_representation_in(arg_layouts[1], self.interner());
debug_assert!(
self.interner().eq_repr(arg_layouts[0], arg_layouts[1],),
"Eq: expected all arguments of to have the same layout"
);
debug_assert!(
self.interner().eq_repr(Layout::BOOL, *ret_layout,),
"Eq: expected to have return layout of type Bool"
self.interner().eq_repr(a, b),
"Eq: expected all arguments to have the same layout, but {} != {}",
self.interner().dbg(a),
self.interner().dbg(b),
);
self.build_eq(sym, &args[0], &args[1], &arg_layouts[0])
}
LowLevel::NotEq => {
@ -1137,9 +1140,15 @@ trait Backend<'a> {
args.len(),
"NotEq: expected to have exactly two argument"
);
let a = Layout::runtime_representation_in(arg_layouts[0], self.interner());
let b = Layout::runtime_representation_in(arg_layouts[1], self.interner());
debug_assert!(
self.interner().eq_repr(arg_layouts[0], arg_layouts[1],),
"NotEq: expected all arguments of to have the same layout"
self.interner().eq_repr(a, b),
"NotEq: expected all arguments to have the same layout, but {} != {}",
self.interner().dbg(a),
self.interner().dbg(b),
);
debug_assert!(
self.interner().eq_repr(Layout::BOOL, *ret_layout,),
@ -1546,6 +1555,21 @@ trait Backend<'a> {
args.len(),
"RefCountGetPtr: expected to have exactly one argument"
);
debug_assert_eq!(
self.interner().stack_size_and_alignment(arg_layouts[0]),
(8, 8),
"cannot pointer cast from source: {}",
self.interner().dbg(arg_layouts[0])
);
debug_assert_eq!(
self.interner().stack_size_and_alignment(*ret_layout),
(8, 8),
"cannot pointer cast to target: {}",
self.interner().dbg(*ret_layout)
);
self.build_ptr_cast(sym, &args[0])
}
LowLevel::PtrWrite => {

View file

@ -27,8 +27,9 @@ use crate::llvm::{
BitcodeReturns,
},
build::{
complex_bitcast_check_size, create_entry_block_alloca, function_value_by_func_spec,
load_roc_value, roc_function_call, tag_pointer_clear_tag_id, BuilderExt, RocReturn,
cast_basic_basic, complex_bitcast_check_size, create_entry_block_alloca,
function_value_by_func_spec, load_roc_value, roc_function_call, tag_pointer_clear_tag_id,
BuilderExt, RocReturn,
},
build_list::{
list_append_unsafe, list_concat, list_drop_at, list_get_unsafe, list_len, list_map,
@ -1092,6 +1093,7 @@ pub(crate) fn run_low_level<'a, 'ctx>(
lhs_layout,
rhs_arg,
rhs_layout,
layout,
op,
)
}
@ -1553,12 +1555,13 @@ fn build_int_binop<'ctx>(
pub fn build_num_binop<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &STLayoutInterner<'a>,
layout_interner: &mut STLayoutInterner<'a>,
parent: FunctionValue<'ctx>,
lhs_arg: BasicValueEnum<'ctx>,
lhs_layout: InLayout<'a>,
rhs_arg: BasicValueEnum<'ctx>,
rhs_layout: InLayout<'a>,
return_layout: InLayout<'a>,
op: LowLevel,
) -> BasicValueEnum<'ctx> {
match (
@ -1588,9 +1591,15 @@ pub fn build_num_binop<'a, 'ctx>(
op,
),
Decimal => {
build_dec_binop(env, parent, lhs_arg, lhs_layout, rhs_arg, rhs_layout, op)
}
Decimal => build_dec_binop(
env,
layout_interner,
parent,
lhs_arg,
rhs_arg,
return_layout,
op,
),
_ => {
unreachable!("Compiler bug: tried to run numeric operation {:?} on invalid builtin layout: ({:?})", op, lhs_layout);
}
@ -1927,21 +1936,43 @@ pub(crate) fn dec_binop_with_unchecked<'ctx>(
}
}
/// Zig returns a nominal `WithOverflow(Dec)` struct (see [zig_with_overflow_roc_dec]),
/// but the Roc side may flatten the overflow struct. LLVM does not admit comparisons
/// between the two representations, so always cast to the Roc representation.
fn cast_with_overflow_dec_to_roc_type<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
val: BasicValueEnum<'ctx>,
return_layout: InLayout<'a>,
) -> BasicValueEnum<'ctx> {
let return_type = convert::basic_type_from_layout(env, layout_interner, return_layout);
cast_basic_basic(env.builder, val, return_type)
}
fn build_dec_binop<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
parent: FunctionValue<'ctx>,
lhs: BasicValueEnum<'ctx>,
_lhs_layout: InLayout<'a>,
rhs: BasicValueEnum<'ctx>,
_rhs_layout: InLayout<'a>,
return_layout: InLayout<'a>,
op: LowLevel,
) -> BasicValueEnum<'ctx> {
use roc_module::low_level::LowLevel::*;
match op {
NumAddChecked => call_bitcode_fn(env, &[lhs, rhs], bitcode::DEC_ADD_WITH_OVERFLOW),
NumSubChecked => call_bitcode_fn(env, &[lhs, rhs], bitcode::DEC_SUB_WITH_OVERFLOW),
NumMulChecked => call_bitcode_fn(env, &[lhs, rhs], bitcode::DEC_MUL_WITH_OVERFLOW),
NumAddChecked => {
let val = dec_binop_with_overflow(env, bitcode::DEC_ADD_WITH_OVERFLOW, lhs, rhs);
cast_with_overflow_dec_to_roc_type(env, layout_interner, val.into(), return_layout)
}
NumSubChecked => {
let val = dec_binop_with_overflow(env, bitcode::DEC_SUB_WITH_OVERFLOW, lhs, rhs);
cast_with_overflow_dec_to_roc_type(env, layout_interner, val.into(), return_layout)
}
NumMulChecked => {
let val = dec_binop_with_overflow(env, bitcode::DEC_MUL_WITH_OVERFLOW, lhs, rhs);
cast_with_overflow_dec_to_roc_type(env, layout_interner, val.into(), return_layout)
}
NumAdd => build_dec_binop_throw_on_overflow(
env,
parent,

View file

@ -25,7 +25,7 @@ const MODULES: &[(ModuleId, &str)] = &[
(ModuleId::ENCODE, "Encode.roc"),
(ModuleId::DECODE, "Decode.roc"),
(ModuleId::HASH, "Hash.roc"),
(ModuleId::JSON, "Json.roc"),
(ModuleId::JSON, "TotallyNotJson.roc"),
];
fn main() {

View file

@ -3847,7 +3847,7 @@ fn load_module<'a>(
"Encode", ModuleId::ENCODE
"Decode", ModuleId::DECODE
"Hash", ModuleId::HASH
"Json", ModuleId::JSON
"TotallyNotJson", ModuleId::JSON
}
let (filename, opt_shorthand) = module_name_to_path(src_dir, &module_name, arc_shorthands);

View file

@ -23,5 +23,5 @@ pub const BUILTIN_MODULES: &[(ModuleId, &str)] = &[
(ModuleId::ENCODE, "Encode"),
(ModuleId::DECODE, "Decode"),
(ModuleId::HASH, "Hash"),
(ModuleId::JSON, "Json"),
(ModuleId::JSON, "TotallyNotJson"),
];

View file

@ -113,7 +113,7 @@ impl ModuleName {
pub const ENCODE: &'static str = "Encode";
pub const DECODE: &'static str = "Decode";
pub const HASH: &'static str = "Hash";
pub const JSON: &'static str = "Json";
pub const JSON: &'static str = "TotallyNotJson";
pub fn as_str(&self) -> &str {
self.0.as_str()

View file

@ -1574,8 +1574,8 @@ define_builtins! {
20 HASH_HASH_LIST: "hashList"
21 HASH_HASH_UNORDERED: "hashUnordered"
}
14 JSON: "Json" => {
0 JSON_JSON: "Json"
14 JSON: "TotallyNotJson" => {
0 JSON_JSON: "TotallyNotJson"
}
num_modules: 15 // Keep this count up to date by hand! (TODO: see the mut_map! macro for how we could determine this count correctly in the macro)

View file

@ -180,7 +180,7 @@ fn eq_struct<'a>(
))
}
if_pointers_equal_return_true(root, ident_ids, [ARG_1, ARG_2], root.arena.alloc(else_stmt))
else_stmt
}
fn eq_tag_union<'a>(
@ -428,14 +428,19 @@ fn eq_tag_union_help<'a>(
)),
));
let compare_ptr_or_value =
if_pointers_equal_return_true(root, ident_ids, operands, root.arena.alloc(compare_values));
if is_non_recursive {
compare_ptr_or_value
compare_values
} else {
let compare_ptr_or_value = if_pointers_equal_return_true(
root,
ident_ids,
operands,
root.arena.alloc(compare_values),
);
let union_layout =
layout_interner.insert_direct_no_semantic(LayoutRepr::Union(union_layout));
let loop_params_iter = operands.iter().map(|arg| Param {
symbol: *arg,
ownership: Ownership::Borrowed,

View file

@ -109,6 +109,7 @@ enum Test<'a> {
arguments: Vec<(Pattern<'a>, InLayout<'a>)>,
},
IsInt([u8; 16], IntWidth),
// stores the f64 bits; u64 so that this type can impl Hash
IsFloat(u64, FloatWidth),
IsDecimal([u8; 16]),
IsStr(Box<str>),
@ -131,7 +132,7 @@ impl<'a> Test<'a> {
// llvm does not like switching on 128-bit values
!matches!(int_width, IntWidth::U128 | IntWidth::I128)
}
Test::IsFloat(_, _) => true,
Test::IsFloat(_, _) => false,
Test::IsDecimal(_) => false,
Test::IsStr(_) => false,
Test::IsBit(_) => true,
@ -2251,7 +2252,7 @@ fn decide_to_branching<'a>(
let tag = match test {
Test::IsInt(v, _) => i128::from_ne_bytes(v) as u64,
Test::IsFloat(v, _) => v,
Test::IsFloat(_, _) => unreachable!("floats cannot be switched on"),
Test::IsBit(v) => v as u64,
Test::IsByte { tag_id, .. } => tag_id as u64,
Test::IsCtor { tag_id, .. } => tag_id as u64,

View file

@ -355,7 +355,7 @@ fn encode_use_stdlib() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
HelloWorld := {} implements [Encoding {toEncoder}]
@ -365,7 +365,7 @@ fn encode_use_stdlib() {
|> Encode.appendWith (Encode.string "Hello, World!\n") fmt
main =
result = Str.fromUtf8 (Encode.toBytes (@HelloWorld {}) Json.json)
result = Str.fromUtf8 (Encode.toBytes (@HelloWorld {}) TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -383,14 +383,14 @@ fn encode_use_stdlib_without_wrapping_custom() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
HelloWorld := {} implements [Encoding {toEncoder}]
toEncoder = \@HelloWorld {} -> Encode.string "Hello, World!\n"
main =
result = Str.fromUtf8 (Encode.toBytes (@HelloWorld {}) Json.json)
result = Str.fromUtf8 (Encode.toBytes (@HelloWorld {}) TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -409,13 +409,13 @@ fn encode_derive_to_encoder_for_opaque() {
indoc!(
r#"
app "test"
imports [Json]
imports [TotallyNotJson]
provides [main] to "./platform"
HelloWorld := { a: Str } implements [Encoding]
main =
result = Str.fromUtf8 (Encode.toBytes (@HelloWorld { a: "Hello, World!" }) Json.json)
result = Str.fromUtf8 (Encode.toBytes (@HelloWorld { a: "Hello, World!" }) TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -433,7 +433,7 @@ fn to_encoder_encode_custom_has_capture() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
HelloWorld := Str implements [Encoding {toEncoder}]
@ -443,7 +443,7 @@ fn to_encoder_encode_custom_has_capture() {
|> Encode.appendWith (Encode.string s1) fmt
main =
result = Str.fromUtf8 (Encode.toBytes (@HelloWorld "Hello, World!\n") Json.json)
result = Str.fromUtf8 (Encode.toBytes (@HelloWorld "Hello, World!\n") TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -473,10 +473,10 @@ mod encode_immediate {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Encode, Json] provides [main] to "./platform"
app "test" imports [Encode, TotallyNotJson] provides [main] to "./platform"
main =
when Str.fromUtf8 (Encode.toBytes "foo" Json.json) is
when Str.fromUtf8 (Encode.toBytes "foo" TotallyNotJson.json) is
Ok s -> s
_ -> "<bad>"
"#
@ -492,10 +492,10 @@ mod encode_immediate {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Encode, Json] provides [main] to "./platform"
app "test" imports [Encode, TotallyNotJson] provides [main] to "./platform"
main =
when Str.fromUtf8 (Encode.toBytes [1, 2, 3] Json.json) is
when Str.fromUtf8 (Encode.toBytes [1, 2, 3] TotallyNotJson.json) is
Ok s -> s
_ -> "<bad>"
"#
@ -511,10 +511,10 @@ mod encode_immediate {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Encode, Json] provides [main] to "./platform"
app "test" imports [Encode, TotallyNotJson] provides [main] to "./platform"
main =
when Str.fromUtf8 (Encode.toBytes Bool.false Json.json) is
when Str.fromUtf8 (Encode.toBytes Bool.false TotallyNotJson.json) is
Ok s -> s
_ -> "<bad>"
"#
@ -532,10 +532,10 @@ mod encode_immediate {
assert_evals_to!(
&format!(indoc!(
r#"
app "test" imports [Encode, Json] provides [main] to "./platform"
app "test" imports [Encode, TotallyNotJson] provides [main] to "./platform"
main =
when Str.fromUtf8 (Encode.toBytes {}{} Json.json) is
when Str.fromUtf8 (Encode.toBytes {}{} TotallyNotJson.json) is
Ok s -> s
_ -> "<bad>"
"#
@ -572,11 +572,11 @@ fn encode_derived_record_one_field_string() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
main =
result = Str.fromUtf8 (Encode.toBytes {a: "foo"} Json.json)
result = Str.fromUtf8 (Encode.toBytes {a: "foo"} TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -595,12 +595,12 @@ fn encode_derived_record_two_fields_strings() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
main =
rcd = {a: "foo", b: "bar"}
result = Str.fromUtf8 (Encode.toBytes rcd Json.json)
result = Str.fromUtf8 (Encode.toBytes rcd TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -619,12 +619,12 @@ fn encode_derived_nested_record_string() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
main =
rcd = {a: {b: "bar"}}
encoded = Encode.toBytes rcd Json.json
encoded = Encode.toBytes rcd TotallyNotJson.json
result = Str.fromUtf8 encoded
when result is
Ok s -> s
@ -643,12 +643,12 @@ fn encode_derived_tag_one_payload_string() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
main =
x = A "foo"
result = Str.fromUtf8 (Encode.toBytes x Json.json)
result = Str.fromUtf8 (Encode.toBytes x TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -666,12 +666,12 @@ fn encode_derived_tag_two_payloads_string() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
main =
x = A "foo" "bar"
result = Str.fromUtf8 (Encode.toBytes x Json.json)
result = Str.fromUtf8 (Encode.toBytes x TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -689,12 +689,12 @@ fn encode_derived_nested_tag_string() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
main =
x = A (B "foo" "bar")
encoded = Encode.toBytes x Json.json
encoded = Encode.toBytes x TotallyNotJson.json
result = Str.fromUtf8 encoded
when result is
Ok s -> s
@ -714,12 +714,12 @@ fn encode_derived_nested_record_tag_record() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
main =
x = {a: (B ({c: "foo"}))}
encoded = Encode.toBytes x Json.json
encoded = Encode.toBytes x TotallyNotJson.json
result = Str.fromUtf8 encoded
when result is
Ok s -> s
@ -738,12 +738,12 @@ fn encode_derived_list_string() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
main =
lst = ["foo", "bar", "baz"]
encoded = Encode.toBytes lst Json.json
encoded = Encode.toBytes lst TotallyNotJson.json
result = Str.fromUtf8 encoded
when result is
Ok s -> s
@ -763,12 +763,12 @@ fn encode_derived_list_of_records() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
main =
lst = [{a: "foo"}, {a: "bar"}, {a: "baz"}]
encoded = Encode.toBytes lst Json.json
encoded = Encode.toBytes lst TotallyNotJson.json
result = Str.fromUtf8 encoded
when result is
Ok s -> s
@ -787,12 +787,12 @@ fn encode_derived_list_of_lists_of_strings() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
main =
lst = [["a", "b"], ["c", "d", "e"], ["f"]]
encoded = Encode.toBytes lst Json.json
encoded = Encode.toBytes lst TotallyNotJson.json
result = Str.fromUtf8 encoded
when result is
Ok s -> s
@ -812,14 +812,14 @@ fn encode_derived_record_with_many_types() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
main =
fresh : [Fresh Str, Rotten Str]
fresh = Fresh "tomatoes"
rcd = {actors: ["Idris Elba", "Mila Kunis"], year: 2004u16, rating: {average: 7u8, min: 1u8, max: 10u8, sentiment: fresh}}
result = Str.fromUtf8 (Encode.toBytes rcd Json.json)
result = Str.fromUtf8 (Encode.toBytes rcd TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -839,12 +839,12 @@ fn encode_derived_tuple_two_fields() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
main =
tup = ("foo", 10u8)
result = Str.fromUtf8 (Encode.toBytes tup Json.json)
result = Str.fromUtf8 (Encode.toBytes tup TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -862,12 +862,12 @@ fn encode_derived_tuple_of_tuples() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
main =
tup = ( ("foo", 10u8), (23u8, "bar", 15u8) )
result = Str.fromUtf8 (Encode.toBytes tup Json.json)
result = Str.fromUtf8 (Encode.toBytes tup TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -886,7 +886,7 @@ fn encode_derived_generic_record_with_different_field_types() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
Q a b := {a: a, b: b} implements [Encoding]
@ -894,7 +894,7 @@ fn encode_derived_generic_record_with_different_field_types() {
q = @Q {a: 10u32, b: "fieldb"}
main =
result = Str.fromUtf8 (Encode.toBytes q Json.json)
result = Str.fromUtf8 (Encode.toBytes q TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -912,7 +912,7 @@ fn encode_derived_generic_tag_with_different_field_types() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
Q a b := [A a, B b] implements [Encoding]
@ -921,7 +921,7 @@ fn encode_derived_generic_tag_with_different_field_types() {
q = @Q (B 67)
main =
result = Str.fromUtf8 (Encode.toBytes q Json.json)
result = Str.fromUtf8 (Encode.toBytes q TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -939,12 +939,12 @@ fn specialize_unique_newtype_records() {
indoc!(
r#"
app "test"
imports [Encode, Json]
imports [Encode, TotallyNotJson]
provides [main] to "./platform"
main =
when Str.fromUtf8 (Encode.toBytes {a: Bool.true} Json.json) is
Ok s -> when Str.fromUtf8 (Encode.toBytes {b: Bool.true} Json.json) is
when Str.fromUtf8 (Encode.toBytes {a: Bool.true} TotallyNotJson.json) is
Ok s -> when Str.fromUtf8 (Encode.toBytes {b: Bool.true} TotallyNotJson.json) is
Ok t -> "\(s)\(t)"
_ -> "<bad>"
_ -> "<bad>"
@ -962,7 +962,7 @@ fn decode_use_stdlib() {
indoc!(
r#"
app "test"
imports [Json]
imports [TotallyNotJson]
provides [main] to "./platform"
MyNum := U8 implements [Decoding {decoder: myDecoder}]
@ -976,7 +976,7 @@ fn decode_use_stdlib() {
Err e -> {result: Err e, rest}
main =
when Decode.fromBytes [49, 53] Json.json is
when Decode.fromBytes [49, 53] TotallyNotJson.json is
Ok (@MyNum n) -> n
_ -> 101
"#
@ -996,13 +996,13 @@ fn decode_derive_decoder_for_opaque() {
indoc!(
r#"
app "test"
imports [Json]
imports [TotallyNotJson]
provides [main] to "./platform"
HelloWorld := { a: Str } implements [Decoding]
main =
when Str.toUtf8 """{"a":"Hello, World!"}""" |> Decode.fromBytes Json.json is
when Str.toUtf8 """{"a":"Hello, World!"}""" |> Decode.fromBytes TotallyNotJson.json is
Ok (@HelloWorld {a}) -> a
_ -> "FAIL"
"#
@ -1019,7 +1019,7 @@ fn decode_use_stdlib_json_list() {
indoc!(
r#"
app "test"
imports [Json]
imports [TotallyNotJson]
provides [main] to "./platform"
MyNumList := List U8 implements [Decoding {decoder: myDecoder}]
@ -1033,7 +1033,7 @@ fn decode_use_stdlib_json_list() {
Err e -> {result: Err e, rest}
main =
when Str.toUtf8 "[1,2,3]" |> Decode.fromBytes Json.json is
when Str.toUtf8 "[1,2,3]" |> Decode.fromBytes TotallyNotJson.json is
Ok (@MyNumList lst) -> lst
_ -> []
"#
@ -1062,10 +1062,10 @@ mod decode_immediate {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
main =
when Str.toUtf8 "\"foo\"" |> Decode.fromBytes Json.json is
when Str.toUtf8 "\"foo\"" |> Decode.fromBytes TotallyNotJson.json is
Ok s -> s
_ -> "<bad>"
"#
@ -1081,13 +1081,13 @@ mod decode_immediate {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
main =
input = Str.toUtf8 "[1,2,3]"
expected = [1,2,3]
actual = Decode.fromBytes input Json.json |> Result.withDefault []
actual = Decode.fromBytes input TotallyNotJson.json |> Result.withDefault []
actual == expected
"#
@ -1103,10 +1103,10 @@ mod decode_immediate {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
main =
when Str.toUtf8 "false" |> Decode.fromBytes Json.json is
when Str.toUtf8 "false" |> Decode.fromBytes TotallyNotJson.json is
Ok s -> s
_ -> Bool.true
"#
@ -1124,10 +1124,10 @@ mod decode_immediate {
assert_evals_to!(
&format!(indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
main =
when Num.toStr {}{} |> Str.toUtf8 |> Decode.fromBytes Json.json is
when Num.toStr {}{} |> Str.toUtf8 |> Decode.fromBytes TotallyNotJson.json is
Ok n -> n
_ -> 101{}
"#
@ -1162,10 +1162,10 @@ mod decode_immediate {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
main =
when Num.toStr 17.23dec |> Str.toUtf8 |> Decode.fromBytes Json.json is
when Num.toStr 17.23dec |> Str.toUtf8 |> Decode.fromBytes TotallyNotJson.json is
Ok n -> n
_ -> 101dec
"#
@ -1182,10 +1182,10 @@ fn decode_list_of_strings() {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
main =
when Str.toUtf8 "[\"a\",\"b\",\"c\"]" |> Decode.fromBytes Json.json is
when Str.toUtf8 "[\"a\",\"b\",\"c\"]" |> Decode.fromBytes TotallyNotJson.json is
Ok l -> Str.joinWith l ","
_ -> "<bad>"
"#
@ -1201,10 +1201,10 @@ fn encode_then_decode_list_of_strings() {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
main =
when Encode.toBytes ["a", "b", "c"] Json.json |> Decode.fromBytes Json.json is
when Encode.toBytes ["a", "b", "c"] TotallyNotJson.json |> Decode.fromBytes TotallyNotJson.json is
Ok l -> Str.joinWith l ","
_ -> "something went wrong"
"#
@ -1221,10 +1221,10 @@ fn encode_then_decode_list_of_lists_of_strings() {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
main =
when Encode.toBytes [["a", "b"], ["c", "d", "e"], ["f"]] Json.json |> Decode.fromBytes Json.json is
when Encode.toBytes [["a", "b"], ["c", "d", "e"], ["f"]] TotallyNotJson.json |> Decode.fromBytes TotallyNotJson.json is
Ok list -> (List.map list \inner -> Str.joinWith inner ",") |> Str.joinWith l ";"
_ -> "something went wrong"
"#
@ -1243,10 +1243,10 @@ fn decode_record_two_fields() {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
main =
when Str.toUtf8 "{\"first\":\"ab\",\"second\":\"cd\"}" |> Decode.fromBytes Json.json is
when Str.toUtf8 "{\"first\":\"ab\",\"second\":\"cd\"}" |> Decode.fromBytes TotallyNotJson.json is
Ok {first: "ab", second: "cd"} -> "abcd"
_ -> "something went wrong"
"#
@ -1265,10 +1265,10 @@ fn decode_record_two_fields_string_and_int() {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
main =
when Str.toUtf8 "{\"first\":\"ab\",\"second\":10}" |> Decode.fromBytes Json.json is
when Str.toUtf8 "{\"first\":\"ab\",\"second\":10}" |> Decode.fromBytes TotallyNotJson.json is
Ok {first: "ab", second: 10u8} -> "ab10"
_ -> "something went wrong"
"#
@ -1287,10 +1287,10 @@ fn decode_record_two_fields_string_and_string_infer() {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
main =
when Str.toUtf8 "{\"first\":\"ab\",\"second\":\"cd\"}" |> Decode.fromBytes Json.json is
when Str.toUtf8 "{\"first\":\"ab\",\"second\":\"cd\"}" |> Decode.fromBytes TotallyNotJson.json is
Ok {first, second} -> Str.concat first second
_ -> "something went wrong"
"#
@ -1309,10 +1309,10 @@ fn decode_record_two_fields_string_and_string_infer_local_var() {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
main =
decoded = Str.toUtf8 "{\"first\":\"ab\",\"second\":\"cd\"}" |> Decode.fromBytes Json.json
decoded = Str.toUtf8 "{\"first\":\"ab\",\"second\":\"cd\"}" |> Decode.fromBytes TotallyNotJson.json
when decoded is
Ok rcd -> Str.concat rcd.first rcd.second
_ -> "something went wrong"
@ -1332,10 +1332,10 @@ fn decode_record_two_fields_string_and_string_infer_local_var_destructured() {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
main =
decoded = Str.toUtf8 "{\"first\":\"ab\",\"second\":\"cd\"}" |> Decode.fromBytes Json.json
decoded = Str.toUtf8 "{\"first\":\"ab\",\"second\":\"cd\"}" |> Decode.fromBytes TotallyNotJson.json
when decoded is
Ok {first, second} -> Str.concat first second
_ -> "something went wrong"
@ -1353,10 +1353,10 @@ fn decode_empty_record() {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
main =
when Str.toUtf8 "{}" |> Decode.fromBytes Json.json is
when Str.toUtf8 "{}" |> Decode.fromBytes TotallyNotJson.json is
Ok {} -> "empty"
_ -> "something went wrong"
"#
@ -1376,10 +1376,10 @@ fn decode_record_of_record() {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
main =
when Str.toUtf8 "{\"outer\":{\"inner\":\"a\"},\"other\":{\"one\":\"b\",\"two\":10}}" |> Decode.fromBytes Json.json is
when Str.toUtf8 "{\"outer\":{\"inner\":\"a\"},\"other\":{\"one\":\"b\",\"two\":10}}" |> Decode.fromBytes TotallyNotJson.json is
Ok {outer: {inner: "a"}, other: {one: "b", two: 10u8}} -> "ab10"
_ -> "something went wrong"
"#
@ -1398,10 +1398,10 @@ fn decode_tuple_two_elements() {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
main =
when Str.toUtf8 "[\"ab\",10]" |> Decode.fromBytes Json.json is
when Str.toUtf8 "[\"ab\",10]" |> Decode.fromBytes TotallyNotJson.json is
Ok ("ab", 10u8) -> "abcd"
_ -> "something went wrong"
"#
@ -1420,10 +1420,10 @@ fn decode_tuple_of_tuples() {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
main =
when Str.toUtf8 "[[\"ab\",10],[\"cd\",25]]" |> Decode.fromBytes Json.json is
when Str.toUtf8 "[[\"ab\",10],[\"cd\",25]]" |> Decode.fromBytes TotallyNotJson.json is
Ok ( ("ab", 10u8), ("cd", 25u8) ) -> "abcd"
_ -> "something went wrong"
"#
@ -2139,11 +2139,11 @@ fn issue_4772_weakened_monomorphic_destructure() {
indoc!(
r###"
app "test"
imports [Json]
imports [TotallyNotJson]
provides [main] to "./platform"
getNumber =
{ result, rest } = Decode.fromBytesPartial (Str.toUtf8 "\"1234\"") Json.json
{ result, rest } = Decode.fromBytesPartial (Str.toUtf8 "\"1234\"") TotallyNotJson.json
when result is
Ok val ->

View file

@ -3924,3 +3924,45 @@ fn bool_in_switch() {
bool
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn add_checked_dec() {
assert_evals_to!(
indoc!(
r#"
Num.addChecked 2.0dec 4.0dec == Ok 6.0dec
"#
),
true,
bool
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn sub_checked_dec() {
assert_evals_to!(
indoc!(
r#"
Num.subChecked 5.0dec 2.0dec == Ok 3.0dec
"#
),
true,
bool
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn mul_checked_dec() {
assert_evals_to!(
indoc!(
r#"
Num.mulChecked 5.0dec 2.0dec == Ok 10.0dec
"#
),
true,
bool
);
}

View file

@ -12,19 +12,19 @@ use indoc::indoc;
use roc_std::{RocBox, RocList, RocStr};
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn basic_int() {
assert_evals_to!("123", 123, i64);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn basic_float() {
assert_evals_to!("1234.0", 1234.0, f64);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn branch_first_float() {
assert_evals_to!(
indoc!(
@ -40,7 +40,7 @@ fn branch_first_float() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn branch_second_float() {
assert_evals_to!(
indoc!(
@ -56,7 +56,7 @@ fn branch_second_float() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn branch_third_float() {
assert_evals_to!(
indoc!(
@ -73,7 +73,7 @@ fn branch_third_float() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn branch_first_int() {
assert_evals_to!(
indoc!(
@ -89,7 +89,7 @@ fn branch_first_int() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn branch_second_int() {
assert_evals_to!(
indoc!(
@ -122,7 +122,7 @@ fn branch_third_int() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn branch_store_variable() {
assert_evals_to!(
indoc!(
@ -138,7 +138,7 @@ fn branch_store_variable() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn when_one_element_tag() {
assert_evals_to!(
indoc!(
@ -156,7 +156,7 @@ fn when_one_element_tag() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn when_two_element_tag_first() {
assert_evals_to!(
indoc!(
@ -175,7 +175,7 @@ fn when_two_element_tag_first() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn when_two_element_tag_second() {
assert_evals_to!(
indoc!(
@ -194,7 +194,7 @@ fn when_two_element_tag_second() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn gen_when_one_branch() {
assert_evals_to!(
indoc!(
@ -209,7 +209,7 @@ fn gen_when_one_branch() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn gen_large_when_int() {
assert_evals_to!(
indoc!(
@ -232,7 +232,7 @@ fn gen_large_when_int() {
}
#[test]
#[cfg(any(feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn gen_large_when_float() {
assert_evals_to!(
indoc!(
@ -255,7 +255,7 @@ fn gen_large_when_float() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn or_pattern() {
assert_evals_to!(
indoc!(
@ -271,7 +271,7 @@ fn or_pattern() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn apply_identity() {
assert_evals_to!(
indoc!(
@ -287,7 +287,7 @@ fn apply_identity() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn apply_unnamed_identity() {
assert_evals_to!(
indoc!(
@ -2144,7 +2144,7 @@ fn rosetree_basic() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn case_jump() {
// the decision tree will generate a jump to the `1` branch here
assert_evals_to!(
@ -2171,7 +2171,7 @@ fn case_jump() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn nullable_eval_cfold() {
// the decision tree will generate a jump to the `1` branch here
assert_evals_to!(
@ -2208,7 +2208,7 @@ fn nullable_eval_cfold() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn nested_switch() {
// exposed bug with passing the right symbol/layout down into switch branch generation
// This is also the only test_gen test that exercises Reset/Reuse (as of Aug 2022)
@ -2252,7 +2252,7 @@ fn nested_switch() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn count_deriv_x() {
// exposed bug with basing the block_of_memory on a specific (smaller) tag layout
assert_evals_to!(
@ -2279,7 +2279,7 @@ fn count_deriv_x() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn deriv_pow() {
// exposed bug with ordering of variable declarations before switch
assert_evals_to!(
@ -2316,7 +2316,7 @@ fn deriv_pow() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn multiple_increment() {
// the `leaf` value will be incremented multiple times at once
assert_evals_to!(
@ -2350,7 +2350,7 @@ fn multiple_increment() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn switch_fuse_rc_non_exhaustive() {
assert_evals_to!(
indoc!(
@ -2380,7 +2380,7 @@ fn switch_fuse_rc_non_exhaustive() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn switch_fuse_rc_exhaustive() {
assert_evals_to!(
indoc!(
@ -2409,7 +2409,7 @@ fn switch_fuse_rc_exhaustive() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn build_then_apply_closure() {
assert_evals_to!(
indoc!(
@ -2429,7 +2429,7 @@ fn build_then_apply_closure() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn expanded_result() {
assert_evals_to!(
indoc!(
@ -2460,7 +2460,7 @@ fn expanded_result() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn backpassing_result() {
assert_evals_to!(
indoc!(
@ -2530,7 +2530,7 @@ fn call_invalid_layout() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn increment_or_double_closure() {
assert_evals_to!(
indoc!(
@ -2568,7 +2568,7 @@ fn increment_or_double_closure() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn module_thunk_is_function() {
assert_evals_to!(
indoc!(
@ -2585,7 +2585,7 @@ fn module_thunk_is_function() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn pass_through_unresolved_type_variable() {
assert_evals_to!(
indoc!(
@ -2608,7 +2608,7 @@ fn pass_through_unresolved_type_variable() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn pattern_match_empty_record() {
assert_evals_to!(
indoc!(
@ -2628,7 +2628,7 @@ fn pattern_match_empty_record() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn pattern_match_unit_tag() {
assert_evals_to!(
indoc!(
@ -2653,7 +2653,7 @@ fn pattern_match_unit_tag() {
// see for why this is disabled on wasm32 https://github.com/roc-lang/roc/issues/1687
#[cfg(not(feature = "gen-llvm-wasm"))]
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn mirror_llvm_alignment_padding() {
// see https://github.com/roc-lang/roc/issues/1569
assert_evals_to!(
@ -2676,7 +2676,7 @@ fn mirror_llvm_alignment_padding() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn lambda_set_bool() {
assert_evals_to!(
indoc!(
@ -2701,7 +2701,7 @@ fn lambda_set_bool() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn lambda_set_byte() {
assert_evals_to!(
indoc!(
@ -2727,7 +2727,7 @@ fn lambda_set_byte() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn lambda_set_struct_byte() {
assert_evals_to!(
indoc!(
@ -2755,7 +2755,7 @@ fn lambda_set_struct_byte() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn lambda_set_enum_byte_byte() {
assert_evals_to!(
indoc!(
@ -2786,7 +2786,7 @@ fn lambda_set_enum_byte_byte() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_walk_until() {
// see https://github.com/roc-lang/roc/issues/1576
assert_evals_to!(
@ -2812,7 +2812,7 @@ fn list_walk_until() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn int_literal_not_specialized_with_annotation() {
// see https://github.com/roc-lang/roc/issues/1600
assert_evals_to!(
@ -2840,7 +2840,7 @@ fn int_literal_not_specialized_with_annotation() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn int_literal_not_specialized_no_annotation() {
// see https://github.com/roc-lang/roc/issues/1600
assert_evals_to!(
@ -2867,7 +2867,7 @@ fn int_literal_not_specialized_no_annotation() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn unresolved_tvar_when_capture_is_unused() {
// see https://github.com/roc-lang/roc/issues/1585
assert_evals_to!(
@ -2913,7 +2913,7 @@ fn value_not_exposed_hits_panic() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn mix_function_and_closure() {
// see https://github.com/roc-lang/roc/pull/1706
assert_evals_to!(
@ -2939,7 +2939,7 @@ fn mix_function_and_closure() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn mix_function_and_closure_level_of_indirection() {
// see https://github.com/roc-lang/roc/pull/1706
assert_evals_to!(
@ -2964,7 +2964,7 @@ fn mix_function_and_closure_level_of_indirection() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
#[cfg_attr(debug_assertions, ignore)] // this test stack-overflows the compiler in debug mode
fn do_pass_bool_byte_closure_layout() {
// see https://github.com/roc-lang/roc/pull/1706
@ -3041,7 +3041,7 @@ fn do_pass_bool_byte_closure_layout() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn nested_rigid_list() {
assert_evals_to!(
indoc!(
@ -3118,7 +3118,7 @@ fn nested_rigid_tag_union() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn call_that_needs_closure_parameter() {
// here both p2 is lifted to the top-level, which means that `list` must be
// passed to it from `manyAux`.
@ -3146,7 +3146,7 @@ fn call_that_needs_closure_parameter() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn alias_defined_out_of_order() {
assert_evals_to!(
indoc!(
@ -3167,7 +3167,7 @@ fn alias_defined_out_of_order() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn recursively_build_effect() {
assert_evals_to!(
indoc!(
@ -3214,7 +3214,7 @@ fn recursively_build_effect() {
#[test]
#[ignore = "TODO; currently generates bad code because `a` isn't specialized inside the closure."]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn polymophic_expression_captured_inside_closure() {
assert_evals_to!(
indoc!(
@ -3238,7 +3238,7 @@ fn polymophic_expression_captured_inside_closure() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn issue_2322() {
assert_evals_to!(
indoc!(
@ -3271,7 +3271,7 @@ fn box_and_unbox_small_string() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn box_and_unbox_big_string() {
assert_evals_to!(
indoc!(
@ -3366,7 +3366,7 @@ fn box_and_unbox_f32() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn box_and_unbox_record() {
assert_evals_to!(
indoc!(
@ -3380,7 +3380,7 @@ fn box_and_unbox_record() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn box_and_unbox_tag_union() {
assert_evals_to!(
indoc!(
@ -3397,7 +3397,7 @@ fn box_and_unbox_tag_union() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn closure_called_in_its_defining_scope() {
assert_evals_to!(
indoc!(
@ -3422,7 +3422,7 @@ fn closure_called_in_its_defining_scope() {
#[test]
#[ignore]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn issue_2894() {
assert_evals_to!(
indoc!(
@ -3449,7 +3449,7 @@ fn issue_2894() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn polymorphic_def_used_in_closure() {
assert_evals_to!(
indoc!(
@ -3470,7 +3470,7 @@ fn polymorphic_def_used_in_closure() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn polymorphic_lambda_set_usage() {
assert_evals_to!(
indoc!(
@ -3488,7 +3488,7 @@ fn polymorphic_lambda_set_usage() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn polymorphic_lambda_set_multiple_specializations() {
assert_evals_to!(
indoc!(
@ -3529,7 +3529,7 @@ fn list_map2_conslist() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn mutual_recursion_top_level_defs() {
assert_evals_to!(
indoc!(
@ -3557,7 +3557,7 @@ fn mutual_recursion_top_level_defs() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn polymorphic_lambda_captures_polymorphic_value() {
assert_evals_to!(
indoc!(
@ -3704,7 +3704,7 @@ fn lambda_capture_niches_have_captured_function_in_closure() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn recursive_call_capturing_function() {
assert_evals_to!(
indoc!(
@ -3723,7 +3723,7 @@ fn recursive_call_capturing_function() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn shared_pattern_variable_in_when_branches() {
assert_evals_to!(
indoc!(
@ -3797,7 +3797,7 @@ fn runtime_error_when_degenerate_pattern_reached() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn recursive_lambda_set_issue_3444() {
assert_evals_to!(
indoc!(
@ -3818,7 +3818,7 @@ fn recursive_lambda_set_issue_3444() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn recursive_lambda_set_toplevel_issue_3444() {
assert_evals_to!(
indoc!(
@ -3842,7 +3842,7 @@ fn recursive_lambda_set_toplevel_issue_3444() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn recursive_lambda_set_issue_3444_inferred() {
assert_evals_to!(
indoc!(
@ -3887,7 +3887,7 @@ fn compose_recursive_lambda_set_productive_toplevel() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn compose_recursive_lambda_set_productive_nested() {
assert_evals_to!(
indoc!(
@ -3909,7 +3909,7 @@ fn compose_recursive_lambda_set_productive_nested() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn compose_recursive_lambda_set_productive_inferred() {
assert_evals_to!(
indoc!(
@ -3958,7 +3958,7 @@ fn compose_recursive_lambda_set_productive_nullable_wrapped() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn local_binding_aliases_function() {
assert_evals_to!(
indoc!(
@ -3981,7 +3981,7 @@ fn local_binding_aliases_function() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn local_binding_aliases_function_inferred() {
assert_evals_to!(
indoc!(
@ -4002,7 +4002,7 @@ fn local_binding_aliases_function_inferred() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn transient_captures() {
assert_evals_to!(
indoc!(
@ -4022,7 +4022,7 @@ fn transient_captures() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn transient_captures_after_def_ordering() {
assert_evals_to!(
indoc!(
@ -4042,7 +4042,7 @@ fn transient_captures_after_def_ordering() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn deep_transient_capture_chain() {
assert_evals_to!(
indoc!(
@ -4064,7 +4064,7 @@ fn deep_transient_capture_chain() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn deep_transient_capture_chain_with_multiple_captures() {
assert_evals_to!(
indoc!(
@ -4089,7 +4089,7 @@ fn deep_transient_capture_chain_with_multiple_captures() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn transient_captures_from_outer_scope() {
assert_evals_to!(
indoc!(
@ -4111,7 +4111,7 @@ fn transient_captures_from_outer_scope() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn mutually_recursive_captures() {
assert_evals_to!(
indoc!(
@ -4137,7 +4137,7 @@ fn mutually_recursive_captures() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn int_let_generalization() {
assert_evals_to!(
indoc!(
@ -4158,7 +4158,7 @@ fn int_let_generalization() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn pattern_match_char() {
assert_evals_to!(
indoc!(
@ -4176,7 +4176,7 @@ fn pattern_match_char() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn issue_4348() {
assert_evals_to!(
indoc!(
@ -4194,7 +4194,7 @@ fn issue_4348() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn issue_4349() {
assert_evals_to!(
indoc!(
@ -4254,7 +4254,7 @@ fn issue_4712() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn pattern_as_toplevel() {
assert_evals_to!(
indoc!(
@ -4275,7 +4275,7 @@ fn pattern_as_toplevel() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn pattern_as_nested() {
assert_evals_to!(
indoc!(
@ -4296,7 +4296,7 @@ fn pattern_as_nested() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn pattern_as_of_symbol() {
assert_evals_to!(
indoc!(
@ -4314,7 +4314,7 @@ fn pattern_as_of_symbol() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn function_specialization_information_in_lambda_set_thunk() {
assert_evals_to!(
indoc!(
@ -4336,7 +4336,7 @@ fn function_specialization_information_in_lambda_set_thunk() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn function_specialization_information_in_lambda_set_thunk_independent_defs() {
assert_evals_to!(
indoc!(
@ -4360,7 +4360,7 @@ fn function_specialization_information_in_lambda_set_thunk_independent_defs() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn when_guard_appears_multiple_times_in_compiled_decision_tree_issue_5176() {
assert_evals_to!(
indoc!(
@ -4383,7 +4383,7 @@ fn when_guard_appears_multiple_times_in_compiled_decision_tree_issue_5176() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn recursive_lambda_set_resolved_only_upon_specialization() {
assert_evals_to!(
indoc!(
@ -4406,7 +4406,7 @@ fn recursive_lambda_set_resolved_only_upon_specialization() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn layout_cache_structure_with_multiple_recursive_structures() {
assert_evals_to!(
indoc!(

View file

@ -1007,7 +1007,7 @@ fn result_never() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn nested_recursive_literal() {
assert_evals_to!(
indoc!(
@ -1027,7 +1027,7 @@ fn nested_recursive_literal() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn newtype_wrapper() {
assert_evals_to!(
indoc!(
@ -1045,13 +1045,17 @@ fn newtype_wrapper() {
"#
),
42,
&i64,
|x: &i64| *x
roc_std::RocBox<i64>,
|x: roc_std::RocBox<i64>| {
let value = *x;
std::mem::forget(x);
value
}
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn applied_tag_function() {
assert_evals_to!(
indoc!(
@ -1068,7 +1072,7 @@ fn applied_tag_function() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn applied_tag_function_result() {
assert_evals_to!(
indoc!(
@ -1085,7 +1089,7 @@ fn applied_tag_function_result() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
#[ignore = "This test has incorrect refcounts: https://github.com/roc-lang/roc/issues/2968"]
fn applied_tag_function_linked_list() {
assert_evals_to!(
@ -1146,7 +1150,7 @@ fn tag_must_be_its_own_type() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn recursive_tag_union_into_flat_tag_union() {
// Comprehensive test for correctness in cli/tests/repl_eval
assert_evals_to!(
@ -1402,7 +1406,7 @@ fn issue_2458() {
#[test]
#[ignore = "See https://github.com/roc-lang/roc/issues/2466"]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn issue_2458_deep_recursion_var() {
assert_evals_to!(
indoc!(
@ -1423,7 +1427,7 @@ fn issue_2458_deep_recursion_var() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn issue_1162() {
assert_evals_to!(
indoc!(
@ -1598,7 +1602,7 @@ fn issue_2900_unreachable_pattern() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn issue_3261_non_nullable_unwrapped_recursive_union_at_index() {
assert_evals_to!(
indoc!(
@ -1619,7 +1623,7 @@ fn issue_3261_non_nullable_unwrapped_recursive_union_at_index() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn instantiate_annotated_as_recursive_alias_toplevel() {
assert_evals_to!(
indoc!(
@ -1646,7 +1650,7 @@ fn instantiate_annotated_as_recursive_alias_toplevel() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn instantiate_annotated_as_recursive_alias_polymorphic_expr() {
assert_evals_to!(
indoc!(
@ -1673,7 +1677,7 @@ fn instantiate_annotated_as_recursive_alias_polymorphic_expr() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn instantiate_annotated_as_recursive_alias_multiple_polymorphic_expr() {
assert_evals_to!(
indoc!(
@ -1802,7 +1806,7 @@ fn error_type_in_tag_union_payload() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn issue_3653_recursion_pointer_in_naked_opaque() {
assert_evals_to!(
indoc!(
@ -1827,7 +1831,7 @@ fn issue_3653_recursion_pointer_in_naked_opaque() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn issue_3653_recursion_pointer_in_naked_opaque_localized() {
assert_evals_to!(
indoc!(
@ -1852,7 +1856,7 @@ fn issue_3653_recursion_pointer_in_naked_opaque_localized() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn issue_2165_recursive_tag_destructure() {
assert_evals_to!(
indoc!(
@ -1894,7 +1898,7 @@ fn tag_union_let_generalization() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn fit_recursive_union_in_struct_into_recursive_pointer() {
assert_evals_to!(
indoc!(
@ -1957,7 +1961,7 @@ fn dispatch_tag_union_function_inferred() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn issue_4077_fixed_fixpoint() {
assert_evals_to!(
indoc!(
@ -1982,7 +1986,7 @@ fn issue_4077_fixed_fixpoint() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn unify_types_with_fixed_fixpoints_outside_fixing_region() {
assert_evals_to!(
indoc!(
@ -2041,7 +2045,7 @@ fn lambda_set_with_imported_toplevels_issue_4733() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn non_unary_union_with_lambda_set_with_imported_toplevels_issue_4733() {
assert_evals_to!(
indoc!(
@ -2131,7 +2135,7 @@ fn nullable_wrapped_with_nullable_not_last_index() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn refcount_nullable_unwrapped_needing_no_refcount_issue_5027() {
assert_evals_to!(
indoc!(
@ -2170,7 +2174,7 @@ fn refcount_nullable_unwrapped_needing_no_refcount_issue_5027() {
}
#[test]
#[cfg(any(feature = "gen-llvm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn issue_5162_recast_nested_nullable_unwrapped_layout() {
with_larger_debug_stack(|| {
assert_evals_to!(
@ -2198,7 +2202,7 @@ fn issue_5162_recast_nested_nullable_unwrapped_layout() {
}
#[test]
#[cfg(any(feature = "gen-llvm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn nullable_wrapped_eq_issue_5434() {
assert_evals_to!(
indoc!(
@ -2218,12 +2222,87 @@ fn nullable_wrapped_eq_issue_5434() {
y : Value
y = B 0
if x == y then
"OK"
Bool.true
else
"FAIL"
Bool.false
"###
),
RocStr::from("FAIL"),
false,
bool
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn recursive_tag_id_in_allocation_basic() {
assert_evals_to!(
indoc!(
r###"
app "test" provides [main] to "./platform"
Value : [
A Value,
B I64,
C I64,
D I64,
E I64,
F I64,
G I64,
H I64,
I I64,
]
x : Value
x = H 42
main =
when x is
A _ -> "A"
B _ -> "B"
C _ -> "C"
D _ -> "D"
E _ -> "E"
F _ -> "F"
G _ -> "G"
H _ -> "H"
I _ -> "I"
"###
),
RocStr::from("H"),
RocStr
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn recursive_tag_id_in_allocation_eq() {
assert_evals_to!(
indoc!(
r###"
app "test" provides [main] to "./platform"
Value : [
A Value,
B I64,
C I64,
D I64,
E I64,
F I64,
G I64,
H I64,
I I64,
]
x : Value
x = G 42
y : Value
y = H 42
main = (x == x) && (x != y) && (y == y)
"###
),
true,
bool
);
}

View file

@ -6,187 +6,17 @@ procedure Encode.23 (Encode.98):
ret Encode.98;
procedure Encode.24 (Encode.99, Encode.107, Encode.101):
let Encode.111 : List U8 = CallByName Json.181 Encode.99 Encode.101 Encode.107;
let Encode.111 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107;
ret Encode.111;
procedure Encode.26 (Encode.105, Encode.106):
let Encode.109 : List U8 = Array [];
let Encode.110 : Str = CallByName Json.24 Encode.105;
let Encode.110 : Str = CallByName TotallyNotJson.25 Encode.105;
let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106;
ret Encode.108;
procedure Json.1 ():
let Json.1171 : [C , C [], C , C , C , C ] = TagId(2) ;
ret Json.1171;
procedure Json.181 (Json.182, Json.1174, Json.180):
let Json.1177 : List U8 = CallByName Json.25 Json.180;
let Json.1176 : List U8 = CallByName List.8 Json.182 Json.1177;
ret Json.1176;
procedure Json.188 (Json.1225, Json.191):
let Json.189 : U64 = StructAtIndex 0 Json.1225;
let Json.190 : Int1 = StructAtIndex 1 Json.1225;
switch Json.191:
case 34:
let Json.1228 : Int1 = false;
let Json.1227 : {U64, Int1} = Struct {Json.189, Json.1228};
let Json.1226 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1227;
ret Json.1226;
case 92:
let Json.1231 : Int1 = false;
let Json.1230 : {U64, Int1} = Struct {Json.189, Json.1231};
let Json.1229 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1230;
ret Json.1229;
case 47:
let Json.1234 : Int1 = false;
let Json.1233 : {U64, Int1} = Struct {Json.189, Json.1234};
let Json.1232 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1233;
ret Json.1232;
case 8:
let Json.1237 : Int1 = false;
let Json.1236 : {U64, Int1} = Struct {Json.189, Json.1237};
let Json.1235 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1236;
ret Json.1235;
case 12:
let Json.1240 : Int1 = false;
let Json.1239 : {U64, Int1} = Struct {Json.189, Json.1240};
let Json.1238 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1239;
ret Json.1238;
case 10:
let Json.1243 : Int1 = false;
let Json.1242 : {U64, Int1} = Struct {Json.189, Json.1243};
let Json.1241 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1242;
ret Json.1241;
case 13:
let Json.1246 : Int1 = false;
let Json.1245 : {U64, Int1} = Struct {Json.189, Json.1246};
let Json.1244 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1245;
ret Json.1244;
case 9:
let Json.1249 : Int1 = false;
let Json.1248 : {U64, Int1} = Struct {Json.189, Json.1249};
let Json.1247 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1248;
ret Json.1247;
default:
let Json.1253 : U64 = 1i64;
let Json.1252 : U64 = CallByName Num.19 Json.189 Json.1253;
let Json.1251 : {U64, Int1} = Struct {Json.1252, Json.190};
let Json.1250 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) Json.1251;
ret Json.1250;
procedure Json.214 (Json.215, Json.216):
let Json.1196 : List U8 = CallByName Json.26 Json.216;
let Json.1195 : List U8 = CallByName List.8 Json.215 Json.1196;
ret Json.1195;
procedure Json.24 (Json.180):
let Json.1172 : Str = CallByName Encode.23 Json.180;
ret Json.1172;
procedure Json.25 (Json.183):
let Json.184 : List U8 = CallByName Str.12 Json.183;
let Json.1254 : U64 = 0i64;
let Json.1255 : Int1 = true;
let Json.185 : {U64, Int1} = Struct {Json.1254, Json.1255};
let Json.1224 : {} = Struct {};
inc Json.184;
let Json.186 : {U64, Int1} = CallByName List.26 Json.184 Json.185 Json.1224;
let Json.1178 : Int1 = StructAtIndex 1 Json.186;
let Json.1222 : Int1 = true;
let Json.1223 : Int1 = lowlevel Eq Json.1222 Json.1178;
if Json.1223 then
let Json.1188 : U64 = CallByName List.6 Json.184;
let Json.1189 : U64 = 2i64;
let Json.1187 : U64 = CallByName Num.19 Json.1188 Json.1189;
let Json.1184 : List U8 = CallByName List.68 Json.1187;
let Json.1186 : U8 = 34i64;
let Json.1185 : List U8 = Array [Json.1186];
let Json.1183 : List U8 = CallByName List.8 Json.1184 Json.1185;
let Json.1180 : List U8 = CallByName List.8 Json.1183 Json.184;
let Json.1182 : U8 = 34i64;
let Json.1181 : List U8 = Array [Json.1182];
let Json.1179 : List U8 = CallByName List.8 Json.1180 Json.1181;
ret Json.1179;
else
inc Json.184;
let Json.1221 : U64 = StructAtIndex 0 Json.186;
let Json.1220 : {List U8, List U8} = CallByName List.52 Json.184 Json.1221;
let Json.210 : List U8 = StructAtIndex 0 Json.1220;
let Json.212 : List U8 = StructAtIndex 1 Json.1220;
let Json.1218 : U64 = CallByName List.6 Json.184;
dec Json.184;
let Json.1219 : U64 = 120i64;
let Json.1216 : U64 = CallByName Num.21 Json.1218 Json.1219;
let Json.1217 : U64 = 100i64;
let Json.1215 : U64 = CallByName Num.94 Json.1216 Json.1217;
let Json.1212 : List U8 = CallByName List.68 Json.1215;
let Json.1214 : U8 = 34i64;
let Json.1213 : List U8 = Array [Json.1214];
let Json.1211 : List U8 = CallByName List.8 Json.1212 Json.1213;
let Json.213 : List U8 = CallByName List.8 Json.1211 Json.210;
let Json.1194 : {} = Struct {};
let Json.1191 : List U8 = CallByName List.18 Json.212 Json.213 Json.1194;
let Json.1193 : U8 = 34i64;
let Json.1192 : List U8 = Array [Json.1193];
let Json.1190 : List U8 = CallByName List.8 Json.1191 Json.1192;
ret Json.1190;
procedure Json.26 (Json.217):
switch Json.217:
case 34:
let Json.1197 : List U8 = Array [92i64, 34i64];
ret Json.1197;
case 92:
let Json.1198 : List U8 = Array [92i64, 92i64];
ret Json.1198;
case 47:
let Json.1199 : List U8 = Array [92i64, 47i64];
ret Json.1199;
case 8:
let Json.1201 : U8 = 98i64;
let Json.1200 : List U8 = Array [92i64, Json.1201];
ret Json.1200;
case 12:
let Json.1203 : U8 = 102i64;
let Json.1202 : List U8 = Array [92i64, Json.1203];
ret Json.1202;
case 10:
let Json.1205 : U8 = 110i64;
let Json.1204 : List U8 = Array [92i64, Json.1205];
ret Json.1204;
case 13:
let Json.1207 : U8 = 114i64;
let Json.1206 : List U8 = Array [92i64, Json.1207];
ret Json.1206;
case 9:
let Json.1209 : U8 = 114i64;
let Json.1208 : List U8 = Array [92i64, Json.1209];
ret Json.1208;
default:
let Json.1210 : List U8 = Array [Json.217];
ret Json.1210;
procedure List.145 (List.146, List.147, List.144):
let List.553 : List U8 = CallByName Json.214 List.146 List.147;
let List.553 : List U8 = CallByName TotallyNotJson.215 List.146 List.147;
ret List.553;
procedure List.18 (List.142, List.143, List.144):
@ -278,7 +108,7 @@ procedure List.80 (List.621, List.622, List.623, List.624, List.625):
let List.581 : Int1 = CallByName Num.22 List.442 List.443;
if List.581 then
let List.590 : U8 = CallByName List.66 List.439 List.442;
let List.582 : [C {U64, Int1}, C {U64, Int1}] = CallByName Json.188 List.440 List.590;
let List.582 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.440 List.590;
let List.587 : U8 = 1i64;
let List.588 : U8 = GetTagId List.582;
let List.589 : Int1 = lowlevel Eq List.587 List.588;
@ -361,9 +191,179 @@ procedure Str.9 (Str.79):
let Str.298 : [C {U64, U8}, C Str] = TagId(0) Str.299;
ret Str.298;
procedure TotallyNotJson.182 (TotallyNotJson.183, TotallyNotJson.1175, TotallyNotJson.181):
let TotallyNotJson.1178 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.181;
let TotallyNotJson.1177 : List U8 = CallByName List.8 TotallyNotJson.183 TotallyNotJson.1178;
ret TotallyNotJson.1177;
procedure TotallyNotJson.189 (TotallyNotJson.1226, TotallyNotJson.192):
let TotallyNotJson.190 : U64 = StructAtIndex 0 TotallyNotJson.1226;
let TotallyNotJson.191 : Int1 = StructAtIndex 1 TotallyNotJson.1226;
switch TotallyNotJson.192:
case 34:
let TotallyNotJson.1229 : Int1 = false;
let TotallyNotJson.1228 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1229};
let TotallyNotJson.1227 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1228;
ret TotallyNotJson.1227;
case 92:
let TotallyNotJson.1232 : Int1 = false;
let TotallyNotJson.1231 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1232};
let TotallyNotJson.1230 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1231;
ret TotallyNotJson.1230;
case 47:
let TotallyNotJson.1235 : Int1 = false;
let TotallyNotJson.1234 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1235};
let TotallyNotJson.1233 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1234;
ret TotallyNotJson.1233;
case 8:
let TotallyNotJson.1238 : Int1 = false;
let TotallyNotJson.1237 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1238};
let TotallyNotJson.1236 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1237;
ret TotallyNotJson.1236;
case 12:
let TotallyNotJson.1241 : Int1 = false;
let TotallyNotJson.1240 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1241};
let TotallyNotJson.1239 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1240;
ret TotallyNotJson.1239;
case 10:
let TotallyNotJson.1244 : Int1 = false;
let TotallyNotJson.1243 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1244};
let TotallyNotJson.1242 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1243;
ret TotallyNotJson.1242;
case 13:
let TotallyNotJson.1247 : Int1 = false;
let TotallyNotJson.1246 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1247};
let TotallyNotJson.1245 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1246;
ret TotallyNotJson.1245;
case 9:
let TotallyNotJson.1250 : Int1 = false;
let TotallyNotJson.1249 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1250};
let TotallyNotJson.1248 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1249;
ret TotallyNotJson.1248;
default:
let TotallyNotJson.1254 : U64 = 1i64;
let TotallyNotJson.1253 : U64 = CallByName Num.19 TotallyNotJson.190 TotallyNotJson.1254;
let TotallyNotJson.1252 : {U64, Int1} = Struct {TotallyNotJson.1253, TotallyNotJson.191};
let TotallyNotJson.1251 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) TotallyNotJson.1252;
ret TotallyNotJson.1251;
procedure TotallyNotJson.2 ():
let TotallyNotJson.1172 : [C , C [], C , C , C , C ] = TagId(2) ;
ret TotallyNotJson.1172;
procedure TotallyNotJson.215 (TotallyNotJson.216, TotallyNotJson.217):
let TotallyNotJson.1197 : List U8 = CallByName TotallyNotJson.27 TotallyNotJson.217;
let TotallyNotJson.1196 : List U8 = CallByName List.8 TotallyNotJson.216 TotallyNotJson.1197;
ret TotallyNotJson.1196;
procedure TotallyNotJson.25 (TotallyNotJson.181):
let TotallyNotJson.1173 : Str = CallByName Encode.23 TotallyNotJson.181;
ret TotallyNotJson.1173;
procedure TotallyNotJson.26 (TotallyNotJson.184):
let TotallyNotJson.185 : List U8 = CallByName Str.12 TotallyNotJson.184;
let TotallyNotJson.1255 : U64 = 0i64;
let TotallyNotJson.1256 : Int1 = true;
let TotallyNotJson.186 : {U64, Int1} = Struct {TotallyNotJson.1255, TotallyNotJson.1256};
let TotallyNotJson.1225 : {} = Struct {};
inc TotallyNotJson.185;
let TotallyNotJson.187 : {U64, Int1} = CallByName List.26 TotallyNotJson.185 TotallyNotJson.186 TotallyNotJson.1225;
let TotallyNotJson.1179 : Int1 = StructAtIndex 1 TotallyNotJson.187;
let TotallyNotJson.1223 : Int1 = true;
let TotallyNotJson.1224 : Int1 = lowlevel Eq TotallyNotJson.1223 TotallyNotJson.1179;
if TotallyNotJson.1224 then
let TotallyNotJson.1189 : U64 = CallByName List.6 TotallyNotJson.185;
let TotallyNotJson.1190 : U64 = 2i64;
let TotallyNotJson.1188 : U64 = CallByName Num.19 TotallyNotJson.1189 TotallyNotJson.1190;
let TotallyNotJson.1185 : List U8 = CallByName List.68 TotallyNotJson.1188;
let TotallyNotJson.1187 : U8 = 34i64;
let TotallyNotJson.1186 : List U8 = Array [TotallyNotJson.1187];
let TotallyNotJson.1184 : List U8 = CallByName List.8 TotallyNotJson.1185 TotallyNotJson.1186;
let TotallyNotJson.1181 : List U8 = CallByName List.8 TotallyNotJson.1184 TotallyNotJson.185;
let TotallyNotJson.1183 : U8 = 34i64;
let TotallyNotJson.1182 : List U8 = Array [TotallyNotJson.1183];
let TotallyNotJson.1180 : List U8 = CallByName List.8 TotallyNotJson.1181 TotallyNotJson.1182;
ret TotallyNotJson.1180;
else
inc TotallyNotJson.185;
let TotallyNotJson.1222 : U64 = StructAtIndex 0 TotallyNotJson.187;
let TotallyNotJson.1221 : {List U8, List U8} = CallByName List.52 TotallyNotJson.185 TotallyNotJson.1222;
let TotallyNotJson.211 : List U8 = StructAtIndex 0 TotallyNotJson.1221;
let TotallyNotJson.213 : List U8 = StructAtIndex 1 TotallyNotJson.1221;
let TotallyNotJson.1219 : U64 = CallByName List.6 TotallyNotJson.185;
dec TotallyNotJson.185;
let TotallyNotJson.1220 : U64 = 120i64;
let TotallyNotJson.1217 : U64 = CallByName Num.21 TotallyNotJson.1219 TotallyNotJson.1220;
let TotallyNotJson.1218 : U64 = 100i64;
let TotallyNotJson.1216 : U64 = CallByName Num.94 TotallyNotJson.1217 TotallyNotJson.1218;
let TotallyNotJson.1213 : List U8 = CallByName List.68 TotallyNotJson.1216;
let TotallyNotJson.1215 : U8 = 34i64;
let TotallyNotJson.1214 : List U8 = Array [TotallyNotJson.1215];
let TotallyNotJson.1212 : List U8 = CallByName List.8 TotallyNotJson.1213 TotallyNotJson.1214;
let TotallyNotJson.214 : List U8 = CallByName List.8 TotallyNotJson.1212 TotallyNotJson.211;
let TotallyNotJson.1195 : {} = Struct {};
let TotallyNotJson.1192 : List U8 = CallByName List.18 TotallyNotJson.213 TotallyNotJson.214 TotallyNotJson.1195;
let TotallyNotJson.1194 : U8 = 34i64;
let TotallyNotJson.1193 : List U8 = Array [TotallyNotJson.1194];
let TotallyNotJson.1191 : List U8 = CallByName List.8 TotallyNotJson.1192 TotallyNotJson.1193;
ret TotallyNotJson.1191;
procedure TotallyNotJson.27 (TotallyNotJson.218):
switch TotallyNotJson.218:
case 34:
let TotallyNotJson.1198 : List U8 = Array [92i64, 34i64];
ret TotallyNotJson.1198;
case 92:
let TotallyNotJson.1199 : List U8 = Array [92i64, 92i64];
ret TotallyNotJson.1199;
case 47:
let TotallyNotJson.1200 : List U8 = Array [92i64, 47i64];
ret TotallyNotJson.1200;
case 8:
let TotallyNotJson.1202 : U8 = 98i64;
let TotallyNotJson.1201 : List U8 = Array [92i64, TotallyNotJson.1202];
ret TotallyNotJson.1201;
case 12:
let TotallyNotJson.1204 : U8 = 102i64;
let TotallyNotJson.1203 : List U8 = Array [92i64, TotallyNotJson.1204];
ret TotallyNotJson.1203;
case 10:
let TotallyNotJson.1206 : U8 = 110i64;
let TotallyNotJson.1205 : List U8 = Array [92i64, TotallyNotJson.1206];
ret TotallyNotJson.1205;
case 13:
let TotallyNotJson.1208 : U8 = 114i64;
let TotallyNotJson.1207 : List U8 = Array [92i64, TotallyNotJson.1208];
ret TotallyNotJson.1207;
case 9:
let TotallyNotJson.1210 : U8 = 114i64;
let TotallyNotJson.1209 : List U8 = Array [92i64, TotallyNotJson.1210];
ret TotallyNotJson.1209;
default:
let TotallyNotJson.1211 : List U8 = Array [TotallyNotJson.218];
ret TotallyNotJson.1211;
procedure Test.0 ():
let Test.9 : Str = "abc";
let Test.10 : [C , C [], C , C , C , C ] = CallByName Json.1;
let Test.10 : [C , C [], C , C , C , C ] = CallByName TotallyNotJson.2;
let Test.8 : List U8 = CallByName Encode.26 Test.9 Test.10;
let Test.1 : [C {U64, U8}, C Str] = CallByName Str.9 Test.8;
let Test.5 : U8 = 1i64;

View file

@ -8,9 +8,9 @@ procedure #Derived.3 (#Derived.4, #Derived.5, #Derived.1):
ret #Derived_gen.3;
in
let #Derived_gen.7 : Str = "A";
let #Derived_gen.9 : Str = CallByName Json.24 #Derived.1;
let #Derived_gen.9 : Str = CallByName TotallyNotJson.25 #Derived.1;
let #Derived_gen.8 : List Str = Array [#Derived_gen.9];
let #Derived_gen.6 : {Str, List Str} = CallByName Json.31 #Derived_gen.7 #Derived_gen.8;
let #Derived_gen.6 : {Str, List Str} = CallByName TotallyNotJson.32 #Derived_gen.7 #Derived_gen.8;
jump #Derived_gen.5 #Derived_gen.6;
procedure Bool.11 (#Attr.2, #Attr.3):
@ -31,11 +31,11 @@ procedure Encode.24 (Encode.99, Encode.107, Encode.101):
ret Encode.111;
procedure Encode.24 (Encode.99, Encode.107, Encode.101):
let Encode.118 : List U8 = CallByName Json.263 Encode.99 Encode.101 Encode.107;
let Encode.118 : List U8 = CallByName TotallyNotJson.264 Encode.99 Encode.101 Encode.107;
ret Encode.118;
procedure Encode.24 (Encode.99, Encode.107, Encode.101):
let Encode.121 : List U8 = CallByName Json.181 Encode.99 Encode.101 Encode.107;
let Encode.121 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107;
ret Encode.121;
procedure Encode.26 (Encode.105, Encode.106):
@ -44,239 +44,12 @@ procedure Encode.26 (Encode.105, Encode.106):
let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106;
ret Encode.108;
procedure Json.1 ():
let Json.1171 : [C , C [], C , C , C , C ] = TagId(2) ;
ret Json.1171;
procedure Json.181 (Json.182, Json.1215, Json.180):
let Json.1218 : List U8 = CallByName Json.25 Json.180;
let Json.1217 : List U8 = CallByName List.8 Json.182 Json.1218;
ret Json.1217;
procedure Json.188 (Json.1266, Json.191):
let Json.189 : U64 = StructAtIndex 0 Json.1266;
let Json.190 : Int1 = StructAtIndex 1 Json.1266;
switch Json.191:
case 34:
let Json.1269 : Int1 = false;
let Json.1268 : {U64, Int1} = Struct {Json.189, Json.1269};
let Json.1267 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1268;
ret Json.1267;
case 92:
let Json.1272 : Int1 = false;
let Json.1271 : {U64, Int1} = Struct {Json.189, Json.1272};
let Json.1270 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1271;
ret Json.1270;
case 47:
let Json.1275 : Int1 = false;
let Json.1274 : {U64, Int1} = Struct {Json.189, Json.1275};
let Json.1273 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1274;
ret Json.1273;
case 8:
let Json.1278 : Int1 = false;
let Json.1277 : {U64, Int1} = Struct {Json.189, Json.1278};
let Json.1276 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1277;
ret Json.1276;
case 12:
let Json.1281 : Int1 = false;
let Json.1280 : {U64, Int1} = Struct {Json.189, Json.1281};
let Json.1279 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1280;
ret Json.1279;
case 10:
let Json.1284 : Int1 = false;
let Json.1283 : {U64, Int1} = Struct {Json.189, Json.1284};
let Json.1282 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1283;
ret Json.1282;
case 13:
let Json.1287 : Int1 = false;
let Json.1286 : {U64, Int1} = Struct {Json.189, Json.1287};
let Json.1285 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1286;
ret Json.1285;
case 9:
let Json.1290 : Int1 = false;
let Json.1289 : {U64, Int1} = Struct {Json.189, Json.1290};
let Json.1288 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1289;
ret Json.1288;
default:
let Json.1294 : U64 = 1i64;
let Json.1293 : U64 = CallByName Num.19 Json.189 Json.1294;
let Json.1292 : {U64, Int1} = Struct {Json.1293, Json.190};
let Json.1291 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) Json.1292;
ret Json.1291;
procedure Json.214 (Json.215, Json.216):
let Json.1237 : List U8 = CallByName Json.26 Json.216;
let Json.1236 : List U8 = CallByName List.8 Json.215 Json.1237;
ret Json.1236;
procedure Json.24 (Json.180):
let Json.1213 : Str = CallByName Encode.23 Json.180;
ret Json.1213;
procedure Json.25 (Json.183):
let Json.184 : List U8 = CallByName Str.12 Json.183;
let Json.1295 : U64 = 0i64;
let Json.1296 : Int1 = true;
let Json.185 : {U64, Int1} = Struct {Json.1295, Json.1296};
let Json.1265 : {} = Struct {};
inc Json.184;
let Json.186 : {U64, Int1} = CallByName List.26 Json.184 Json.185 Json.1265;
let Json.1219 : Int1 = StructAtIndex 1 Json.186;
let Json.1263 : Int1 = true;
let Json.1264 : Int1 = lowlevel Eq Json.1263 Json.1219;
if Json.1264 then
let Json.1229 : U64 = CallByName List.6 Json.184;
let Json.1230 : U64 = 2i64;
let Json.1228 : U64 = CallByName Num.19 Json.1229 Json.1230;
let Json.1225 : List U8 = CallByName List.68 Json.1228;
let Json.1227 : U8 = 34i64;
let Json.1226 : List U8 = Array [Json.1227];
let Json.1224 : List U8 = CallByName List.8 Json.1225 Json.1226;
let Json.1221 : List U8 = CallByName List.8 Json.1224 Json.184;
let Json.1223 : U8 = 34i64;
let Json.1222 : List U8 = Array [Json.1223];
let Json.1220 : List U8 = CallByName List.8 Json.1221 Json.1222;
ret Json.1220;
else
inc Json.184;
let Json.1262 : U64 = StructAtIndex 0 Json.186;
let Json.1261 : {List U8, List U8} = CallByName List.52 Json.184 Json.1262;
let Json.210 : List U8 = StructAtIndex 0 Json.1261;
let Json.212 : List U8 = StructAtIndex 1 Json.1261;
let Json.1259 : U64 = CallByName List.6 Json.184;
dec Json.184;
let Json.1260 : U64 = 120i64;
let Json.1257 : U64 = CallByName Num.21 Json.1259 Json.1260;
let Json.1258 : U64 = 100i64;
let Json.1256 : U64 = CallByName Num.94 Json.1257 Json.1258;
let Json.1253 : List U8 = CallByName List.68 Json.1256;
let Json.1255 : U8 = 34i64;
let Json.1254 : List U8 = Array [Json.1255];
let Json.1252 : List U8 = CallByName List.8 Json.1253 Json.1254;
let Json.213 : List U8 = CallByName List.8 Json.1252 Json.210;
let Json.1235 : {} = Struct {};
let Json.1232 : List U8 = CallByName List.18 Json.212 Json.213 Json.1235;
let Json.1234 : U8 = 34i64;
let Json.1233 : List U8 = Array [Json.1234];
let Json.1231 : List U8 = CallByName List.8 Json.1232 Json.1233;
ret Json.1231;
procedure Json.26 (Json.217):
switch Json.217:
case 34:
let Json.1238 : List U8 = Array [92i64, 34i64];
ret Json.1238;
case 92:
let Json.1239 : List U8 = Array [92i64, 92i64];
ret Json.1239;
case 47:
let Json.1240 : List U8 = Array [92i64, 47i64];
ret Json.1240;
case 8:
let Json.1242 : U8 = 98i64;
let Json.1241 : List U8 = Array [92i64, Json.1242];
ret Json.1241;
case 12:
let Json.1244 : U8 = 102i64;
let Json.1243 : List U8 = Array [92i64, Json.1244];
ret Json.1243;
case 10:
let Json.1246 : U8 = 110i64;
let Json.1245 : List U8 = Array [92i64, Json.1246];
ret Json.1245;
case 13:
let Json.1248 : U8 = 114i64;
let Json.1247 : List U8 = Array [92i64, Json.1248];
ret Json.1247;
case 9:
let Json.1250 : U8 = 114i64;
let Json.1249 : List U8 = Array [92i64, Json.1250];
ret Json.1249;
default:
let Json.1251 : List U8 = Array [Json.217];
ret Json.1251;
procedure Json.263 (Json.264, Json.1174, #Attr.12):
let Json.262 : List Str = StructAtIndex 1 #Attr.12;
let Json.261 : Str = StructAtIndex 0 #Attr.12;
let Json.1212 : I64 = 123i64;
let Json.1211 : U8 = CallByName Num.127 Json.1212;
let Json.1208 : List U8 = CallByName List.4 Json.264 Json.1211;
let Json.1210 : I64 = 34i64;
let Json.1209 : U8 = CallByName Num.127 Json.1210;
let Json.1206 : List U8 = CallByName List.4 Json.1208 Json.1209;
let Json.1207 : List U8 = CallByName Str.12 Json.261;
let Json.1203 : List U8 = CallByName List.8 Json.1206 Json.1207;
let Json.1205 : I64 = 34i64;
let Json.1204 : U8 = CallByName Num.127 Json.1205;
let Json.1200 : List U8 = CallByName List.4 Json.1203 Json.1204;
let Json.1202 : I64 = 58i64;
let Json.1201 : U8 = CallByName Num.127 Json.1202;
let Json.1197 : List U8 = CallByName List.4 Json.1200 Json.1201;
let Json.1199 : I64 = 91i64;
let Json.1198 : U8 = CallByName Num.127 Json.1199;
let Json.267 : List U8 = CallByName List.4 Json.1197 Json.1198;
let Json.1196 : U64 = CallByName List.6 Json.262;
let Json.1184 : {List U8, U64} = Struct {Json.267, Json.1196};
let Json.1183 : {List U8, U64} = CallByName List.18 Json.262 Json.1184 Json.1174;
let Json.269 : List U8 = StructAtIndex 0 Json.1183;
let Json.1182 : I64 = 93i64;
let Json.1181 : U8 = CallByName Num.127 Json.1182;
let Json.1178 : List U8 = CallByName List.4 Json.269 Json.1181;
let Json.1180 : I64 = 125i64;
let Json.1179 : U8 = CallByName Num.127 Json.1180;
let Json.1177 : List U8 = CallByName List.4 Json.1178 Json.1179;
ret Json.1177;
procedure Json.266 (Json.1176, Json.272, Json.265):
let Json.270 : List U8 = StructAtIndex 0 Json.1176;
let Json.271 : U64 = StructAtIndex 1 Json.1176;
let Json.273 : List U8 = CallByName Encode.24 Json.270 Json.272 Json.265;
joinpoint Json.1190 Json.274:
let Json.1188 : U64 = 1i64;
let Json.1187 : U64 = CallByName Num.20 Json.271 Json.1188;
let Json.1186 : {List U8, U64} = Struct {Json.274, Json.1187};
ret Json.1186;
in
let Json.1194 : U64 = 1i64;
let Json.1191 : Int1 = CallByName Num.24 Json.271 Json.1194;
if Json.1191 then
let Json.1193 : I64 = 44i64;
let Json.1192 : U8 = CallByName Num.127 Json.1193;
let Json.1189 : List U8 = CallByName List.4 Json.273 Json.1192;
jump Json.1190 Json.1189;
else
jump Json.1190 Json.273;
procedure Json.31 (Json.261, Json.262):
let Json.1173 : {Str, List Str} = Struct {Json.261, Json.262};
let Json.1172 : {Str, List Str} = CallByName Encode.23 Json.1173;
ret Json.1172;
procedure List.145 (List.146, List.147, List.144):
let List.568 : {List U8, U64} = CallByName Json.266 List.146 List.147 List.144;
let List.568 : {List U8, U64} = CallByName TotallyNotJson.267 List.146 List.147 List.144;
ret List.568;
procedure List.145 (List.146, List.147, List.144):
let List.588 : List U8 = CallByName Json.214 List.146 List.147;
let List.588 : List U8 = CallByName TotallyNotJson.215 List.146 List.147;
ret List.588;
procedure List.18 (List.142, List.143, List.144):
@ -410,7 +183,7 @@ procedure List.80 (List.693, List.694, List.695, List.696, List.697):
let List.630 : Int1 = CallByName Num.22 List.442 List.443;
if List.630 then
let List.639 : U8 = CallByName List.66 List.439 List.442;
let List.631 : [C {U64, Int1}, C {U64, Int1}] = CallByName Json.188 List.440 List.639;
let List.631 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.440 List.639;
let List.636 : U8 = 1i64;
let List.637 : U8 = GetTagId List.631;
let List.638 : Int1 = lowlevel Eq List.636 List.637;
@ -503,9 +276,236 @@ procedure Str.9 (Str.79):
let Str.298 : [C {U64, U8}, C Str] = TagId(0) Str.299;
ret Str.298;
procedure TotallyNotJson.182 (TotallyNotJson.183, TotallyNotJson.1216, TotallyNotJson.181):
let TotallyNotJson.1219 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.181;
let TotallyNotJson.1218 : List U8 = CallByName List.8 TotallyNotJson.183 TotallyNotJson.1219;
ret TotallyNotJson.1218;
procedure TotallyNotJson.189 (TotallyNotJson.1267, TotallyNotJson.192):
let TotallyNotJson.190 : U64 = StructAtIndex 0 TotallyNotJson.1267;
let TotallyNotJson.191 : Int1 = StructAtIndex 1 TotallyNotJson.1267;
switch TotallyNotJson.192:
case 34:
let TotallyNotJson.1270 : Int1 = false;
let TotallyNotJson.1269 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1270};
let TotallyNotJson.1268 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1269;
ret TotallyNotJson.1268;
case 92:
let TotallyNotJson.1273 : Int1 = false;
let TotallyNotJson.1272 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1273};
let TotallyNotJson.1271 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1272;
ret TotallyNotJson.1271;
case 47:
let TotallyNotJson.1276 : Int1 = false;
let TotallyNotJson.1275 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1276};
let TotallyNotJson.1274 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1275;
ret TotallyNotJson.1274;
case 8:
let TotallyNotJson.1279 : Int1 = false;
let TotallyNotJson.1278 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1279};
let TotallyNotJson.1277 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1278;
ret TotallyNotJson.1277;
case 12:
let TotallyNotJson.1282 : Int1 = false;
let TotallyNotJson.1281 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1282};
let TotallyNotJson.1280 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1281;
ret TotallyNotJson.1280;
case 10:
let TotallyNotJson.1285 : Int1 = false;
let TotallyNotJson.1284 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1285};
let TotallyNotJson.1283 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1284;
ret TotallyNotJson.1283;
case 13:
let TotallyNotJson.1288 : Int1 = false;
let TotallyNotJson.1287 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1288};
let TotallyNotJson.1286 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1287;
ret TotallyNotJson.1286;
case 9:
let TotallyNotJson.1291 : Int1 = false;
let TotallyNotJson.1290 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1291};
let TotallyNotJson.1289 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1290;
ret TotallyNotJson.1289;
default:
let TotallyNotJson.1295 : U64 = 1i64;
let TotallyNotJson.1294 : U64 = CallByName Num.19 TotallyNotJson.190 TotallyNotJson.1295;
let TotallyNotJson.1293 : {U64, Int1} = Struct {TotallyNotJson.1294, TotallyNotJson.191};
let TotallyNotJson.1292 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) TotallyNotJson.1293;
ret TotallyNotJson.1292;
procedure TotallyNotJson.2 ():
let TotallyNotJson.1172 : [C , C [], C , C , C , C ] = TagId(2) ;
ret TotallyNotJson.1172;
procedure TotallyNotJson.215 (TotallyNotJson.216, TotallyNotJson.217):
let TotallyNotJson.1238 : List U8 = CallByName TotallyNotJson.27 TotallyNotJson.217;
let TotallyNotJson.1237 : List U8 = CallByName List.8 TotallyNotJson.216 TotallyNotJson.1238;
ret TotallyNotJson.1237;
procedure TotallyNotJson.25 (TotallyNotJson.181):
let TotallyNotJson.1214 : Str = CallByName Encode.23 TotallyNotJson.181;
ret TotallyNotJson.1214;
procedure TotallyNotJson.26 (TotallyNotJson.184):
let TotallyNotJson.185 : List U8 = CallByName Str.12 TotallyNotJson.184;
let TotallyNotJson.1296 : U64 = 0i64;
let TotallyNotJson.1297 : Int1 = true;
let TotallyNotJson.186 : {U64, Int1} = Struct {TotallyNotJson.1296, TotallyNotJson.1297};
let TotallyNotJson.1266 : {} = Struct {};
inc TotallyNotJson.185;
let TotallyNotJson.187 : {U64, Int1} = CallByName List.26 TotallyNotJson.185 TotallyNotJson.186 TotallyNotJson.1266;
let TotallyNotJson.1220 : Int1 = StructAtIndex 1 TotallyNotJson.187;
let TotallyNotJson.1264 : Int1 = true;
let TotallyNotJson.1265 : Int1 = lowlevel Eq TotallyNotJson.1264 TotallyNotJson.1220;
if TotallyNotJson.1265 then
let TotallyNotJson.1230 : U64 = CallByName List.6 TotallyNotJson.185;
let TotallyNotJson.1231 : U64 = 2i64;
let TotallyNotJson.1229 : U64 = CallByName Num.19 TotallyNotJson.1230 TotallyNotJson.1231;
let TotallyNotJson.1226 : List U8 = CallByName List.68 TotallyNotJson.1229;
let TotallyNotJson.1228 : U8 = 34i64;
let TotallyNotJson.1227 : List U8 = Array [TotallyNotJson.1228];
let TotallyNotJson.1225 : List U8 = CallByName List.8 TotallyNotJson.1226 TotallyNotJson.1227;
let TotallyNotJson.1222 : List U8 = CallByName List.8 TotallyNotJson.1225 TotallyNotJson.185;
let TotallyNotJson.1224 : U8 = 34i64;
let TotallyNotJson.1223 : List U8 = Array [TotallyNotJson.1224];
let TotallyNotJson.1221 : List U8 = CallByName List.8 TotallyNotJson.1222 TotallyNotJson.1223;
ret TotallyNotJson.1221;
else
inc TotallyNotJson.185;
let TotallyNotJson.1263 : U64 = StructAtIndex 0 TotallyNotJson.187;
let TotallyNotJson.1262 : {List U8, List U8} = CallByName List.52 TotallyNotJson.185 TotallyNotJson.1263;
let TotallyNotJson.211 : List U8 = StructAtIndex 0 TotallyNotJson.1262;
let TotallyNotJson.213 : List U8 = StructAtIndex 1 TotallyNotJson.1262;
let TotallyNotJson.1260 : U64 = CallByName List.6 TotallyNotJson.185;
dec TotallyNotJson.185;
let TotallyNotJson.1261 : U64 = 120i64;
let TotallyNotJson.1258 : U64 = CallByName Num.21 TotallyNotJson.1260 TotallyNotJson.1261;
let TotallyNotJson.1259 : U64 = 100i64;
let TotallyNotJson.1257 : U64 = CallByName Num.94 TotallyNotJson.1258 TotallyNotJson.1259;
let TotallyNotJson.1254 : List U8 = CallByName List.68 TotallyNotJson.1257;
let TotallyNotJson.1256 : U8 = 34i64;
let TotallyNotJson.1255 : List U8 = Array [TotallyNotJson.1256];
let TotallyNotJson.1253 : List U8 = CallByName List.8 TotallyNotJson.1254 TotallyNotJson.1255;
let TotallyNotJson.214 : List U8 = CallByName List.8 TotallyNotJson.1253 TotallyNotJson.211;
let TotallyNotJson.1236 : {} = Struct {};
let TotallyNotJson.1233 : List U8 = CallByName List.18 TotallyNotJson.213 TotallyNotJson.214 TotallyNotJson.1236;
let TotallyNotJson.1235 : U8 = 34i64;
let TotallyNotJson.1234 : List U8 = Array [TotallyNotJson.1235];
let TotallyNotJson.1232 : List U8 = CallByName List.8 TotallyNotJson.1233 TotallyNotJson.1234;
ret TotallyNotJson.1232;
procedure TotallyNotJson.264 (TotallyNotJson.265, TotallyNotJson.1175, #Attr.12):
let TotallyNotJson.263 : List Str = StructAtIndex 1 #Attr.12;
let TotallyNotJson.262 : Str = StructAtIndex 0 #Attr.12;
let TotallyNotJson.1213 : I64 = 123i64;
let TotallyNotJson.1212 : U8 = CallByName Num.127 TotallyNotJson.1213;
let TotallyNotJson.1209 : List U8 = CallByName List.4 TotallyNotJson.265 TotallyNotJson.1212;
let TotallyNotJson.1211 : I64 = 34i64;
let TotallyNotJson.1210 : U8 = CallByName Num.127 TotallyNotJson.1211;
let TotallyNotJson.1207 : List U8 = CallByName List.4 TotallyNotJson.1209 TotallyNotJson.1210;
let TotallyNotJson.1208 : List U8 = CallByName Str.12 TotallyNotJson.262;
let TotallyNotJson.1204 : List U8 = CallByName List.8 TotallyNotJson.1207 TotallyNotJson.1208;
let TotallyNotJson.1206 : I64 = 34i64;
let TotallyNotJson.1205 : U8 = CallByName Num.127 TotallyNotJson.1206;
let TotallyNotJson.1201 : List U8 = CallByName List.4 TotallyNotJson.1204 TotallyNotJson.1205;
let TotallyNotJson.1203 : I64 = 58i64;
let TotallyNotJson.1202 : U8 = CallByName Num.127 TotallyNotJson.1203;
let TotallyNotJson.1198 : List U8 = CallByName List.4 TotallyNotJson.1201 TotallyNotJson.1202;
let TotallyNotJson.1200 : I64 = 91i64;
let TotallyNotJson.1199 : U8 = CallByName Num.127 TotallyNotJson.1200;
let TotallyNotJson.268 : List U8 = CallByName List.4 TotallyNotJson.1198 TotallyNotJson.1199;
let TotallyNotJson.1197 : U64 = CallByName List.6 TotallyNotJson.263;
let TotallyNotJson.1185 : {List U8, U64} = Struct {TotallyNotJson.268, TotallyNotJson.1197};
let TotallyNotJson.1184 : {List U8, U64} = CallByName List.18 TotallyNotJson.263 TotallyNotJson.1185 TotallyNotJson.1175;
let TotallyNotJson.270 : List U8 = StructAtIndex 0 TotallyNotJson.1184;
let TotallyNotJson.1183 : I64 = 93i64;
let TotallyNotJson.1182 : U8 = CallByName Num.127 TotallyNotJson.1183;
let TotallyNotJson.1179 : List U8 = CallByName List.4 TotallyNotJson.270 TotallyNotJson.1182;
let TotallyNotJson.1181 : I64 = 125i64;
let TotallyNotJson.1180 : U8 = CallByName Num.127 TotallyNotJson.1181;
let TotallyNotJson.1178 : List U8 = CallByName List.4 TotallyNotJson.1179 TotallyNotJson.1180;
ret TotallyNotJson.1178;
procedure TotallyNotJson.267 (TotallyNotJson.1177, TotallyNotJson.273, TotallyNotJson.266):
let TotallyNotJson.271 : List U8 = StructAtIndex 0 TotallyNotJson.1177;
let TotallyNotJson.272 : U64 = StructAtIndex 1 TotallyNotJson.1177;
let TotallyNotJson.274 : List U8 = CallByName Encode.24 TotallyNotJson.271 TotallyNotJson.273 TotallyNotJson.266;
joinpoint TotallyNotJson.1191 TotallyNotJson.275:
let TotallyNotJson.1189 : U64 = 1i64;
let TotallyNotJson.1188 : U64 = CallByName Num.20 TotallyNotJson.272 TotallyNotJson.1189;
let TotallyNotJson.1187 : {List U8, U64} = Struct {TotallyNotJson.275, TotallyNotJson.1188};
ret TotallyNotJson.1187;
in
let TotallyNotJson.1195 : U64 = 1i64;
let TotallyNotJson.1192 : Int1 = CallByName Num.24 TotallyNotJson.272 TotallyNotJson.1195;
if TotallyNotJson.1192 then
let TotallyNotJson.1194 : I64 = 44i64;
let TotallyNotJson.1193 : U8 = CallByName Num.127 TotallyNotJson.1194;
let TotallyNotJson.1190 : List U8 = CallByName List.4 TotallyNotJson.274 TotallyNotJson.1193;
jump TotallyNotJson.1191 TotallyNotJson.1190;
else
jump TotallyNotJson.1191 TotallyNotJson.274;
procedure TotallyNotJson.27 (TotallyNotJson.218):
switch TotallyNotJson.218:
case 34:
let TotallyNotJson.1239 : List U8 = Array [92i64, 34i64];
ret TotallyNotJson.1239;
case 92:
let TotallyNotJson.1240 : List U8 = Array [92i64, 92i64];
ret TotallyNotJson.1240;
case 47:
let TotallyNotJson.1241 : List U8 = Array [92i64, 47i64];
ret TotallyNotJson.1241;
case 8:
let TotallyNotJson.1243 : U8 = 98i64;
let TotallyNotJson.1242 : List U8 = Array [92i64, TotallyNotJson.1243];
ret TotallyNotJson.1242;
case 12:
let TotallyNotJson.1245 : U8 = 102i64;
let TotallyNotJson.1244 : List U8 = Array [92i64, TotallyNotJson.1245];
ret TotallyNotJson.1244;
case 10:
let TotallyNotJson.1247 : U8 = 110i64;
let TotallyNotJson.1246 : List U8 = Array [92i64, TotallyNotJson.1247];
ret TotallyNotJson.1246;
case 13:
let TotallyNotJson.1249 : U8 = 114i64;
let TotallyNotJson.1248 : List U8 = Array [92i64, TotallyNotJson.1249];
ret TotallyNotJson.1248;
case 9:
let TotallyNotJson.1251 : U8 = 114i64;
let TotallyNotJson.1250 : List U8 = Array [92i64, TotallyNotJson.1251];
ret TotallyNotJson.1250;
default:
let TotallyNotJson.1252 : List U8 = Array [TotallyNotJson.218];
ret TotallyNotJson.1252;
procedure TotallyNotJson.32 (TotallyNotJson.262, TotallyNotJson.263):
let TotallyNotJson.1174 : {Str, List Str} = Struct {TotallyNotJson.262, TotallyNotJson.263};
let TotallyNotJson.1173 : {Str, List Str} = CallByName Encode.23 TotallyNotJson.1174;
ret TotallyNotJson.1173;
procedure Test.0 ():
let Test.12 : Str = "foo";
let Test.11 : [C , C [], C , C , C , C ] = CallByName Json.1;
let Test.11 : [C , C [], C , C , C , C ] = CallByName TotallyNotJson.2;
let Test.10 : List U8 = CallByName Encode.26 Test.12 Test.11;
let Test.2 : [C {U64, U8}, C Str] = CallByName Str.9 Test.10;
let Test.7 : U8 = 1i64;

View file

@ -10,10 +10,10 @@ procedure #Derived.4 (#Derived.5, #Derived.6, #Derived.1):
let #Derived.2 : Str = StructAtIndex 0 #Derived.1;
let #Derived.3 : Str = StructAtIndex 1 #Derived.1;
let #Derived_gen.7 : Str = "A";
let #Derived_gen.9 : Str = CallByName Json.24 #Derived.2;
let #Derived_gen.10 : Str = CallByName Json.24 #Derived.3;
let #Derived_gen.9 : Str = CallByName TotallyNotJson.25 #Derived.2;
let #Derived_gen.10 : Str = CallByName TotallyNotJson.25 #Derived.3;
let #Derived_gen.8 : List Str = Array [#Derived_gen.9, #Derived_gen.10];
let #Derived_gen.6 : {Str, List Str} = CallByName Json.31 #Derived_gen.7 #Derived_gen.8;
let #Derived_gen.6 : {Str, List Str} = CallByName TotallyNotJson.32 #Derived_gen.7 #Derived_gen.8;
jump #Derived_gen.5 #Derived_gen.6;
procedure Bool.11 (#Attr.2, #Attr.3):
@ -34,11 +34,11 @@ procedure Encode.24 (Encode.99, Encode.107, Encode.101):
ret Encode.111;
procedure Encode.24 (Encode.99, Encode.107, Encode.101):
let Encode.118 : List U8 = CallByName Json.263 Encode.99 Encode.101 Encode.107;
let Encode.118 : List U8 = CallByName TotallyNotJson.264 Encode.99 Encode.101 Encode.107;
ret Encode.118;
procedure Encode.24 (Encode.99, Encode.107, Encode.101):
let Encode.122 : List U8 = CallByName Json.181 Encode.99 Encode.101 Encode.107;
let Encode.122 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107;
ret Encode.122;
procedure Encode.26 (Encode.105, Encode.106):
@ -47,239 +47,12 @@ procedure Encode.26 (Encode.105, Encode.106):
let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106;
ret Encode.108;
procedure Json.1 ():
let Json.1171 : [C , C [], C , C , C , C ] = TagId(2) ;
ret Json.1171;
procedure Json.181 (Json.182, Json.1215, Json.180):
let Json.1218 : List U8 = CallByName Json.25 Json.180;
let Json.1217 : List U8 = CallByName List.8 Json.182 Json.1218;
ret Json.1217;
procedure Json.188 (Json.1266, Json.191):
let Json.189 : U64 = StructAtIndex 0 Json.1266;
let Json.190 : Int1 = StructAtIndex 1 Json.1266;
switch Json.191:
case 34:
let Json.1269 : Int1 = false;
let Json.1268 : {U64, Int1} = Struct {Json.189, Json.1269};
let Json.1267 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1268;
ret Json.1267;
case 92:
let Json.1272 : Int1 = false;
let Json.1271 : {U64, Int1} = Struct {Json.189, Json.1272};
let Json.1270 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1271;
ret Json.1270;
case 47:
let Json.1275 : Int1 = false;
let Json.1274 : {U64, Int1} = Struct {Json.189, Json.1275};
let Json.1273 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1274;
ret Json.1273;
case 8:
let Json.1278 : Int1 = false;
let Json.1277 : {U64, Int1} = Struct {Json.189, Json.1278};
let Json.1276 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1277;
ret Json.1276;
case 12:
let Json.1281 : Int1 = false;
let Json.1280 : {U64, Int1} = Struct {Json.189, Json.1281};
let Json.1279 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1280;
ret Json.1279;
case 10:
let Json.1284 : Int1 = false;
let Json.1283 : {U64, Int1} = Struct {Json.189, Json.1284};
let Json.1282 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1283;
ret Json.1282;
case 13:
let Json.1287 : Int1 = false;
let Json.1286 : {U64, Int1} = Struct {Json.189, Json.1287};
let Json.1285 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1286;
ret Json.1285;
case 9:
let Json.1290 : Int1 = false;
let Json.1289 : {U64, Int1} = Struct {Json.189, Json.1290};
let Json.1288 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1289;
ret Json.1288;
default:
let Json.1294 : U64 = 1i64;
let Json.1293 : U64 = CallByName Num.19 Json.189 Json.1294;
let Json.1292 : {U64, Int1} = Struct {Json.1293, Json.190};
let Json.1291 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) Json.1292;
ret Json.1291;
procedure Json.214 (Json.215, Json.216):
let Json.1237 : List U8 = CallByName Json.26 Json.216;
let Json.1236 : List U8 = CallByName List.8 Json.215 Json.1237;
ret Json.1236;
procedure Json.24 (Json.180):
let Json.1297 : Str = CallByName Encode.23 Json.180;
ret Json.1297;
procedure Json.25 (Json.183):
let Json.184 : List U8 = CallByName Str.12 Json.183;
let Json.1295 : U64 = 0i64;
let Json.1296 : Int1 = true;
let Json.185 : {U64, Int1} = Struct {Json.1295, Json.1296};
let Json.1265 : {} = Struct {};
inc Json.184;
let Json.186 : {U64, Int1} = CallByName List.26 Json.184 Json.185 Json.1265;
let Json.1219 : Int1 = StructAtIndex 1 Json.186;
let Json.1263 : Int1 = true;
let Json.1264 : Int1 = lowlevel Eq Json.1263 Json.1219;
if Json.1264 then
let Json.1229 : U64 = CallByName List.6 Json.184;
let Json.1230 : U64 = 2i64;
let Json.1228 : U64 = CallByName Num.19 Json.1229 Json.1230;
let Json.1225 : List U8 = CallByName List.68 Json.1228;
let Json.1227 : U8 = 34i64;
let Json.1226 : List U8 = Array [Json.1227];
let Json.1224 : List U8 = CallByName List.8 Json.1225 Json.1226;
let Json.1221 : List U8 = CallByName List.8 Json.1224 Json.184;
let Json.1223 : U8 = 34i64;
let Json.1222 : List U8 = Array [Json.1223];
let Json.1220 : List U8 = CallByName List.8 Json.1221 Json.1222;
ret Json.1220;
else
inc Json.184;
let Json.1262 : U64 = StructAtIndex 0 Json.186;
let Json.1261 : {List U8, List U8} = CallByName List.52 Json.184 Json.1262;
let Json.210 : List U8 = StructAtIndex 0 Json.1261;
let Json.212 : List U8 = StructAtIndex 1 Json.1261;
let Json.1259 : U64 = CallByName List.6 Json.184;
dec Json.184;
let Json.1260 : U64 = 120i64;
let Json.1257 : U64 = CallByName Num.21 Json.1259 Json.1260;
let Json.1258 : U64 = 100i64;
let Json.1256 : U64 = CallByName Num.94 Json.1257 Json.1258;
let Json.1253 : List U8 = CallByName List.68 Json.1256;
let Json.1255 : U8 = 34i64;
let Json.1254 : List U8 = Array [Json.1255];
let Json.1252 : List U8 = CallByName List.8 Json.1253 Json.1254;
let Json.213 : List U8 = CallByName List.8 Json.1252 Json.210;
let Json.1235 : {} = Struct {};
let Json.1232 : List U8 = CallByName List.18 Json.212 Json.213 Json.1235;
let Json.1234 : U8 = 34i64;
let Json.1233 : List U8 = Array [Json.1234];
let Json.1231 : List U8 = CallByName List.8 Json.1232 Json.1233;
ret Json.1231;
procedure Json.26 (Json.217):
switch Json.217:
case 34:
let Json.1238 : List U8 = Array [92i64, 34i64];
ret Json.1238;
case 92:
let Json.1239 : List U8 = Array [92i64, 92i64];
ret Json.1239;
case 47:
let Json.1240 : List U8 = Array [92i64, 47i64];
ret Json.1240;
case 8:
let Json.1242 : U8 = 98i64;
let Json.1241 : List U8 = Array [92i64, Json.1242];
ret Json.1241;
case 12:
let Json.1244 : U8 = 102i64;
let Json.1243 : List U8 = Array [92i64, Json.1244];
ret Json.1243;
case 10:
let Json.1246 : U8 = 110i64;
let Json.1245 : List U8 = Array [92i64, Json.1246];
ret Json.1245;
case 13:
let Json.1248 : U8 = 114i64;
let Json.1247 : List U8 = Array [92i64, Json.1248];
ret Json.1247;
case 9:
let Json.1250 : U8 = 114i64;
let Json.1249 : List U8 = Array [92i64, Json.1250];
ret Json.1249;
default:
let Json.1251 : List U8 = Array [Json.217];
ret Json.1251;
procedure Json.263 (Json.264, Json.1174, #Attr.12):
let Json.262 : List Str = StructAtIndex 1 #Attr.12;
let Json.261 : Str = StructAtIndex 0 #Attr.12;
let Json.1212 : I64 = 123i64;
let Json.1211 : U8 = CallByName Num.127 Json.1212;
let Json.1208 : List U8 = CallByName List.4 Json.264 Json.1211;
let Json.1210 : I64 = 34i64;
let Json.1209 : U8 = CallByName Num.127 Json.1210;
let Json.1206 : List U8 = CallByName List.4 Json.1208 Json.1209;
let Json.1207 : List U8 = CallByName Str.12 Json.261;
let Json.1203 : List U8 = CallByName List.8 Json.1206 Json.1207;
let Json.1205 : I64 = 34i64;
let Json.1204 : U8 = CallByName Num.127 Json.1205;
let Json.1200 : List U8 = CallByName List.4 Json.1203 Json.1204;
let Json.1202 : I64 = 58i64;
let Json.1201 : U8 = CallByName Num.127 Json.1202;
let Json.1197 : List U8 = CallByName List.4 Json.1200 Json.1201;
let Json.1199 : I64 = 91i64;
let Json.1198 : U8 = CallByName Num.127 Json.1199;
let Json.267 : List U8 = CallByName List.4 Json.1197 Json.1198;
let Json.1196 : U64 = CallByName List.6 Json.262;
let Json.1184 : {List U8, U64} = Struct {Json.267, Json.1196};
let Json.1183 : {List U8, U64} = CallByName List.18 Json.262 Json.1184 Json.1174;
let Json.269 : List U8 = StructAtIndex 0 Json.1183;
let Json.1182 : I64 = 93i64;
let Json.1181 : U8 = CallByName Num.127 Json.1182;
let Json.1178 : List U8 = CallByName List.4 Json.269 Json.1181;
let Json.1180 : I64 = 125i64;
let Json.1179 : U8 = CallByName Num.127 Json.1180;
let Json.1177 : List U8 = CallByName List.4 Json.1178 Json.1179;
ret Json.1177;
procedure Json.266 (Json.1176, Json.272, Json.265):
let Json.270 : List U8 = StructAtIndex 0 Json.1176;
let Json.271 : U64 = StructAtIndex 1 Json.1176;
let Json.273 : List U8 = CallByName Encode.24 Json.270 Json.272 Json.265;
joinpoint Json.1190 Json.274:
let Json.1188 : U64 = 1i64;
let Json.1187 : U64 = CallByName Num.20 Json.271 Json.1188;
let Json.1186 : {List U8, U64} = Struct {Json.274, Json.1187};
ret Json.1186;
in
let Json.1194 : U64 = 1i64;
let Json.1191 : Int1 = CallByName Num.24 Json.271 Json.1194;
if Json.1191 then
let Json.1193 : I64 = 44i64;
let Json.1192 : U8 = CallByName Num.127 Json.1193;
let Json.1189 : List U8 = CallByName List.4 Json.273 Json.1192;
jump Json.1190 Json.1189;
else
jump Json.1190 Json.273;
procedure Json.31 (Json.261, Json.262):
let Json.1173 : {Str, List Str} = Struct {Json.261, Json.262};
let Json.1172 : {Str, List Str} = CallByName Encode.23 Json.1173;
ret Json.1172;
procedure List.145 (List.146, List.147, List.144):
let List.568 : {List U8, U64} = CallByName Json.266 List.146 List.147 List.144;
let List.568 : {List U8, U64} = CallByName TotallyNotJson.267 List.146 List.147 List.144;
ret List.568;
procedure List.145 (List.146, List.147, List.144):
let List.588 : List U8 = CallByName Json.214 List.146 List.147;
let List.588 : List U8 = CallByName TotallyNotJson.215 List.146 List.147;
ret List.588;
procedure List.18 (List.142, List.143, List.144):
@ -413,7 +186,7 @@ procedure List.80 (List.693, List.694, List.695, List.696, List.697):
let List.630 : Int1 = CallByName Num.22 List.442 List.443;
if List.630 then
let List.639 : U8 = CallByName List.66 List.439 List.442;
let List.631 : [C {U64, Int1}, C {U64, Int1}] = CallByName Json.188 List.440 List.639;
let List.631 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.440 List.639;
let List.636 : U8 = 1i64;
let List.637 : U8 = GetTagId List.631;
let List.638 : Int1 = lowlevel Eq List.636 List.637;
@ -506,11 +279,238 @@ procedure Str.9 (Str.79):
let Str.298 : [C {U64, U8}, C Str] = TagId(0) Str.299;
ret Str.298;
procedure TotallyNotJson.182 (TotallyNotJson.183, TotallyNotJson.1216, TotallyNotJson.181):
let TotallyNotJson.1219 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.181;
let TotallyNotJson.1218 : List U8 = CallByName List.8 TotallyNotJson.183 TotallyNotJson.1219;
ret TotallyNotJson.1218;
procedure TotallyNotJson.189 (TotallyNotJson.1267, TotallyNotJson.192):
let TotallyNotJson.190 : U64 = StructAtIndex 0 TotallyNotJson.1267;
let TotallyNotJson.191 : Int1 = StructAtIndex 1 TotallyNotJson.1267;
switch TotallyNotJson.192:
case 34:
let TotallyNotJson.1270 : Int1 = false;
let TotallyNotJson.1269 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1270};
let TotallyNotJson.1268 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1269;
ret TotallyNotJson.1268;
case 92:
let TotallyNotJson.1273 : Int1 = false;
let TotallyNotJson.1272 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1273};
let TotallyNotJson.1271 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1272;
ret TotallyNotJson.1271;
case 47:
let TotallyNotJson.1276 : Int1 = false;
let TotallyNotJson.1275 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1276};
let TotallyNotJson.1274 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1275;
ret TotallyNotJson.1274;
case 8:
let TotallyNotJson.1279 : Int1 = false;
let TotallyNotJson.1278 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1279};
let TotallyNotJson.1277 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1278;
ret TotallyNotJson.1277;
case 12:
let TotallyNotJson.1282 : Int1 = false;
let TotallyNotJson.1281 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1282};
let TotallyNotJson.1280 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1281;
ret TotallyNotJson.1280;
case 10:
let TotallyNotJson.1285 : Int1 = false;
let TotallyNotJson.1284 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1285};
let TotallyNotJson.1283 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1284;
ret TotallyNotJson.1283;
case 13:
let TotallyNotJson.1288 : Int1 = false;
let TotallyNotJson.1287 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1288};
let TotallyNotJson.1286 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1287;
ret TotallyNotJson.1286;
case 9:
let TotallyNotJson.1291 : Int1 = false;
let TotallyNotJson.1290 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1291};
let TotallyNotJson.1289 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1290;
ret TotallyNotJson.1289;
default:
let TotallyNotJson.1295 : U64 = 1i64;
let TotallyNotJson.1294 : U64 = CallByName Num.19 TotallyNotJson.190 TotallyNotJson.1295;
let TotallyNotJson.1293 : {U64, Int1} = Struct {TotallyNotJson.1294, TotallyNotJson.191};
let TotallyNotJson.1292 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) TotallyNotJson.1293;
ret TotallyNotJson.1292;
procedure TotallyNotJson.2 ():
let TotallyNotJson.1172 : [C , C [], C , C , C , C ] = TagId(2) ;
ret TotallyNotJson.1172;
procedure TotallyNotJson.215 (TotallyNotJson.216, TotallyNotJson.217):
let TotallyNotJson.1238 : List U8 = CallByName TotallyNotJson.27 TotallyNotJson.217;
let TotallyNotJson.1237 : List U8 = CallByName List.8 TotallyNotJson.216 TotallyNotJson.1238;
ret TotallyNotJson.1237;
procedure TotallyNotJson.25 (TotallyNotJson.181):
let TotallyNotJson.1298 : Str = CallByName Encode.23 TotallyNotJson.181;
ret TotallyNotJson.1298;
procedure TotallyNotJson.26 (TotallyNotJson.184):
let TotallyNotJson.185 : List U8 = CallByName Str.12 TotallyNotJson.184;
let TotallyNotJson.1296 : U64 = 0i64;
let TotallyNotJson.1297 : Int1 = true;
let TotallyNotJson.186 : {U64, Int1} = Struct {TotallyNotJson.1296, TotallyNotJson.1297};
let TotallyNotJson.1266 : {} = Struct {};
inc TotallyNotJson.185;
let TotallyNotJson.187 : {U64, Int1} = CallByName List.26 TotallyNotJson.185 TotallyNotJson.186 TotallyNotJson.1266;
let TotallyNotJson.1220 : Int1 = StructAtIndex 1 TotallyNotJson.187;
let TotallyNotJson.1264 : Int1 = true;
let TotallyNotJson.1265 : Int1 = lowlevel Eq TotallyNotJson.1264 TotallyNotJson.1220;
if TotallyNotJson.1265 then
let TotallyNotJson.1230 : U64 = CallByName List.6 TotallyNotJson.185;
let TotallyNotJson.1231 : U64 = 2i64;
let TotallyNotJson.1229 : U64 = CallByName Num.19 TotallyNotJson.1230 TotallyNotJson.1231;
let TotallyNotJson.1226 : List U8 = CallByName List.68 TotallyNotJson.1229;
let TotallyNotJson.1228 : U8 = 34i64;
let TotallyNotJson.1227 : List U8 = Array [TotallyNotJson.1228];
let TotallyNotJson.1225 : List U8 = CallByName List.8 TotallyNotJson.1226 TotallyNotJson.1227;
let TotallyNotJson.1222 : List U8 = CallByName List.8 TotallyNotJson.1225 TotallyNotJson.185;
let TotallyNotJson.1224 : U8 = 34i64;
let TotallyNotJson.1223 : List U8 = Array [TotallyNotJson.1224];
let TotallyNotJson.1221 : List U8 = CallByName List.8 TotallyNotJson.1222 TotallyNotJson.1223;
ret TotallyNotJson.1221;
else
inc TotallyNotJson.185;
let TotallyNotJson.1263 : U64 = StructAtIndex 0 TotallyNotJson.187;
let TotallyNotJson.1262 : {List U8, List U8} = CallByName List.52 TotallyNotJson.185 TotallyNotJson.1263;
let TotallyNotJson.211 : List U8 = StructAtIndex 0 TotallyNotJson.1262;
let TotallyNotJson.213 : List U8 = StructAtIndex 1 TotallyNotJson.1262;
let TotallyNotJson.1260 : U64 = CallByName List.6 TotallyNotJson.185;
dec TotallyNotJson.185;
let TotallyNotJson.1261 : U64 = 120i64;
let TotallyNotJson.1258 : U64 = CallByName Num.21 TotallyNotJson.1260 TotallyNotJson.1261;
let TotallyNotJson.1259 : U64 = 100i64;
let TotallyNotJson.1257 : U64 = CallByName Num.94 TotallyNotJson.1258 TotallyNotJson.1259;
let TotallyNotJson.1254 : List U8 = CallByName List.68 TotallyNotJson.1257;
let TotallyNotJson.1256 : U8 = 34i64;
let TotallyNotJson.1255 : List U8 = Array [TotallyNotJson.1256];
let TotallyNotJson.1253 : List U8 = CallByName List.8 TotallyNotJson.1254 TotallyNotJson.1255;
let TotallyNotJson.214 : List U8 = CallByName List.8 TotallyNotJson.1253 TotallyNotJson.211;
let TotallyNotJson.1236 : {} = Struct {};
let TotallyNotJson.1233 : List U8 = CallByName List.18 TotallyNotJson.213 TotallyNotJson.214 TotallyNotJson.1236;
let TotallyNotJson.1235 : U8 = 34i64;
let TotallyNotJson.1234 : List U8 = Array [TotallyNotJson.1235];
let TotallyNotJson.1232 : List U8 = CallByName List.8 TotallyNotJson.1233 TotallyNotJson.1234;
ret TotallyNotJson.1232;
procedure TotallyNotJson.264 (TotallyNotJson.265, TotallyNotJson.1175, #Attr.12):
let TotallyNotJson.263 : List Str = StructAtIndex 1 #Attr.12;
let TotallyNotJson.262 : Str = StructAtIndex 0 #Attr.12;
let TotallyNotJson.1213 : I64 = 123i64;
let TotallyNotJson.1212 : U8 = CallByName Num.127 TotallyNotJson.1213;
let TotallyNotJson.1209 : List U8 = CallByName List.4 TotallyNotJson.265 TotallyNotJson.1212;
let TotallyNotJson.1211 : I64 = 34i64;
let TotallyNotJson.1210 : U8 = CallByName Num.127 TotallyNotJson.1211;
let TotallyNotJson.1207 : List U8 = CallByName List.4 TotallyNotJson.1209 TotallyNotJson.1210;
let TotallyNotJson.1208 : List U8 = CallByName Str.12 TotallyNotJson.262;
let TotallyNotJson.1204 : List U8 = CallByName List.8 TotallyNotJson.1207 TotallyNotJson.1208;
let TotallyNotJson.1206 : I64 = 34i64;
let TotallyNotJson.1205 : U8 = CallByName Num.127 TotallyNotJson.1206;
let TotallyNotJson.1201 : List U8 = CallByName List.4 TotallyNotJson.1204 TotallyNotJson.1205;
let TotallyNotJson.1203 : I64 = 58i64;
let TotallyNotJson.1202 : U8 = CallByName Num.127 TotallyNotJson.1203;
let TotallyNotJson.1198 : List U8 = CallByName List.4 TotallyNotJson.1201 TotallyNotJson.1202;
let TotallyNotJson.1200 : I64 = 91i64;
let TotallyNotJson.1199 : U8 = CallByName Num.127 TotallyNotJson.1200;
let TotallyNotJson.268 : List U8 = CallByName List.4 TotallyNotJson.1198 TotallyNotJson.1199;
let TotallyNotJson.1197 : U64 = CallByName List.6 TotallyNotJson.263;
let TotallyNotJson.1185 : {List U8, U64} = Struct {TotallyNotJson.268, TotallyNotJson.1197};
let TotallyNotJson.1184 : {List U8, U64} = CallByName List.18 TotallyNotJson.263 TotallyNotJson.1185 TotallyNotJson.1175;
let TotallyNotJson.270 : List U8 = StructAtIndex 0 TotallyNotJson.1184;
let TotallyNotJson.1183 : I64 = 93i64;
let TotallyNotJson.1182 : U8 = CallByName Num.127 TotallyNotJson.1183;
let TotallyNotJson.1179 : List U8 = CallByName List.4 TotallyNotJson.270 TotallyNotJson.1182;
let TotallyNotJson.1181 : I64 = 125i64;
let TotallyNotJson.1180 : U8 = CallByName Num.127 TotallyNotJson.1181;
let TotallyNotJson.1178 : List U8 = CallByName List.4 TotallyNotJson.1179 TotallyNotJson.1180;
ret TotallyNotJson.1178;
procedure TotallyNotJson.267 (TotallyNotJson.1177, TotallyNotJson.273, TotallyNotJson.266):
let TotallyNotJson.271 : List U8 = StructAtIndex 0 TotallyNotJson.1177;
let TotallyNotJson.272 : U64 = StructAtIndex 1 TotallyNotJson.1177;
let TotallyNotJson.274 : List U8 = CallByName Encode.24 TotallyNotJson.271 TotallyNotJson.273 TotallyNotJson.266;
joinpoint TotallyNotJson.1191 TotallyNotJson.275:
let TotallyNotJson.1189 : U64 = 1i64;
let TotallyNotJson.1188 : U64 = CallByName Num.20 TotallyNotJson.272 TotallyNotJson.1189;
let TotallyNotJson.1187 : {List U8, U64} = Struct {TotallyNotJson.275, TotallyNotJson.1188};
ret TotallyNotJson.1187;
in
let TotallyNotJson.1195 : U64 = 1i64;
let TotallyNotJson.1192 : Int1 = CallByName Num.24 TotallyNotJson.272 TotallyNotJson.1195;
if TotallyNotJson.1192 then
let TotallyNotJson.1194 : I64 = 44i64;
let TotallyNotJson.1193 : U8 = CallByName Num.127 TotallyNotJson.1194;
let TotallyNotJson.1190 : List U8 = CallByName List.4 TotallyNotJson.274 TotallyNotJson.1193;
jump TotallyNotJson.1191 TotallyNotJson.1190;
else
jump TotallyNotJson.1191 TotallyNotJson.274;
procedure TotallyNotJson.27 (TotallyNotJson.218):
switch TotallyNotJson.218:
case 34:
let TotallyNotJson.1239 : List U8 = Array [92i64, 34i64];
ret TotallyNotJson.1239;
case 92:
let TotallyNotJson.1240 : List U8 = Array [92i64, 92i64];
ret TotallyNotJson.1240;
case 47:
let TotallyNotJson.1241 : List U8 = Array [92i64, 47i64];
ret TotallyNotJson.1241;
case 8:
let TotallyNotJson.1243 : U8 = 98i64;
let TotallyNotJson.1242 : List U8 = Array [92i64, TotallyNotJson.1243];
ret TotallyNotJson.1242;
case 12:
let TotallyNotJson.1245 : U8 = 102i64;
let TotallyNotJson.1244 : List U8 = Array [92i64, TotallyNotJson.1245];
ret TotallyNotJson.1244;
case 10:
let TotallyNotJson.1247 : U8 = 110i64;
let TotallyNotJson.1246 : List U8 = Array [92i64, TotallyNotJson.1247];
ret TotallyNotJson.1246;
case 13:
let TotallyNotJson.1249 : U8 = 114i64;
let TotallyNotJson.1248 : List U8 = Array [92i64, TotallyNotJson.1249];
ret TotallyNotJson.1248;
case 9:
let TotallyNotJson.1251 : U8 = 114i64;
let TotallyNotJson.1250 : List U8 = Array [92i64, TotallyNotJson.1251];
ret TotallyNotJson.1250;
default:
let TotallyNotJson.1252 : List U8 = Array [TotallyNotJson.218];
ret TotallyNotJson.1252;
procedure TotallyNotJson.32 (TotallyNotJson.262, TotallyNotJson.263):
let TotallyNotJson.1174 : {Str, List Str} = Struct {TotallyNotJson.262, TotallyNotJson.263};
let TotallyNotJson.1173 : {Str, List Str} = CallByName Encode.23 TotallyNotJson.1174;
ret TotallyNotJson.1173;
procedure Test.0 ():
let Test.13 : Str = "foo";
let Test.12 : Str = "foo";
let Test.1 : {Str, Str} = Struct {Test.12, Test.13};
let Test.11 : [C , C [], C , C , C , C ] = CallByName Json.1;
let Test.11 : [C , C [], C , C , C , C ] = CallByName TotallyNotJson.2;
let Test.10 : List U8 = CallByName Encode.26 Test.1 Test.11;
let Test.2 : [C {U64, U8}, C Str] = CallByName Str.9 Test.10;
let Test.7 : U8 = 1i64;

File diff suppressed because it is too large Load diff

View file

@ -20,11 +20,11 @@ procedure Encode.24 (Encode.99, Encode.107, Encode.101):
ret Encode.111;
procedure Encode.24 (Encode.99, Encode.107, Encode.101):
let Encode.118 : List U8 = CallByName Json.263 Encode.99 Encode.101 Encode.107;
let Encode.118 : List U8 = CallByName TotallyNotJson.264 Encode.99 Encode.101 Encode.107;
ret Encode.118;
procedure Encode.24 (Encode.99, Encode.107, Encode.101):
let Encode.123 : List U8 = CallByName Json.181 Encode.99 Encode.101 Encode.107;
let Encode.123 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107;
ret Encode.123;
procedure Encode.26 (Encode.105, Encode.106):
@ -33,239 +33,12 @@ procedure Encode.26 (Encode.105, Encode.106):
let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106;
ret Encode.108;
procedure Json.1 ():
let Json.1171 : [C , C [], C , C , C , C ] = TagId(2) ;
ret Json.1171;
procedure Json.181 (Json.182, Json.1218, Json.180):
let Json.1221 : List U8 = CallByName Json.25 Json.180;
let Json.1220 : List U8 = CallByName List.8 Json.182 Json.1221;
ret Json.1220;
procedure Json.188 (Json.1269, Json.191):
let Json.189 : U64 = StructAtIndex 0 Json.1269;
let Json.190 : Int1 = StructAtIndex 1 Json.1269;
switch Json.191:
case 34:
let Json.1272 : Int1 = false;
let Json.1271 : {U64, Int1} = Struct {Json.189, Json.1272};
let Json.1270 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1271;
ret Json.1270;
case 92:
let Json.1275 : Int1 = false;
let Json.1274 : {U64, Int1} = Struct {Json.189, Json.1275};
let Json.1273 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1274;
ret Json.1273;
case 47:
let Json.1278 : Int1 = false;
let Json.1277 : {U64, Int1} = Struct {Json.189, Json.1278};
let Json.1276 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1277;
ret Json.1276;
case 8:
let Json.1281 : Int1 = false;
let Json.1280 : {U64, Int1} = Struct {Json.189, Json.1281};
let Json.1279 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1280;
ret Json.1279;
case 12:
let Json.1284 : Int1 = false;
let Json.1283 : {U64, Int1} = Struct {Json.189, Json.1284};
let Json.1282 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1283;
ret Json.1282;
case 10:
let Json.1287 : Int1 = false;
let Json.1286 : {U64, Int1} = Struct {Json.189, Json.1287};
let Json.1285 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1286;
ret Json.1285;
case 13:
let Json.1290 : Int1 = false;
let Json.1289 : {U64, Int1} = Struct {Json.189, Json.1290};
let Json.1288 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1289;
ret Json.1288;
case 9:
let Json.1293 : Int1 = false;
let Json.1292 : {U64, Int1} = Struct {Json.189, Json.1293};
let Json.1291 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) Json.1292;
ret Json.1291;
default:
let Json.1297 : U64 = 1i64;
let Json.1296 : U64 = CallByName Num.19 Json.189 Json.1297;
let Json.1295 : {U64, Int1} = Struct {Json.1296, Json.190};
let Json.1294 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) Json.1295;
ret Json.1294;
procedure Json.214 (Json.215, Json.216):
let Json.1240 : List U8 = CallByName Json.26 Json.216;
let Json.1239 : List U8 = CallByName List.8 Json.215 Json.1240;
ret Json.1239;
procedure Json.24 (Json.180):
let Json.1300 : Str = CallByName Encode.23 Json.180;
ret Json.1300;
procedure Json.25 (Json.183):
let Json.184 : List U8 = CallByName Str.12 Json.183;
let Json.1298 : U64 = 0i64;
let Json.1299 : Int1 = true;
let Json.185 : {U64, Int1} = Struct {Json.1298, Json.1299};
let Json.1268 : {} = Struct {};
inc Json.184;
let Json.186 : {U64, Int1} = CallByName List.26 Json.184 Json.185 Json.1268;
let Json.1222 : Int1 = StructAtIndex 1 Json.186;
let Json.1266 : Int1 = true;
let Json.1267 : Int1 = lowlevel Eq Json.1266 Json.1222;
if Json.1267 then
let Json.1232 : U64 = CallByName List.6 Json.184;
let Json.1233 : U64 = 2i64;
let Json.1231 : U64 = CallByName Num.19 Json.1232 Json.1233;
let Json.1228 : List U8 = CallByName List.68 Json.1231;
let Json.1230 : U8 = 34i64;
let Json.1229 : List U8 = Array [Json.1230];
let Json.1227 : List U8 = CallByName List.8 Json.1228 Json.1229;
let Json.1224 : List U8 = CallByName List.8 Json.1227 Json.184;
let Json.1226 : U8 = 34i64;
let Json.1225 : List U8 = Array [Json.1226];
let Json.1223 : List U8 = CallByName List.8 Json.1224 Json.1225;
ret Json.1223;
else
inc Json.184;
let Json.1265 : U64 = StructAtIndex 0 Json.186;
let Json.1264 : {List U8, List U8} = CallByName List.52 Json.184 Json.1265;
let Json.210 : List U8 = StructAtIndex 0 Json.1264;
let Json.212 : List U8 = StructAtIndex 1 Json.1264;
let Json.1262 : U64 = CallByName List.6 Json.184;
dec Json.184;
let Json.1263 : U64 = 120i64;
let Json.1260 : U64 = CallByName Num.21 Json.1262 Json.1263;
let Json.1261 : U64 = 100i64;
let Json.1259 : U64 = CallByName Num.94 Json.1260 Json.1261;
let Json.1256 : List U8 = CallByName List.68 Json.1259;
let Json.1258 : U8 = 34i64;
let Json.1257 : List U8 = Array [Json.1258];
let Json.1255 : List U8 = CallByName List.8 Json.1256 Json.1257;
let Json.213 : List U8 = CallByName List.8 Json.1255 Json.210;
let Json.1238 : {} = Struct {};
let Json.1235 : List U8 = CallByName List.18 Json.212 Json.213 Json.1238;
let Json.1237 : U8 = 34i64;
let Json.1236 : List U8 = Array [Json.1237];
let Json.1234 : List U8 = CallByName List.8 Json.1235 Json.1236;
ret Json.1234;
procedure Json.26 (Json.217):
switch Json.217:
case 34:
let Json.1241 : List U8 = Array [92i64, 34i64];
ret Json.1241;
case 92:
let Json.1242 : List U8 = Array [92i64, 92i64];
ret Json.1242;
case 47:
let Json.1243 : List U8 = Array [92i64, 47i64];
ret Json.1243;
case 8:
let Json.1245 : U8 = 98i64;
let Json.1244 : List U8 = Array [92i64, Json.1245];
ret Json.1244;
case 12:
let Json.1247 : U8 = 102i64;
let Json.1246 : List U8 = Array [92i64, Json.1247];
ret Json.1246;
case 10:
let Json.1249 : U8 = 110i64;
let Json.1248 : List U8 = Array [92i64, Json.1249];
ret Json.1248;
case 13:
let Json.1251 : U8 = 114i64;
let Json.1250 : List U8 = Array [92i64, Json.1251];
ret Json.1250;
case 9:
let Json.1253 : U8 = 114i64;
let Json.1252 : List U8 = Array [92i64, Json.1253];
ret Json.1252;
default:
let Json.1254 : List U8 = Array [Json.217];
ret Json.1254;
procedure Json.263 (Json.264, Json.1174, #Attr.12):
let Json.262 : List Str = StructAtIndex 1 #Attr.12;
let Json.261 : Str = StructAtIndex 0 #Attr.12;
let Json.1212 : I64 = 123i64;
let Json.1211 : U8 = CallByName Num.127 Json.1212;
let Json.1208 : List U8 = CallByName List.4 Json.264 Json.1211;
let Json.1210 : I64 = 34i64;
let Json.1209 : U8 = CallByName Num.127 Json.1210;
let Json.1206 : List U8 = CallByName List.4 Json.1208 Json.1209;
let Json.1207 : List U8 = CallByName Str.12 Json.261;
let Json.1203 : List U8 = CallByName List.8 Json.1206 Json.1207;
let Json.1205 : I64 = 34i64;
let Json.1204 : U8 = CallByName Num.127 Json.1205;
let Json.1200 : List U8 = CallByName List.4 Json.1203 Json.1204;
let Json.1202 : I64 = 58i64;
let Json.1201 : U8 = CallByName Num.127 Json.1202;
let Json.1197 : List U8 = CallByName List.4 Json.1200 Json.1201;
let Json.1199 : I64 = 91i64;
let Json.1198 : U8 = CallByName Num.127 Json.1199;
let Json.267 : List U8 = CallByName List.4 Json.1197 Json.1198;
let Json.1196 : U64 = CallByName List.6 Json.262;
let Json.1184 : {List U8, U64} = Struct {Json.267, Json.1196};
let Json.1183 : {List U8, U64} = CallByName List.18 Json.262 Json.1184 Json.1174;
let Json.269 : List U8 = StructAtIndex 0 Json.1183;
let Json.1182 : I64 = 93i64;
let Json.1181 : U8 = CallByName Num.127 Json.1182;
let Json.1178 : List U8 = CallByName List.4 Json.269 Json.1181;
let Json.1180 : I64 = 125i64;
let Json.1179 : U8 = CallByName Num.127 Json.1180;
let Json.1177 : List U8 = CallByName List.4 Json.1178 Json.1179;
ret Json.1177;
procedure Json.266 (Json.1176, Json.272, Json.265):
let Json.270 : List U8 = StructAtIndex 0 Json.1176;
let Json.271 : U64 = StructAtIndex 1 Json.1176;
let Json.273 : List U8 = CallByName Encode.24 Json.270 Json.272 Json.265;
joinpoint Json.1190 Json.274:
let Json.1188 : U64 = 1i64;
let Json.1187 : U64 = CallByName Num.20 Json.271 Json.1188;
let Json.1186 : {List U8, U64} = Struct {Json.274, Json.1187};
ret Json.1186;
in
let Json.1194 : U64 = 1i64;
let Json.1191 : Int1 = CallByName Num.24 Json.271 Json.1194;
if Json.1191 then
let Json.1193 : I64 = 44i64;
let Json.1192 : U8 = CallByName Num.127 Json.1193;
let Json.1189 : List U8 = CallByName List.4 Json.273 Json.1192;
jump Json.1190 Json.1189;
else
jump Json.1190 Json.273;
procedure Json.31 (Json.261, Json.262):
let Json.1214 : {Str, List Str} = Struct {Json.261, Json.262};
let Json.1213 : {Str, List Str} = CallByName Encode.23 Json.1214;
ret Json.1213;
procedure List.145 (List.146, List.147, List.144):
let List.566 : {List U8, U64} = CallByName Json.266 List.146 List.147 List.144;
let List.566 : {List U8, U64} = CallByName TotallyNotJson.267 List.146 List.147 List.144;
ret List.566;
procedure List.145 (List.146, List.147, List.144):
let List.586 : List U8 = CallByName Json.214 List.146 List.147;
let List.586 : List U8 = CallByName TotallyNotJson.215 List.146 List.147;
ret List.586;
procedure List.18 (List.142, List.143, List.144):
@ -399,7 +172,7 @@ procedure List.80 (List.691, List.692, List.693, List.694, List.695):
let List.628 : Int1 = CallByName Num.22 List.442 List.443;
if List.628 then
let List.637 : U8 = CallByName List.66 List.439 List.442;
let List.629 : [C {U64, Int1}, C {U64, Int1}] = CallByName Json.188 List.440 List.637;
let List.629 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.440 List.637;
let List.634 : U8 = 1i64;
let List.635 : U8 = GetTagId List.629;
let List.636 : Int1 = lowlevel Eq List.634 List.635;
@ -491,22 +264,249 @@ procedure Test.5 (Test.6, Test.7, Test.4):
let Test.29 : Str = StructAtIndex 0 Test.4;
let #Derived_gen.0 : Str = StructAtIndex 1 Test.4;
dec #Derived_gen.0;
let Test.28 : Str = CallByName Json.24 Test.29;
let Test.28 : Str = CallByName TotallyNotJson.25 Test.29;
let Test.27 : List Str = Array [Test.28];
let Test.19 : {Str, List Str} = CallByName Json.31 Test.26 Test.27;
let Test.19 : {Str, List Str} = CallByName TotallyNotJson.32 Test.26 Test.27;
jump Test.20 Test.19;
else
let Test.21 : Str = "B";
let Test.24 : Str = StructAtIndex 1 Test.4;
let #Derived_gen.1 : Str = StructAtIndex 0 Test.4;
dec #Derived_gen.1;
let Test.23 : Str = CallByName Json.24 Test.24;
let Test.23 : Str = CallByName TotallyNotJson.25 Test.24;
let Test.22 : List Str = Array [Test.23];
let Test.19 : {Str, List Str} = CallByName Json.31 Test.21 Test.22;
let Test.19 : {Str, List Str} = CallByName TotallyNotJson.32 Test.21 Test.22;
jump Test.20 Test.19;
procedure TotallyNotJson.182 (TotallyNotJson.183, TotallyNotJson.1219, TotallyNotJson.181):
let TotallyNotJson.1222 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.181;
let TotallyNotJson.1221 : List U8 = CallByName List.8 TotallyNotJson.183 TotallyNotJson.1222;
ret TotallyNotJson.1221;
procedure TotallyNotJson.189 (TotallyNotJson.1270, TotallyNotJson.192):
let TotallyNotJson.190 : U64 = StructAtIndex 0 TotallyNotJson.1270;
let TotallyNotJson.191 : Int1 = StructAtIndex 1 TotallyNotJson.1270;
switch TotallyNotJson.192:
case 34:
let TotallyNotJson.1273 : Int1 = false;
let TotallyNotJson.1272 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1273};
let TotallyNotJson.1271 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1272;
ret TotallyNotJson.1271;
case 92:
let TotallyNotJson.1276 : Int1 = false;
let TotallyNotJson.1275 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1276};
let TotallyNotJson.1274 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1275;
ret TotallyNotJson.1274;
case 47:
let TotallyNotJson.1279 : Int1 = false;
let TotallyNotJson.1278 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1279};
let TotallyNotJson.1277 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1278;
ret TotallyNotJson.1277;
case 8:
let TotallyNotJson.1282 : Int1 = false;
let TotallyNotJson.1281 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1282};
let TotallyNotJson.1280 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1281;
ret TotallyNotJson.1280;
case 12:
let TotallyNotJson.1285 : Int1 = false;
let TotallyNotJson.1284 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1285};
let TotallyNotJson.1283 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1284;
ret TotallyNotJson.1283;
case 10:
let TotallyNotJson.1288 : Int1 = false;
let TotallyNotJson.1287 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1288};
let TotallyNotJson.1286 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1287;
ret TotallyNotJson.1286;
case 13:
let TotallyNotJson.1291 : Int1 = false;
let TotallyNotJson.1290 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1291};
let TotallyNotJson.1289 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1290;
ret TotallyNotJson.1289;
case 9:
let TotallyNotJson.1294 : Int1 = false;
let TotallyNotJson.1293 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1294};
let TotallyNotJson.1292 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1293;
ret TotallyNotJson.1292;
default:
let TotallyNotJson.1298 : U64 = 1i64;
let TotallyNotJson.1297 : U64 = CallByName Num.19 TotallyNotJson.190 TotallyNotJson.1298;
let TotallyNotJson.1296 : {U64, Int1} = Struct {TotallyNotJson.1297, TotallyNotJson.191};
let TotallyNotJson.1295 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) TotallyNotJson.1296;
ret TotallyNotJson.1295;
procedure TotallyNotJson.2 ():
let TotallyNotJson.1172 : [C , C [], C , C , C , C ] = TagId(2) ;
ret TotallyNotJson.1172;
procedure TotallyNotJson.215 (TotallyNotJson.216, TotallyNotJson.217):
let TotallyNotJson.1241 : List U8 = CallByName TotallyNotJson.27 TotallyNotJson.217;
let TotallyNotJson.1240 : List U8 = CallByName List.8 TotallyNotJson.216 TotallyNotJson.1241;
ret TotallyNotJson.1240;
procedure TotallyNotJson.25 (TotallyNotJson.181):
let TotallyNotJson.1301 : Str = CallByName Encode.23 TotallyNotJson.181;
ret TotallyNotJson.1301;
procedure TotallyNotJson.26 (TotallyNotJson.184):
let TotallyNotJson.185 : List U8 = CallByName Str.12 TotallyNotJson.184;
let TotallyNotJson.1299 : U64 = 0i64;
let TotallyNotJson.1300 : Int1 = true;
let TotallyNotJson.186 : {U64, Int1} = Struct {TotallyNotJson.1299, TotallyNotJson.1300};
let TotallyNotJson.1269 : {} = Struct {};
inc TotallyNotJson.185;
let TotallyNotJson.187 : {U64, Int1} = CallByName List.26 TotallyNotJson.185 TotallyNotJson.186 TotallyNotJson.1269;
let TotallyNotJson.1223 : Int1 = StructAtIndex 1 TotallyNotJson.187;
let TotallyNotJson.1267 : Int1 = true;
let TotallyNotJson.1268 : Int1 = lowlevel Eq TotallyNotJson.1267 TotallyNotJson.1223;
if TotallyNotJson.1268 then
let TotallyNotJson.1233 : U64 = CallByName List.6 TotallyNotJson.185;
let TotallyNotJson.1234 : U64 = 2i64;
let TotallyNotJson.1232 : U64 = CallByName Num.19 TotallyNotJson.1233 TotallyNotJson.1234;
let TotallyNotJson.1229 : List U8 = CallByName List.68 TotallyNotJson.1232;
let TotallyNotJson.1231 : U8 = 34i64;
let TotallyNotJson.1230 : List U8 = Array [TotallyNotJson.1231];
let TotallyNotJson.1228 : List U8 = CallByName List.8 TotallyNotJson.1229 TotallyNotJson.1230;
let TotallyNotJson.1225 : List U8 = CallByName List.8 TotallyNotJson.1228 TotallyNotJson.185;
let TotallyNotJson.1227 : U8 = 34i64;
let TotallyNotJson.1226 : List U8 = Array [TotallyNotJson.1227];
let TotallyNotJson.1224 : List U8 = CallByName List.8 TotallyNotJson.1225 TotallyNotJson.1226;
ret TotallyNotJson.1224;
else
inc TotallyNotJson.185;
let TotallyNotJson.1266 : U64 = StructAtIndex 0 TotallyNotJson.187;
let TotallyNotJson.1265 : {List U8, List U8} = CallByName List.52 TotallyNotJson.185 TotallyNotJson.1266;
let TotallyNotJson.211 : List U8 = StructAtIndex 0 TotallyNotJson.1265;
let TotallyNotJson.213 : List U8 = StructAtIndex 1 TotallyNotJson.1265;
let TotallyNotJson.1263 : U64 = CallByName List.6 TotallyNotJson.185;
dec TotallyNotJson.185;
let TotallyNotJson.1264 : U64 = 120i64;
let TotallyNotJson.1261 : U64 = CallByName Num.21 TotallyNotJson.1263 TotallyNotJson.1264;
let TotallyNotJson.1262 : U64 = 100i64;
let TotallyNotJson.1260 : U64 = CallByName Num.94 TotallyNotJson.1261 TotallyNotJson.1262;
let TotallyNotJson.1257 : List U8 = CallByName List.68 TotallyNotJson.1260;
let TotallyNotJson.1259 : U8 = 34i64;
let TotallyNotJson.1258 : List U8 = Array [TotallyNotJson.1259];
let TotallyNotJson.1256 : List U8 = CallByName List.8 TotallyNotJson.1257 TotallyNotJson.1258;
let TotallyNotJson.214 : List U8 = CallByName List.8 TotallyNotJson.1256 TotallyNotJson.211;
let TotallyNotJson.1239 : {} = Struct {};
let TotallyNotJson.1236 : List U8 = CallByName List.18 TotallyNotJson.213 TotallyNotJson.214 TotallyNotJson.1239;
let TotallyNotJson.1238 : U8 = 34i64;
let TotallyNotJson.1237 : List U8 = Array [TotallyNotJson.1238];
let TotallyNotJson.1235 : List U8 = CallByName List.8 TotallyNotJson.1236 TotallyNotJson.1237;
ret TotallyNotJson.1235;
procedure TotallyNotJson.264 (TotallyNotJson.265, TotallyNotJson.1175, #Attr.12):
let TotallyNotJson.263 : List Str = StructAtIndex 1 #Attr.12;
let TotallyNotJson.262 : Str = StructAtIndex 0 #Attr.12;
let TotallyNotJson.1213 : I64 = 123i64;
let TotallyNotJson.1212 : U8 = CallByName Num.127 TotallyNotJson.1213;
let TotallyNotJson.1209 : List U8 = CallByName List.4 TotallyNotJson.265 TotallyNotJson.1212;
let TotallyNotJson.1211 : I64 = 34i64;
let TotallyNotJson.1210 : U8 = CallByName Num.127 TotallyNotJson.1211;
let TotallyNotJson.1207 : List U8 = CallByName List.4 TotallyNotJson.1209 TotallyNotJson.1210;
let TotallyNotJson.1208 : List U8 = CallByName Str.12 TotallyNotJson.262;
let TotallyNotJson.1204 : List U8 = CallByName List.8 TotallyNotJson.1207 TotallyNotJson.1208;
let TotallyNotJson.1206 : I64 = 34i64;
let TotallyNotJson.1205 : U8 = CallByName Num.127 TotallyNotJson.1206;
let TotallyNotJson.1201 : List U8 = CallByName List.4 TotallyNotJson.1204 TotallyNotJson.1205;
let TotallyNotJson.1203 : I64 = 58i64;
let TotallyNotJson.1202 : U8 = CallByName Num.127 TotallyNotJson.1203;
let TotallyNotJson.1198 : List U8 = CallByName List.4 TotallyNotJson.1201 TotallyNotJson.1202;
let TotallyNotJson.1200 : I64 = 91i64;
let TotallyNotJson.1199 : U8 = CallByName Num.127 TotallyNotJson.1200;
let TotallyNotJson.268 : List U8 = CallByName List.4 TotallyNotJson.1198 TotallyNotJson.1199;
let TotallyNotJson.1197 : U64 = CallByName List.6 TotallyNotJson.263;
let TotallyNotJson.1185 : {List U8, U64} = Struct {TotallyNotJson.268, TotallyNotJson.1197};
let TotallyNotJson.1184 : {List U8, U64} = CallByName List.18 TotallyNotJson.263 TotallyNotJson.1185 TotallyNotJson.1175;
let TotallyNotJson.270 : List U8 = StructAtIndex 0 TotallyNotJson.1184;
let TotallyNotJson.1183 : I64 = 93i64;
let TotallyNotJson.1182 : U8 = CallByName Num.127 TotallyNotJson.1183;
let TotallyNotJson.1179 : List U8 = CallByName List.4 TotallyNotJson.270 TotallyNotJson.1182;
let TotallyNotJson.1181 : I64 = 125i64;
let TotallyNotJson.1180 : U8 = CallByName Num.127 TotallyNotJson.1181;
let TotallyNotJson.1178 : List U8 = CallByName List.4 TotallyNotJson.1179 TotallyNotJson.1180;
ret TotallyNotJson.1178;
procedure TotallyNotJson.267 (TotallyNotJson.1177, TotallyNotJson.273, TotallyNotJson.266):
let TotallyNotJson.271 : List U8 = StructAtIndex 0 TotallyNotJson.1177;
let TotallyNotJson.272 : U64 = StructAtIndex 1 TotallyNotJson.1177;
let TotallyNotJson.274 : List U8 = CallByName Encode.24 TotallyNotJson.271 TotallyNotJson.273 TotallyNotJson.266;
joinpoint TotallyNotJson.1191 TotallyNotJson.275:
let TotallyNotJson.1189 : U64 = 1i64;
let TotallyNotJson.1188 : U64 = CallByName Num.20 TotallyNotJson.272 TotallyNotJson.1189;
let TotallyNotJson.1187 : {List U8, U64} = Struct {TotallyNotJson.275, TotallyNotJson.1188};
ret TotallyNotJson.1187;
in
let TotallyNotJson.1195 : U64 = 1i64;
let TotallyNotJson.1192 : Int1 = CallByName Num.24 TotallyNotJson.272 TotallyNotJson.1195;
if TotallyNotJson.1192 then
let TotallyNotJson.1194 : I64 = 44i64;
let TotallyNotJson.1193 : U8 = CallByName Num.127 TotallyNotJson.1194;
let TotallyNotJson.1190 : List U8 = CallByName List.4 TotallyNotJson.274 TotallyNotJson.1193;
jump TotallyNotJson.1191 TotallyNotJson.1190;
else
jump TotallyNotJson.1191 TotallyNotJson.274;
procedure TotallyNotJson.27 (TotallyNotJson.218):
switch TotallyNotJson.218:
case 34:
let TotallyNotJson.1242 : List U8 = Array [92i64, 34i64];
ret TotallyNotJson.1242;
case 92:
let TotallyNotJson.1243 : List U8 = Array [92i64, 92i64];
ret TotallyNotJson.1243;
case 47:
let TotallyNotJson.1244 : List U8 = Array [92i64, 47i64];
ret TotallyNotJson.1244;
case 8:
let TotallyNotJson.1246 : U8 = 98i64;
let TotallyNotJson.1245 : List U8 = Array [92i64, TotallyNotJson.1246];
ret TotallyNotJson.1245;
case 12:
let TotallyNotJson.1248 : U8 = 102i64;
let TotallyNotJson.1247 : List U8 = Array [92i64, TotallyNotJson.1248];
ret TotallyNotJson.1247;
case 10:
let TotallyNotJson.1250 : U8 = 110i64;
let TotallyNotJson.1249 : List U8 = Array [92i64, TotallyNotJson.1250];
ret TotallyNotJson.1249;
case 13:
let TotallyNotJson.1252 : U8 = 114i64;
let TotallyNotJson.1251 : List U8 = Array [92i64, TotallyNotJson.1252];
ret TotallyNotJson.1251;
case 9:
let TotallyNotJson.1254 : U8 = 114i64;
let TotallyNotJson.1253 : List U8 = Array [92i64, TotallyNotJson.1254];
ret TotallyNotJson.1253;
default:
let TotallyNotJson.1255 : List U8 = Array [TotallyNotJson.218];
ret TotallyNotJson.1255;
procedure TotallyNotJson.32 (TotallyNotJson.262, TotallyNotJson.263):
let TotallyNotJson.1215 : {Str, List Str} = Struct {TotallyNotJson.262, TotallyNotJson.263};
let TotallyNotJson.1214 : {Str, List Str} = CallByName Encode.23 TotallyNotJson.1215;
ret TotallyNotJson.1214;
procedure Test.0 ():
let Test.12 : {Str, Str} = CallByName Test.3;
let Test.13 : [C , C [], C , C , C , C ] = CallByName Json.1;
let Test.13 : [C , C [], C , C , C , C ] = CallByName TotallyNotJson.2;
let Test.11 : List U8 = CallByName Encode.26 Test.12 Test.13;
ret Test.11;

View file

@ -11,7 +11,7 @@ procedure #Derived.2 (#Derived.3, #Derived.4, #Attr.12):
in
let #Derived_gen.16 : Str = "A";
let #Derived_gen.17 : List [] = Array [];
let #Derived_gen.15 : {Str, List []} = CallByName Json.31 #Derived_gen.16 #Derived_gen.17;
let #Derived_gen.15 : {Str, List []} = CallByName TotallyNotJson.32 #Derived_gen.16 #Derived_gen.17;
jump #Derived_gen.14 #Derived_gen.15;
procedure #Derived.5 (#Derived.6):
@ -27,7 +27,7 @@ procedure #Derived.7 (#Derived.8, #Derived.9, #Attr.12):
in
let #Derived_gen.7 : Str = "B";
let #Derived_gen.8 : List [] = Array [];
let #Derived_gen.6 : {Str, List []} = CallByName Json.31 #Derived_gen.7 #Derived_gen.8;
let #Derived_gen.6 : {Str, List []} = CallByName TotallyNotJson.32 #Derived_gen.7 #Derived_gen.8;
jump #Derived_gen.5 #Derived_gen.6;
procedure Bool.2 ():
@ -56,7 +56,7 @@ procedure Encode.24 (Encode.99, Encode.107, Encode.101):
ret Encode.111;
procedure Encode.24 (Encode.99, Encode.107, Encode.101):
let Encode.118 : List U8 = CallByName Json.263 Encode.99 Encode.101 Encode.107;
let Encode.118 : List U8 = CallByName TotallyNotJson.264 Encode.99 Encode.101 Encode.107;
ret Encode.118;
procedure Encode.24 (Encode.99, Encode.107, Encode.101):
@ -72,7 +72,7 @@ procedure Encode.24 (Encode.99, Encode.107, Encode.101):
procedure Encode.24 (Encode.99, Encode.107, Encode.101):
let Encode.134 : List U8 = CallByName Json.263 Encode.99 Encode.101 Encode.107;
let Encode.134 : List U8 = CallByName TotallyNotJson.264 Encode.99 Encode.101 Encode.107;
ret Encode.134;
procedure Encode.26 (Encode.105, Encode.106):
@ -81,130 +81,12 @@ procedure Encode.26 (Encode.105, Encode.106):
let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106;
ret Encode.108;
procedure Json.1 ():
let Json.1171 : [C , C [], C , C , C , C ] = TagId(2) ;
ret Json.1171;
procedure Json.263 (Json.264, Json.1174, #Attr.12):
let Json.262 : List [C {}, C {}] = StructAtIndex 1 #Attr.12;
let Json.261 : Str = StructAtIndex 0 #Attr.12;
let Json.1212 : I64 = 123i64;
let Json.1211 : U8 = CallByName Num.127 Json.1212;
let Json.1208 : List U8 = CallByName List.4 Json.264 Json.1211;
let Json.1210 : I64 = 34i64;
let Json.1209 : U8 = CallByName Num.127 Json.1210;
let Json.1206 : List U8 = CallByName List.4 Json.1208 Json.1209;
let Json.1207 : List U8 = CallByName Str.12 Json.261;
let Json.1203 : List U8 = CallByName List.8 Json.1206 Json.1207;
let Json.1205 : I64 = 34i64;
let Json.1204 : U8 = CallByName Num.127 Json.1205;
let Json.1200 : List U8 = CallByName List.4 Json.1203 Json.1204;
let Json.1202 : I64 = 58i64;
let Json.1201 : U8 = CallByName Num.127 Json.1202;
let Json.1197 : List U8 = CallByName List.4 Json.1200 Json.1201;
let Json.1199 : I64 = 91i64;
let Json.1198 : U8 = CallByName Num.127 Json.1199;
let Json.267 : List U8 = CallByName List.4 Json.1197 Json.1198;
let Json.1196 : U64 = CallByName List.6 Json.262;
let Json.1184 : {List U8, U64} = Struct {Json.267, Json.1196};
let Json.1183 : {List U8, U64} = CallByName List.18 Json.262 Json.1184 Json.1174;
let Json.269 : List U8 = StructAtIndex 0 Json.1183;
let Json.1182 : I64 = 93i64;
let Json.1181 : U8 = CallByName Num.127 Json.1182;
let Json.1178 : List U8 = CallByName List.4 Json.269 Json.1181;
let Json.1180 : I64 = 125i64;
let Json.1179 : U8 = CallByName Num.127 Json.1180;
let Json.1177 : List U8 = CallByName List.4 Json.1178 Json.1179;
ret Json.1177;
procedure Json.263 (Json.264, Json.1174, #Attr.12):
let Json.262 : List [] = StructAtIndex 1 #Attr.12;
let Json.261 : Str = StructAtIndex 0 #Attr.12;
let Json.1263 : I64 = 123i64;
let Json.1262 : U8 = CallByName Num.127 Json.1263;
let Json.1259 : List U8 = CallByName List.4 Json.264 Json.1262;
let Json.1261 : I64 = 34i64;
let Json.1260 : U8 = CallByName Num.127 Json.1261;
let Json.1257 : List U8 = CallByName List.4 Json.1259 Json.1260;
let Json.1258 : List U8 = CallByName Str.12 Json.261;
let Json.1254 : List U8 = CallByName List.8 Json.1257 Json.1258;
let Json.1256 : I64 = 34i64;
let Json.1255 : U8 = CallByName Num.127 Json.1256;
let Json.1251 : List U8 = CallByName List.4 Json.1254 Json.1255;
let Json.1253 : I64 = 58i64;
let Json.1252 : U8 = CallByName Num.127 Json.1253;
let Json.1248 : List U8 = CallByName List.4 Json.1251 Json.1252;
let Json.1250 : I64 = 91i64;
let Json.1249 : U8 = CallByName Num.127 Json.1250;
let Json.267 : List U8 = CallByName List.4 Json.1248 Json.1249;
let Json.1247 : U64 = CallByName List.6 Json.262;
let Json.1235 : {List U8, U64} = Struct {Json.267, Json.1247};
let Json.1234 : {List U8, U64} = CallByName List.18 Json.262 Json.1235 Json.1174;
let Json.269 : List U8 = StructAtIndex 0 Json.1234;
let Json.1233 : I64 = 93i64;
let Json.1232 : U8 = CallByName Num.127 Json.1233;
let Json.1229 : List U8 = CallByName List.4 Json.269 Json.1232;
let Json.1231 : I64 = 125i64;
let Json.1230 : U8 = CallByName Num.127 Json.1231;
let Json.1228 : List U8 = CallByName List.4 Json.1229 Json.1230;
ret Json.1228;
procedure Json.266 (Json.1176, Json.272, Json.265):
let Json.270 : List U8 = StructAtIndex 0 Json.1176;
let Json.271 : U64 = StructAtIndex 1 Json.1176;
let Json.273 : List U8 = CallByName Encode.24 Json.270 Json.272 Json.265;
joinpoint Json.1190 Json.274:
let Json.1188 : U64 = 1i64;
let Json.1187 : U64 = CallByName Num.20 Json.271 Json.1188;
let Json.1186 : {List U8, U64} = Struct {Json.274, Json.1187};
ret Json.1186;
in
let Json.1194 : U64 = 1i64;
let Json.1191 : Int1 = CallByName Num.24 Json.271 Json.1194;
if Json.1191 then
let Json.1193 : I64 = 44i64;
let Json.1192 : U8 = CallByName Num.127 Json.1193;
let Json.1189 : List U8 = CallByName List.4 Json.273 Json.1192;
jump Json.1190 Json.1189;
else
jump Json.1190 Json.273;
procedure Json.266 (Json.1176, Json.272, Json.265):
let Json.270 : List U8 = StructAtIndex 0 Json.1176;
let Json.271 : U64 = StructAtIndex 1 Json.1176;
let Json.273 : List U8 = CallByName Encode.24 Json.270 Json.272 Json.265;
joinpoint Json.1241 Json.274:
let Json.1239 : U64 = 1i64;
let Json.1238 : U64 = CallByName Num.20 Json.271 Json.1239;
let Json.1237 : {List U8, U64} = Struct {Json.274, Json.1238};
ret Json.1237;
in
let Json.1245 : U64 = 1i64;
let Json.1242 : Int1 = CallByName Num.24 Json.271 Json.1245;
if Json.1242 then
let Json.1244 : I64 = 44i64;
let Json.1243 : U8 = CallByName Num.127 Json.1244;
let Json.1240 : List U8 = CallByName List.4 Json.273 Json.1243;
jump Json.1241 Json.1240;
else
jump Json.1241 Json.273;
procedure Json.31 (Json.261, Json.262):
let Json.1214 : {Str, List [C {}, C {}]} = Struct {Json.261, Json.262};
let Json.1213 : {Str, List [C {}, C {}]} = CallByName Encode.23 Json.1214;
ret Json.1213;
procedure Json.31 (Json.261, Json.262):
let Json.1265 : {Str, List []} = Struct {Json.261, Json.262};
let Json.1264 : {Str, List []} = CallByName Encode.23 Json.1265;
ret Json.1264;
procedure List.145 (List.146, List.147, List.144):
let List.566 : {List U8, U64} = CallByName Json.266 List.146 List.147 List.144;
let List.566 : {List U8, U64} = CallByName TotallyNotJson.267 List.146 List.147 List.144;
ret List.566;
procedure List.145 (List.146, List.147, List.144):
let List.639 : {List U8, U64} = CallByName Json.266 List.146 List.147 List.144;
let List.639 : {List U8, U64} = CallByName TotallyNotJson.267 List.146 List.147 List.144;
ret List.639;
procedure List.18 (List.142, List.143, List.144):
@ -336,18 +218,136 @@ procedure Test.5 (Test.6, Test.7, Test.4):
let Test.32 : {} = StructAtIndex 0 Test.4;
let Test.31 : [C {}, C {}] = CallByName #Derived.0 Test.32;
let Test.30 : List [C {}, C {}] = Array [Test.31];
let Test.22 : {Str, List [C {}, C {}]} = CallByName Json.31 Test.29 Test.30;
let Test.22 : {Str, List [C {}, C {}]} = CallByName TotallyNotJson.32 Test.29 Test.30;
jump Test.23 Test.22;
else
let Test.24 : Str = "B";
let Test.27 : {} = StructAtIndex 1 Test.4;
let Test.26 : [C {}, C {}] = CallByName #Derived.5 Test.27;
let Test.25 : List [C {}, C {}] = Array [Test.26];
let Test.22 : {Str, List [C {}, C {}]} = CallByName Json.31 Test.24 Test.25;
let Test.22 : {Str, List [C {}, C {}]} = CallByName TotallyNotJson.32 Test.24 Test.25;
jump Test.23 Test.22;
procedure TotallyNotJson.2 ():
let TotallyNotJson.1172 : [C , C [], C , C , C , C ] = TagId(2) ;
ret TotallyNotJson.1172;
procedure TotallyNotJson.264 (TotallyNotJson.265, TotallyNotJson.1175, #Attr.12):
let TotallyNotJson.263 : List [C {}, C {}] = StructAtIndex 1 #Attr.12;
let TotallyNotJson.262 : Str = StructAtIndex 0 #Attr.12;
let TotallyNotJson.1213 : I64 = 123i64;
let TotallyNotJson.1212 : U8 = CallByName Num.127 TotallyNotJson.1213;
let TotallyNotJson.1209 : List U8 = CallByName List.4 TotallyNotJson.265 TotallyNotJson.1212;
let TotallyNotJson.1211 : I64 = 34i64;
let TotallyNotJson.1210 : U8 = CallByName Num.127 TotallyNotJson.1211;
let TotallyNotJson.1207 : List U8 = CallByName List.4 TotallyNotJson.1209 TotallyNotJson.1210;
let TotallyNotJson.1208 : List U8 = CallByName Str.12 TotallyNotJson.262;
let TotallyNotJson.1204 : List U8 = CallByName List.8 TotallyNotJson.1207 TotallyNotJson.1208;
let TotallyNotJson.1206 : I64 = 34i64;
let TotallyNotJson.1205 : U8 = CallByName Num.127 TotallyNotJson.1206;
let TotallyNotJson.1201 : List U8 = CallByName List.4 TotallyNotJson.1204 TotallyNotJson.1205;
let TotallyNotJson.1203 : I64 = 58i64;
let TotallyNotJson.1202 : U8 = CallByName Num.127 TotallyNotJson.1203;
let TotallyNotJson.1198 : List U8 = CallByName List.4 TotallyNotJson.1201 TotallyNotJson.1202;
let TotallyNotJson.1200 : I64 = 91i64;
let TotallyNotJson.1199 : U8 = CallByName Num.127 TotallyNotJson.1200;
let TotallyNotJson.268 : List U8 = CallByName List.4 TotallyNotJson.1198 TotallyNotJson.1199;
let TotallyNotJson.1197 : U64 = CallByName List.6 TotallyNotJson.263;
let TotallyNotJson.1185 : {List U8, U64} = Struct {TotallyNotJson.268, TotallyNotJson.1197};
let TotallyNotJson.1184 : {List U8, U64} = CallByName List.18 TotallyNotJson.263 TotallyNotJson.1185 TotallyNotJson.1175;
let TotallyNotJson.270 : List U8 = StructAtIndex 0 TotallyNotJson.1184;
let TotallyNotJson.1183 : I64 = 93i64;
let TotallyNotJson.1182 : U8 = CallByName Num.127 TotallyNotJson.1183;
let TotallyNotJson.1179 : List U8 = CallByName List.4 TotallyNotJson.270 TotallyNotJson.1182;
let TotallyNotJson.1181 : I64 = 125i64;
let TotallyNotJson.1180 : U8 = CallByName Num.127 TotallyNotJson.1181;
let TotallyNotJson.1178 : List U8 = CallByName List.4 TotallyNotJson.1179 TotallyNotJson.1180;
ret TotallyNotJson.1178;
procedure TotallyNotJson.264 (TotallyNotJson.265, TotallyNotJson.1175, #Attr.12):
let TotallyNotJson.263 : List [] = StructAtIndex 1 #Attr.12;
let TotallyNotJson.262 : Str = StructAtIndex 0 #Attr.12;
let TotallyNotJson.1264 : I64 = 123i64;
let TotallyNotJson.1263 : U8 = CallByName Num.127 TotallyNotJson.1264;
let TotallyNotJson.1260 : List U8 = CallByName List.4 TotallyNotJson.265 TotallyNotJson.1263;
let TotallyNotJson.1262 : I64 = 34i64;
let TotallyNotJson.1261 : U8 = CallByName Num.127 TotallyNotJson.1262;
let TotallyNotJson.1258 : List U8 = CallByName List.4 TotallyNotJson.1260 TotallyNotJson.1261;
let TotallyNotJson.1259 : List U8 = CallByName Str.12 TotallyNotJson.262;
let TotallyNotJson.1255 : List U8 = CallByName List.8 TotallyNotJson.1258 TotallyNotJson.1259;
let TotallyNotJson.1257 : I64 = 34i64;
let TotallyNotJson.1256 : U8 = CallByName Num.127 TotallyNotJson.1257;
let TotallyNotJson.1252 : List U8 = CallByName List.4 TotallyNotJson.1255 TotallyNotJson.1256;
let TotallyNotJson.1254 : I64 = 58i64;
let TotallyNotJson.1253 : U8 = CallByName Num.127 TotallyNotJson.1254;
let TotallyNotJson.1249 : List U8 = CallByName List.4 TotallyNotJson.1252 TotallyNotJson.1253;
let TotallyNotJson.1251 : I64 = 91i64;
let TotallyNotJson.1250 : U8 = CallByName Num.127 TotallyNotJson.1251;
let TotallyNotJson.268 : List U8 = CallByName List.4 TotallyNotJson.1249 TotallyNotJson.1250;
let TotallyNotJson.1248 : U64 = CallByName List.6 TotallyNotJson.263;
let TotallyNotJson.1236 : {List U8, U64} = Struct {TotallyNotJson.268, TotallyNotJson.1248};
let TotallyNotJson.1235 : {List U8, U64} = CallByName List.18 TotallyNotJson.263 TotallyNotJson.1236 TotallyNotJson.1175;
let TotallyNotJson.270 : List U8 = StructAtIndex 0 TotallyNotJson.1235;
let TotallyNotJson.1234 : I64 = 93i64;
let TotallyNotJson.1233 : U8 = CallByName Num.127 TotallyNotJson.1234;
let TotallyNotJson.1230 : List U8 = CallByName List.4 TotallyNotJson.270 TotallyNotJson.1233;
let TotallyNotJson.1232 : I64 = 125i64;
let TotallyNotJson.1231 : U8 = CallByName Num.127 TotallyNotJson.1232;
let TotallyNotJson.1229 : List U8 = CallByName List.4 TotallyNotJson.1230 TotallyNotJson.1231;
ret TotallyNotJson.1229;
procedure TotallyNotJson.267 (TotallyNotJson.1177, TotallyNotJson.273, TotallyNotJson.266):
let TotallyNotJson.271 : List U8 = StructAtIndex 0 TotallyNotJson.1177;
let TotallyNotJson.272 : U64 = StructAtIndex 1 TotallyNotJson.1177;
let TotallyNotJson.274 : List U8 = CallByName Encode.24 TotallyNotJson.271 TotallyNotJson.273 TotallyNotJson.266;
joinpoint TotallyNotJson.1191 TotallyNotJson.275:
let TotallyNotJson.1189 : U64 = 1i64;
let TotallyNotJson.1188 : U64 = CallByName Num.20 TotallyNotJson.272 TotallyNotJson.1189;
let TotallyNotJson.1187 : {List U8, U64} = Struct {TotallyNotJson.275, TotallyNotJson.1188};
ret TotallyNotJson.1187;
in
let TotallyNotJson.1195 : U64 = 1i64;
let TotallyNotJson.1192 : Int1 = CallByName Num.24 TotallyNotJson.272 TotallyNotJson.1195;
if TotallyNotJson.1192 then
let TotallyNotJson.1194 : I64 = 44i64;
let TotallyNotJson.1193 : U8 = CallByName Num.127 TotallyNotJson.1194;
let TotallyNotJson.1190 : List U8 = CallByName List.4 TotallyNotJson.274 TotallyNotJson.1193;
jump TotallyNotJson.1191 TotallyNotJson.1190;
else
jump TotallyNotJson.1191 TotallyNotJson.274;
procedure TotallyNotJson.267 (TotallyNotJson.1177, TotallyNotJson.273, TotallyNotJson.266):
let TotallyNotJson.271 : List U8 = StructAtIndex 0 TotallyNotJson.1177;
let TotallyNotJson.272 : U64 = StructAtIndex 1 TotallyNotJson.1177;
let TotallyNotJson.274 : List U8 = CallByName Encode.24 TotallyNotJson.271 TotallyNotJson.273 TotallyNotJson.266;
joinpoint TotallyNotJson.1242 TotallyNotJson.275:
let TotallyNotJson.1240 : U64 = 1i64;
let TotallyNotJson.1239 : U64 = CallByName Num.20 TotallyNotJson.272 TotallyNotJson.1240;
let TotallyNotJson.1238 : {List U8, U64} = Struct {TotallyNotJson.275, TotallyNotJson.1239};
ret TotallyNotJson.1238;
in
let TotallyNotJson.1246 : U64 = 1i64;
let TotallyNotJson.1243 : Int1 = CallByName Num.24 TotallyNotJson.272 TotallyNotJson.1246;
if TotallyNotJson.1243 then
let TotallyNotJson.1245 : I64 = 44i64;
let TotallyNotJson.1244 : U8 = CallByName Num.127 TotallyNotJson.1245;
let TotallyNotJson.1241 : List U8 = CallByName List.4 TotallyNotJson.274 TotallyNotJson.1244;
jump TotallyNotJson.1242 TotallyNotJson.1241;
else
jump TotallyNotJson.1242 TotallyNotJson.274;
procedure TotallyNotJson.32 (TotallyNotJson.262, TotallyNotJson.263):
let TotallyNotJson.1215 : {Str, List [C {}, C {}]} = Struct {TotallyNotJson.262, TotallyNotJson.263};
let TotallyNotJson.1214 : {Str, List [C {}, C {}]} = CallByName Encode.23 TotallyNotJson.1215;
ret TotallyNotJson.1214;
procedure TotallyNotJson.32 (TotallyNotJson.262, TotallyNotJson.263):
let TotallyNotJson.1266 : {Str, List []} = Struct {TotallyNotJson.262, TotallyNotJson.263};
let TotallyNotJson.1265 : {Str, List []} = CallByName Encode.23 TotallyNotJson.1266;
ret TotallyNotJson.1265;
procedure Test.0 ():
let Test.13 : {{}, {}} = CallByName Test.3;
let Test.14 : [C , C [], C , C , C , C ] = CallByName Json.1;
let Test.14 : [C , C [], C , C , C , C ] = CallByName TotallyNotJson.2;
let Test.12 : List U8 = CallByName Encode.26 Test.13 Test.14;
ret Test.12;

View file

@ -1476,7 +1476,7 @@ fn encode_custom_type() {
indoc!(
r#"
app "test"
imports [Encode.{ toEncoder }, Json]
imports [Encode.{ toEncoder }, TotallyNotJson]
provides [main] to "./platform"
HelloWorld := {}
@ -1486,7 +1486,7 @@ fn encode_custom_type() {
|> Encode.appendWith (Encode.string "Hello, World!\n") fmt
main =
result = Str.fromUtf8 (Encode.toBytes (@HelloWorld {}) Json.json)
result = Str.fromUtf8 (Encode.toBytes (@HelloWorld {}) TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -1499,11 +1499,11 @@ fn encode_derived_string() {
indoc!(
r#"
app "test"
imports [Encode.{ toEncoder }, Json]
imports [Encode.{ toEncoder }, TotallyNotJson]
provides [main] to "./platform"
main =
result = Str.fromUtf8 (Encode.toBytes "abc" Json.json)
result = Str.fromUtf8 (Encode.toBytes "abc" TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -1517,11 +1517,11 @@ fn encode_derived_record() {
indoc!(
r#"
app "test"
imports [Encode.{ toEncoder }, Json]
imports [Encode.{ toEncoder }, TotallyNotJson]
provides [main] to "./platform"
main =
result = Str.fromUtf8 (Encode.toBytes {a: "a"} Json.json)
result = Str.fromUtf8 (Encode.toBytes {a: "a"} TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -1859,11 +1859,11 @@ fn encode_derived_record_one_field_string() {
indoc!(
r#"
app "test"
imports [Encode.{ toEncoder }, Json]
imports [Encode.{ toEncoder }, TotallyNotJson]
provides [main] to "./platform"
main =
result = Str.fromUtf8 (Encode.toBytes {a: "foo"} Json.json)
result = Str.fromUtf8 (Encode.toBytes {a: "foo"} TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -1876,11 +1876,11 @@ fn encode_derived_record_two_field_strings() {
indoc!(
r#"
app "test"
imports [Encode.{ toEncoder }, Json]
imports [Encode.{ toEncoder }, TotallyNotJson]
provides [main] to "./platform"
main =
result = Str.fromUtf8 (Encode.toBytes {a: "foo", b: "bar"} Json.json)
result = Str.fromUtf8 (Encode.toBytes {a: "foo", b: "bar"} TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -1893,11 +1893,11 @@ fn encode_derived_nested_record_string() {
indoc!(
r#"
app "test"
imports [Encode.{ toEncoder }, Json]
imports [Encode.{ toEncoder }, TotallyNotJson]
provides [main] to "./platform"
main =
result = Str.fromUtf8 (Encode.toBytes {a: {b: "bar"}} Json.json)
result = Str.fromUtf8 (Encode.toBytes {a: {b: "bar"}} TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -1910,13 +1910,13 @@ fn encode_derived_tag_one_field_string() {
indoc!(
r#"
app "test"
imports [Encode.{ toEncoder }, Json]
imports [Encode.{ toEncoder }, TotallyNotJson]
provides [main] to "./platform"
main =
x : [A Str]
x = A "foo"
result = Str.fromUtf8 (Encode.toBytes x Json.json)
result = Str.fromUtf8 (Encode.toBytes x TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -1951,13 +1951,13 @@ fn encode_derived_tag_two_payloads_string() {
indoc!(
r#"
app "test"
imports [Encode.{ toEncoder }, Json]
imports [Encode.{ toEncoder }, TotallyNotJson]
provides [main] to "./platform"
main =
x : [A Str Str]
x = A "foo" "foo"
result = Str.fromUtf8 (Encode.toBytes x Json.json)
result = Str.fromUtf8 (Encode.toBytes x TotallyNotJson.json)
when result is
Ok s -> s
_ -> "<bad>"
@ -2224,11 +2224,11 @@ fn issue_4705() {
fn issue_4749() {
indoc!(
r###"
interface Test exposes [] imports [Json]
interface Test exposes [] imports [TotallyNotJson]
expect
input = [82, 111, 99]
got = Decode.fromBytes input Json.json
got = Decode.fromBytes input TotallyNotJson.json
got == Ok "Roc"
"###
)
@ -2464,10 +2464,10 @@ fn function_specialization_information_in_lambda_set_thunk_independent_defs() {
fn issue_4772_weakened_monomorphic_destructure() {
indoc!(
r###"
interface Test exposes [] imports [Json]
interface Test exposes [] imports [TotallyNotJson]
getNumber =
{ result, rest } = Decode.fromBytesPartial (Str.toUtf8 "-1234") Json.json
{ result, rest } = Decode.fromBytesPartial (Str.toUtf8 "-1234") TotallyNotJson.json
when result is
Ok val ->
@ -2661,7 +2661,7 @@ fn unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unifica
// rather than collapsing to `[[] + [A, B]:toEncoder:1]`.
indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
Q a b := { a: a, b: b } implements [Encoding {toEncoder: toEncoderQ}]
@ -2676,7 +2676,7 @@ fn unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unifica
accessor = @Q {a : A, b: B}
main =
Encode.toBytes accessor Json.json
Encode.toBytes accessor TotallyNotJson.json
"#
)
}
@ -2699,7 +2699,7 @@ fn unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_ty
// `t.a` and `t.b` are filled in.
indoc!(
r#"
app "test" imports [Json] provides [main] to "./platform"
app "test" imports [TotallyNotJson] provides [main] to "./platform"
Q a b := { a: a, b: b } implements [Encoding {toEncoder: toEncoderQ}]
@ -2716,7 +2716,7 @@ fn unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_ty
@Q {a : x, b: x}
main =
Encode.toBytes accessor Json.json
Encode.toBytes accessor TotallyNotJson.json
"#
)
}

View file

@ -1,5 +1,5 @@
app "test"
imports [Json]
imports [TotallyNotJson]
provides [main] to "./platform"
HelloWorld := {} implements [Encoding {toEncoder}]
@ -10,7 +10,7 @@ toEncoder = \@HelloWorld {} ->
|> Encode.appendWith (Encode.string "Hello, World!\n") fmt
f =
when Str.fromUtf8 (Encode.toBytes (@HelloWorld {}) Json.json) is
when Str.fromUtf8 (Encode.toBytes (@HelloWorld {}) TotallyNotJson.json) is
Ok s -> s
_ -> "<bad>"