diff options
| author | Thomas Bauereiss | 2017-07-26 12:03:12 +0100 |
|---|---|---|
| committer | Thomas Bauereiss | 2017-07-26 12:03:12 +0100 |
| commit | 26e59493cde0ffbf1868426fe3bec158f2dbaad0 (patch) | |
| tree | 2193492e4989608eb5d2fef9ed3a60aa84b9c316 /test/typecheck | |
| parent | eae4d12ad793809482252be0b459bb7e634b5482 (diff) | |
Improve rewriting of sizeof expressions
If some type-level variables in a sizeof expression in a function body cannot
be directly extracted from the parameters of the function, add a new parameter
for each unresolved parameter, and rewrite calls to the function accordingly
Diffstat (limited to 'test/typecheck')
| -rw-r--r-- | test/typecheck/pass/sizeof_vector_start_index.sail | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/typecheck/pass/sizeof_vector_start_index.sail b/test/typecheck/pass/sizeof_vector_start_index.sail new file mode 100644 index 00000000..6ad8ef06 --- /dev/null +++ b/test/typecheck/pass/sizeof_vector_start_index.sail @@ -0,0 +1,12 @@ +val forall Num 'n, Num 'm, Order 'ord, Type 'a. vector<'n,'m,'ord,'a> -> [:'n:] effect pure vector_start_index + +function forall Num 'n, Num 'm, Order 'ord, Type 'a. [:'n:] vector_start_index ((vector<'n,'m,'ord,'a>) vec) = +{ + sizeof 'n +} + +function int test ((vector<47,11,dec,bit>) vec) = +{ + vector_start_index(vec) +} + |
