FnParam type where monomorphized during cloning.
gcc/rust/ChangeLog:
* typecheck/rust-tyty.h: Reverse monomorphization during cloning and
make a new function to explicitly monomorphize.
* typecheck/rust-tyty.cc: Use monomorphization when required.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
{
std::vector<TyTy::FnParam> cloned_params;
for (auto &p : fn->get_params ())
- cloned_params.push_back (p.clone ());
+ cloned_params.push_back (p.monomorphized_clone ());
BaseType *retty = fn->get_return_type ()->monomorphized_clone ();
return new FnType (fn->get_ref (), fn->get_ty_ref (), fn->get_id (),
void set_type (BaseType *new_type) { type = new_type; }
FnParam clone () const
+ {
+ return FnParam (pattern->clone_pattern (), type->clone ());
+ }
+
+ FnParam monomorphized_clone () const
{
return FnParam (pattern->clone_pattern (), type->monomorphized_clone ());
}