auto context = Resolver::TypeCheckContext::get ();
BaseType *lookup = nullptr;
bool ok = context->lookup_type (ref, &lookup);
- rust_assert (ok);
+ if (!ok || lookup == nullptr || lookup->get_kind () == TypeKind::ERROR)
+ return;
}
BaseType *
auto context = Resolver::TypeCheckContext::get ();
BaseType *lookup = nullptr;
bool ok = context->lookup_type (ref, &lookup);
- rust_assert (ok);
+ if (!ok || lookup == nullptr)
+ return nullptr;
return lookup;
}
TyVar
TyVar::clone () const
{
- TyTy::BaseType *c = get_tyty ()->clone ();
+ TyTy::BaseType *base = get_tyty ();
+ if (base == nullptr || base->get_kind () == TypeKind::ERROR)
+ return TyVar::get_implicit_infer_var (UNKNOWN_LOCATION);
+ TyTy::BaseType *c = base->clone ();
return TyVar (c->get_ref ());
}
auto &mappings = Analysis::Mappings::get ();
auto context = Resolver::TypeCheckContext::get ();
+ TyTy::BaseType *base = get_tyty ();
+ if (base == nullptr || base->get_kind () == TypeKind::ERROR)
+ return TyVar::get_implicit_infer_var (UNKNOWN_LOCATION);
+
// this needs a new hirid
TyTy::BaseType *c = get_tyty ()->monomorphized_clone ();
c->set_ref (mappings.get_next_hir_id ());
--- /dev/null
+fn main() {
+ let ref mut a @ (ref mut b,);
+ // { dg-error "expected T\\?, found tuple" "" { target *-*-* } .-1 }
+}
\ No newline at end of file