Add missing type-checking for slice types
This commit is contained in:
parent
77a4950744
commit
a620a228c1
|
@ -668,6 +668,8 @@ public:
|
|||
void accept_vis (HIRFullVisitor &vis) override;
|
||||
void accept_vis (HIRTypeVisitor &vis) override;
|
||||
|
||||
std::unique_ptr<Type> &get_element_type () { return elem_type; }
|
||||
|
||||
protected:
|
||||
/* Use covariance to implement clone function as returning this object rather
|
||||
* than base */
|
||||
|
|
|
@ -600,5 +600,15 @@ TypeCheckType::visit (HIR::ArrayType &type)
|
|||
TyTy::TyVar (base->get_ref ()));
|
||||
}
|
||||
|
||||
void
|
||||
TypeCheckType::visit (HIR::SliceType &type)
|
||||
{
|
||||
TyTy::BaseType *base
|
||||
= TypeCheckType::Resolve (type.get_element_type ().get ());
|
||||
translated
|
||||
= new TyTy::SliceType (type.get_mappings ().get_hirid (), type.get_locus (),
|
||||
TyTy::TyVar (base->get_ref ()));
|
||||
}
|
||||
|
||||
} // namespace Resolver
|
||||
} // namespace Rust
|
||||
|
|
|
@ -120,6 +120,8 @@ public:
|
|||
|
||||
void visit (HIR::ArrayType &type) override;
|
||||
|
||||
void visit (HIR::SliceType &type) override;
|
||||
|
||||
void visit (HIR::ReferenceType &type) override
|
||||
{
|
||||
TyTy::BaseType *base
|
||||
|
@ -338,8 +340,8 @@ public:
|
|||
binding->inherit_bounds (specified_bounds);
|
||||
|
||||
// When we apply these bounds we must lookup which type this binding
|
||||
// resolves to, as this is the type which will be used during resolution of
|
||||
// the block.
|
||||
// resolves to, as this is the type which will be used during resolution
|
||||
// of the block.
|
||||
NodeId ast_node_id = binding_type_path->get_mappings ().get_nodeid ();
|
||||
|
||||
// then lookup the reference_node_id
|
||||
|
|
Loading…
Reference in New Issue