When type resolving a function which returns a const generic for example
this means its unifying the ConstType vs the the specified type so this
mean unwrapping the type of the const.
gcc/rust/ChangeLog:
* typecheck/rust-unify.cc (UnifyRules::go): unwrap the const type
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
}
}
+ if ((ltype->is<TyTy::ConstType> () || rtype->is<TyTy::ConstType> ())
+ && !(ltype->is<TyTy::ConstType> () && rtype->is<TyTy::ConstType> ()))
+ {
+ if (ltype->is<TyTy::ConstType> ())
+ {
+ auto const_type = static_cast<TyTy::ConstType *> (ltype);
+ ltype = const_type->get_ty ();
+ }
+ else if (rtype->is<TyTy::ConstType> ())
+ {
+ auto const_type = static_cast<TyTy::ConstType *> (rtype);
+ rtype = const_type->get_ty ();
+ }
+ }
+
switch (ltype->get_kind ())
{
case TyTy::INFER: