Skip to content

Commit a7c605c

Browse files
Resolve algebraic type refs recursively for view type check (#3876)
# Description of Changes Resolves algebraic type refs recursively in order to check the product type of a query builder view. This should fix the issue reported [here](https://discord.com/channels/1037340874172014652/1448796556366057513). However I've so far been unsuccessful in trying repro it. Also adds further commentary to `Typespace::resolve` to make it clear that it is not recursive. # API and ABI breaking changes None # Expected complexity level and risk 0 # Testing TODO. So far I haven't been able to repro with a smoketest
1 parent e9d2b11 commit a7c605c

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

crates/core/src/host/wasm_common/module_host_actor.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,8 +1058,7 @@ impl InstanceCommon {
10581058
let typespace = self.info.module_def.typespace();
10591059
let row_product_type = typespace
10601060
.resolve(row_type)
1061-
.ty()
1062-
.clone()
1061+
.resolve_refs()?
10631062
.into_product()
10641063
.map_err(|_| anyhow!("Error resolving row type for view"))?;
10651064

crates/sats/src/typespace.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ impl Typespace {
116116
/// Returns the `AlgebraicType` that `r` resolves to in the context of the `Typespace`.
117117
///
118118
/// Panics if `r` is not known by the `Typespace`.
119+
///
120+
/// Note, this is not recursive.
121+
/// To resolve all nested refs, call `resolve_refs()` on the result.
119122
pub fn resolve(&self, r: AlgebraicTypeRef) -> WithTypespace<'_, AlgebraicType> {
120123
self.with_type(&self[r])
121124
}

0 commit comments

Comments
 (0)