From a3355a59c0727e58519a94a8f65013beb9c2331b Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Sun, 24 Nov 2024 18:55:30 +0100 Subject: [PATCH] update on incomplete example --- lang/README.md | 2 +- lang/tests/son_tests_generic_types.txt | 136 ++----------------------- 2 files changed, 7 insertions(+), 131 deletions(-) diff --git a/lang/README.md b/lang/README.md index 13bcf80a..42656917 100644 --- a/lang/README.md +++ b/lang/README.md @@ -659,8 +659,8 @@ push := fn($Elem: type, vec: ^Vec(Elem), value: Elem): ?^Elem { main := fn(): uint { vec := new(uint) _f := push(uint, &vec, 69) + defer deinit(uint, &vec) res := *vec.data - deinit(uint, &vec) return res } ``` diff --git a/lang/tests/son_tests_generic_types.txt b/lang/tests/son_tests_generic_types.txt index 0c2f6733..2131f024 100644 --- a/lang/tests/son_tests_generic_types.txt +++ b/lang/tests/son_tests_generic_types.txt @@ -1,130 +1,6 @@ -deinit: - ADDI64 r254, r254, -40d - ST r31, r254, 0a, 40h - CP r32, r2 - LD r33, r32, 16a, 8h - LI64 r34, 8d - MUL64 r33, r33, r34 - LD r35, r32, 0a, 8h - CP r2, r35 - CP r3, r33 - CP r4, r34 - JAL r31, r0, :free - CP r1, r32 - JAL r31, r0, :new - LD r31, r254, 0a, 40h - ADDI64 r254, r254, 40d - JALA r0, r31, 0a -free: - CP r13, r2 - CP r14, r3 - CP r15, r4 - LRA r16, r0, :free_sys_call - LD r16, r16, 0a, 8h - CP r2, r16 - CP r3, r13 - CP r4, r14 - CP r5, r15 - ECA - JALA r0, r31, 0a -main: - ADDI64 r254, r254, -56d - ST r31, r254, 24a, 32h - ADDI64 r32, r254, 0d - CP r1, r32 - JAL r31, r0, :new - LI64 r33, 69d - CP r2, r32 - CP r3, r33 - JAL r31, r0, :push - CP r33, r1 - LD r34, r254, 0a, 8h - LD r33, r34, 0a, 8h - CP r2, r32 - JAL r31, r0, :deinit - CP r1, r33 - LD r31, r254, 24a, 32h - ADDI64 r254, r254, 56d - JALA r0, r31, 0a -malloc: - CP r13, r2 - CP r14, r3 - LRA r15, r0, :malloc_sys_call - LD r15, r15, 0a, 8h - CP r2, r15 - CP r3, r13 - CP r4, r14 - ECA - CP r13, r1 - CP r1, r13 - JALA r0, r31, 0a -new: - ADDI64 r254, r254, -24d - CP r14, r1 - ADDI64 r13, r254, 0d - ST r0, r254, 0a, 8h - ST r0, r254, 8a, 8h - ST r0, r254, 16a, 8h - BMC r13, r14, 24h - ADDI64 r254, r254, 24d - JALA r0, r31, 0a -push: - ADDI64 r254, r254, -88d - ST r31, r254, 0a, 88h - CP r38, r2 - CP r39, r3 - LI64 r37, 1d - LD r33, r38, 8a, 8h - LD r32, r38, 16a, 8h - JNE r32, r33, :0 - JNE r32, r0, :1 - CP r32, r37 - JMP :2 - 1: MULI64 r32, r32, 2d - 2: LI64 r40, 8d - MUL64 r34, r32, r40 - CP r2, r34 - CP r3, r40 - JAL r31, r0, :malloc - CP r35, r1 - ST r32, r38, 16a, 8h - JNE r35, r0, :3 - CP r1, r0 - JMP :4 - 3: MULI64 r33, r33, 8d - LD r32, r38, 0a, 8h - ADD64 r41, r32, r33 - CP r34, r35 - 7: LD r33, r38, 0a, 8h - LD r36, r38, 8a, 8h - JNE r41, r32, :5 - JEQ r36, r0, :6 - MUL64 r32, r36, r40 - CP r2, r33 - CP r3, r32 - CP r4, r40 - JAL r31, r0, :free - JMP :6 - 6: ST r35, r38, 0a, 8h - JMP :0 - 5: ADDI64 r36, r34, 8d - ADDI64 r33, r32, 8d - LD r32, r32, 0a, 8h - ST r32, r34, 0a, 8h - CP r34, r36 - CP r32, r33 - JMP :7 - 0: LD r32, r38, 8a, 8h - MULI64 r33, r32, 8d - LD r34, r38, 0a, 8h - ADD64 r33, r34, r33 - ST r39, r33, 0a, 8h - ADD64 r32, r32, r37 - ST r32, r38, 8a, 8h - CP r1, r33 - 4: LD r31, r254, 0a, 88h - ADDI64 r254, r254, 88d - JALA r0, r31, 0a -code size: 923 -ret: 69 -status: Ok(()) +test.hb:60:22: somehow this was not found + defer deinit(uint, &vec) + ^ +test.hb:60:21: expected argument vec to be of type ^[Struct0]{data: ^uint, len: uint, cap: uint}, got ^never + defer deinit(uint, &vec) + ^