Skip to content

Commit

Permalink
Make sure P_vector_subrange ids are returned by check_pattern_duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
Alasdair committed May 6, 2024
1 parent c779d64 commit ba9f7f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/type_check.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1600,7 +1600,7 @@ let check_pattern_duplicates env pat =
Err_other "Regular binding is here"
)
)
| None -> ()
| None -> ids := Bindings.add subrange_id (Pattern_singleton l) !ids
)
!subrange_ids;
!ids
Expand Down
1 change: 1 addition & 0 deletions src/lib/type_error.mli
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ val analyze_unresolved_quant :

val string_of_type_error : type_error -> string * string option

(** Convert a type error into a general purpose error from the Reporting file *)
val to_reporting_exn : Parse_ast.l -> type_error -> exn

val check_defs : Type_check.Env.t -> uannot Ast.def list -> Type_check.tannot Ast.def list * Type_check.Env.t
Expand Down
11 changes: 11 additions & 0 deletions test/typecheck/pass/vector_subrange_mapping.sail
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
default Order dec

$include <prelude.sail>

union Foo = {
Bar : bits(32)
}

mapping baz : Foo <-> bits(32) = {
Bar(imm) <-> imm[31 .. 16] @ imm[15 .. 0]
}

0 comments on commit ba9f7f1

Please sign in to comment.