Skip to content

Commit

Permalink
fix: 修复struct type check时的bug
Browse files Browse the repository at this point in the history
过去检查struct的type时,还检查声明和使用的span是否一致(显然不可能一致),所以会报错

现在使用ty_eq函数,确保只检查type而不检查其span
  • Loading branch information
MMZK1526 committed Sep 9, 2024
1 parent 865113c commit eb882ab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Semantics/Walker.ml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ let rec walk_expr (context:context) (expr:expr) : typ =
let map_field_expr ((field, expr)) =
(field, walk_expr context expr)
in
if List.map map_def_field def_fields = List.map map_field_expr field_exprs then
if List.equal (fun (f1, t1) (f2, t2) -> f1 = f2 && Helper.ty_eq t1 t2) (List.map map_def_field def_fields) (List.map map_field_expr field_exprs) then
Helper.named name []
else
error_type (Error (" types doesn't match with fields of Struct " ^ name))
Expand Down

0 comments on commit eb882ab

Please sign in to comment.