Skip to content

Commit

Permalink
Fix shape comparison when container is missing fields
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed May 21, 2024
1 parent a0bbb48 commit 9bf7692
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/ttype/type_comparator/dict_type_comparator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ pub(crate) fn is_contained_by(

if all_types_contain {
match (input_params, container_params) {
(None, None) => {}
(None, None) => {
if !input_known_items
.keys()
.all(|k| container_known_items.contains_key(k))
{
all_types_contain = false;
}
}
(None, Some(_)) => {}
(Some(_), None) => {
all_types_contain = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function foo(shape('a' => id_t, ?'b' => int) $arr): void {
bar($arr as shape('a' => string));
}

function bar(shape('a' => string) $arr): void {}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
newtype id_t as string = string;

0 comments on commit 9bf7692

Please sign in to comment.