diff options
| author | Baitinq <[email protected]> | 2025-05-24 01:28:51 +0200 |
|---|---|---|
| committer | Baitinq <[email protected]> | 2025-05-24 01:28:51 +0200 |
| commit | 752e5a18f57dd765b47d46a552e5db389ca62b53 (patch) | |
| tree | 032cb4d64ceeb014979677a9cc5d5ec06d002a3c /examples/18.src | |
| parent | Codegen: Typecheck binary expressions (diff) | |
| download | pry-lang-752e5a18f57dd765b47d46a552e5db389ca62b53.tar.gz pry-lang-752e5a18f57dd765b47d46a552e5db389ca62b53.tar.bz2 pry-lang-752e5a18f57dd765b47d46a552e5db389ca62b53.zip | |
Codegen: Fix bug with typecheck of return of function params
Diffstat (limited to 'examples/18.src')
| -rw-r--r-- | examples/18.src | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/examples/18.src b/examples/18.src index 29facd5..17c9fee 100644 --- a/examples/18.src +++ b/examples/18.src @@ -1,18 +1,18 @@ -extern malloc = (i64) => *i64; -extern free = (*i64) => void; +extern malloc = (i64) => *void; +extern free = (*void) => void; import "!stdlib.src"; let main = () => i64 { - let x = malloc(24); - (*(x+0)) = 10; - (*(x+1)) = 20; - (*(x+2)) = 40; + let x = cast(*i8, malloc(24)); + (*(x+cast(*i8, 0))) = 10; + (*(x+cast(*i8, 1))) = 20; + (*(x+cast(*i8, 2))) = 40; println("%p", x); - println("%d", *(x+0)); - println("%d", *(x+1)); - println("%d", *(x+2)); - free(x); + println("%d", *(x+cast(*i8, 0))); + println("%d", *(x+cast(*i8, 1))); + println("%d", *(x+cast(*i8, 2))); + free(cast(*void, x)); return 0; }; |