diff options
author | Son Ho | 2023-08-18 10:44:01 +0200 |
---|---|---|
committer | Son Ho | 2023-08-18 10:44:01 +0200 |
commit | a9c256fe95523842a1ff025e73f6e9ce7c2db38a (patch) | |
tree | 719ddcd09d212c4c69c6d406ee6e024c0ef277ef /compiler | |
parent | 26c25bf375742cf4d5a0ab160b9646e90c067f18 (diff) |
Add tests which use const generics as values
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/PureMicroPasses.ml | 4 | ||||
-rw-r--r-- | compiler/PureUtils.ml | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/compiler/PureMicroPasses.ml b/compiler/PureMicroPasses.ml index 65dc7ff2..b2f3bb9f 100644 --- a/compiler/PureMicroPasses.ml +++ b/compiler/PureMicroPasses.ml @@ -681,8 +681,8 @@ let inline_useless_var_reassignments (inline_named : bool) (inline_pure : bool) | _ -> false in (* And either: - * 2.1 the right-expression is a variable or a global *) - let var_or_global = is_var re || is_global re in + * 2.1 the right-expression is a variable, a global or a const generic var *) + let var_or_global = is_var re || is_cvar re || is_global re in (* Or: * 2.2 the right-expression is a constant value, an ADT value, * a projection or a primitive function call *and* the flag diff --git a/compiler/PureUtils.ml b/compiler/PureUtils.ml index 461098f2..f099ef9c 100644 --- a/compiler/PureUtils.ml +++ b/compiler/PureUtils.ml @@ -185,6 +185,9 @@ let is_var (e : texpression) : bool = let as_var (e : texpression) : VarId.id = match e.e with Var v -> v | _ -> raise (Failure "Unreachable") +let is_cvar (e : texpression) : bool = + match e.e with CVar _ -> true | _ -> false + let is_global (e : texpression) : bool = match e.e with Qualif { id = Global _; _ } -> true | _ -> false |