From 92cc1f00a842b33847b63c4c65181eccfb74a5fc Mon Sep 17 00:00:00 2001 From: peony Date: Sun, 3 Nov 2024 15:03:59 +0100 Subject: [PATCH] Added `null_check_test` --- lang/README.md | 14 ++++++++++++++ lang/src/son.rs | 1 + 2 files changed, 15 insertions(+) diff --git a/lang/README.md b/lang/README.md index e82e146..f75e8f0 100644 --- a/lang/README.md +++ b/lang/README.md @@ -965,6 +965,20 @@ main := fn(): uint { } ``` +#### null_check_test +```hb +main := fn(): unit { + ptr := @as(?^uint, null) + *ptr = 0 + + if ptr == null { + return 1 + } + + return *ptr +} +``` + ### Just Testing Optimizations #### const_folding_with_arg diff --git a/lang/src/son.rs b/lang/src/son.rs index 74bcaad..779e819 100644 --- a/lang/src/son.rs +++ b/lang/src/son.rs @@ -4058,6 +4058,7 @@ mod tests { writing_into_string; request_page; tests_ptr_to_ptr_copy; + null_check_test; // Just Testing Optimizations; const_folding_with_arg;