Skip to content

Commit df982ed

Browse files
committed
fix: lower nested call expr correctly
1 parent 047c94f commit df982ed

3 files changed

Lines changed: 40 additions & 5 deletions

File tree

libs/@local/hashql/ast/src/lower/expander/type.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ where
4949
hashql_core::module::item::ItemKind::Intrinsic(IntrinsicItem::Type(type_intrinsic)),
5050
},
5151
has_arguments: _, // We don't care here, intrinsics never have arguments
52-
}) = expander.with_universe(hashql_core::module::Universe::Type, |expander| {
52+
}) = expander.with_universe(Universe::Type, |expander| {
5353
expander.visit(&mut call.function)
5454
})
5555
else {
@@ -68,7 +68,11 @@ where
6868
};
6969

7070
let mut types = Vec::with_capacity_in(call.arguments.len(), expander.heap);
71-
for argument in call.arguments {
71+
for mut argument in call.arguments {
72+
expander.with_universe(Universe::Type, |expander| {
73+
expander.visit(&mut argument.value)
74+
});
75+
7276
types.push(lower_expr_to_type(expander, argument.value));
7377
}
7478

@@ -389,9 +393,8 @@ where
389393
}
390394
},
391395
|expander, constraints| {
392-
let item = expander.with_universe(hashql_core::module::Universe::Type, |expander| {
393-
expander.visit(&mut value)
394-
});
396+
let item =
397+
expander.with_universe(Universe::Type, |expander| expander.visit(&mut value));
395398

396399
if let Some(CurrentItem {
397400
item:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//@ run: pass
2+
//@ description: nested unions should be expanded correctly
3+
["type", "Foo", ["|", "Integer", ["|", "String", "Never"]], "_"]

libs/@local/hashql/ast/tests/ui/lower/expander/nested-union.stdout

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)