diff options
-rw-r--r-- | mu.arc | 3 | ||||
-rw-r--r-- | mu.arc.t | 14 |
2 files changed, 16 insertions, 1 deletions
diff --git a/mu.arc b/mu.arc index 384316a4..4e7a9f00 100644 --- a/mu.arc +++ b/mu.arc @@ -165,7 +165,7 @@ (def m (loc) ; read memory, respecting metadata (point return - (if (is 'literal ty.loc) + (if (in ty.loc 'literal 'offset) (return v.loc)) (assert (isa v.loc 'int)) (trace "m" loc " " sz.loc) @@ -384,6 +384,7 @@ (with (base arg.0 ; integer (non-symbol) memory location including metadata idx (v arg.1)) ; literal integer ;? (prn base ": " (memory* v.base)) + (assert (in (ty arg.1) 'literal 'offset)) (when typeinfo.base!address (assert (pos 'deref metadata.base)) (= base (list (memory* v.base) typeinfo.base!elem))) diff --git a/mu.arc.t b/mu.arc.t index a715b76b..16fd72b8 100644 --- a/mu.arc.t +++ b/mu.arc.t @@ -1395,6 +1395,20 @@ (prn "F - default-scope implicitly modifies variable locations"))) (reset) +(new-trace "set-default-scope-skips-offset") +(add-fns + '((main + ((default-scope scope-address) <- new (scope type) (2 literal)) + ((1 integer) <- copy (23 offset))))) +(let before Memory-in-use-until +;? (set dump-trace*) + (run 'main) +;? (prn memory*) + (if (~and (~is 23 memory*.1) + (is 23 (memory* (+ before 1)))) + (prn "F - default-scope skips 'offset' types just like literals"))) + +(reset) (new-trace "default-scope-bounds-check") (add-fns '((main |