diff --git a/src/ast/datatype/mod.rs b/src/ast/datatype/mod.rs index b539391..2377b4d 100644 --- a/src/ast/datatype/mod.rs +++ b/src/ast/datatype/mod.rs @@ -45,7 +45,13 @@ impl Type { TypeKind::Pointer(inner) => inner.contains_polymorph(), TypeKind::FixedArray(fixed_array) => fixed_array.ast_type.contains_polymorph(), TypeKind::Void => None, - TypeKind::Named(_, _) => None, + TypeKind::Named(_, args) => args + .iter() + .flat_map(|arg| match arg { + CompileTimeArgument::Type(ty) => ty.contains_polymorph(), + CompileTimeArgument::Expr(_) => todo!("ast::Type::contains_polymorph"), + }) + .next(), TypeKind::AnonymousStruct(_) => todo!("contains_polymoph for AnonymousStruct"), TypeKind::AnonymousUnion(_) => todo!("contains_polymorph for AnonymousUnion"), TypeKind::AnonymousEnum(_) => todo!("contains_polymorph for AnonymousEnum"), diff --git a/src/resolve/polymorph.rs b/src/resolve/polymorph.rs index 79f28d8..e807717 100644 --- a/src/resolve/polymorph.rs +++ b/src/resolve/polymorph.rs @@ -97,7 +97,15 @@ impl PolyRecipe { } resolved::TypeKind::FunctionPointer(_) => todo!(), resolved::TypeKind::Enum(_, _) => ty.clone(), - resolved::TypeKind::Structure(_, _, _) => ty.clone(), + resolved::TypeKind::Structure(human_name, structure_ref, poly_args) => { + let args = poly_args + .iter() + .map(|arg| self.resolve_type(arg)) + .collect::>()?; + + resolved::TypeKind::Structure(human_name.clone(), *structure_ref, args) + .at(ty.source) + } resolved::TypeKind::TypeAlias(_, _) => ty.clone(), resolved::TypeKind::Polymorph(name, _) => { let Some(value) = polymorphs.get(name) else {