slovo/tests/primitive-struct-fields.checked.lower
2026-05-22 08:38:43 +02:00

100 lines
3.2 KiB
Plaintext

program main
struct PrimitiveRecord
field id: i32
field active: bool
field label: string
fn make_record(id: i32, label: string) -> PrimitiveRecord
construct PrimitiveRecord : PrimitiveRecord
field id
var id : i32
field active
binary = : bool
var id : i32
int 7 : i32
field label
var label : string
fn expected_record() -> PrimitiveRecord
call make_record : PrimitiveRecord
int 7 : i32
string "alpha" : string
fn inactive_record() -> PrimitiveRecord
construct PrimitiveRecord : PrimitiveRecord
field id
int 3 : i32
field active
bool false : bool
field label
string "beta" : string
fn echo_record(record: PrimitiveRecord) -> PrimitiveRecord
var record : PrimitiveRecord
fn local_record(label: string) -> PrimitiveRecord
local let record : unit
call make_record : PrimitiveRecord
int 7 : i32
var label : string
call echo_record : PrimitiveRecord
var record : PrimitiveRecord
fn record_id(record: PrimitiveRecord) -> i32
field-access id : i32
var record : PrimitiveRecord
fn record_active(record: PrimitiveRecord) -> bool
field-access active : bool
var record : PrimitiveRecord
fn record_label(record: PrimitiveRecord) -> string
field-access label : string
var record : PrimitiveRecord
fn label_matches(record: PrimitiveRecord, label: string) -> bool
binary = : bool
field-access label : string
var record : PrimitiveRecord
var label : string
fn active_score(record: PrimitiveRecord) -> i32
if : i32
field-access active : bool
var record : PrimitiveRecord
field-access id : i32
var record : PrimitiveRecord
int 0 : i32
fn label_len(record: PrimitiveRecord) -> i32
call std.string.len : i32
field-access label : string
var record : PrimitiveRecord
fn main() -> i32
call active_score : i32
call local_record : PrimitiveRecord
string "alpha" : string
test "primitive struct i32 field access"
binary = : bool
call record_id : i32
call expected_record : PrimitiveRecord
int 7 : i32
test "primitive struct bool field predicate"
call record_active : bool
call expected_record : PrimitiveRecord
test "primitive struct bool field false branch"
binary = : bool
call active_score : i32
call inactive_record : PrimitiveRecord
int 0 : i32
test "primitive struct string field equality"
call label_matches : bool
call expected_record : PrimitiveRecord
string "alpha" : string
test "primitive struct string field length"
binary = : bool
call label_len : i32
call expected_record : PrimitiveRecord
int 5 : i32
test "primitive struct local param return call flow"
binary = : bool
call active_score : i32
call local_record : PrimitiveRecord
string "alpha" : string
int 7 : i32
test "primitive struct string field access return"
binary = : bool
call record_label : string
call local_record : PrimitiveRecord
string "alpha" : string
string "alpha" : string