ADT's and tuples are valid to be unified with inference variables
There is some dulication here which will eventually go away with the coercion site refactor which is still a WIP. Here we update the type rules so that we allow ADT's and tuples to unify and thus fulfill the type inference rules. Addresses #1447
This commit is contained in:
parent
8749b66879
commit
e0a14f4839
|
@ -1133,6 +1133,18 @@ public:
|
|||
resolved = type.clone ();
|
||||
}
|
||||
|
||||
void visit (InferType &type) override
|
||||
{
|
||||
if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL)
|
||||
{
|
||||
BaseCoercionRules::visit (type);
|
||||
return;
|
||||
}
|
||||
|
||||
resolved = base->clone ();
|
||||
resolved->set_ref (type.get_ref ());
|
||||
}
|
||||
|
||||
private:
|
||||
BaseType *get_base () override { return base; }
|
||||
|
||||
|
@ -1172,6 +1184,18 @@ public:
|
|||
type.get_ident ().locus, fields);
|
||||
}
|
||||
|
||||
void visit (InferType &type) override
|
||||
{
|
||||
if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL)
|
||||
{
|
||||
BaseCoercionRules::visit (type);
|
||||
return;
|
||||
}
|
||||
|
||||
resolved = base->clone ();
|
||||
resolved->set_ref (type.get_ref ());
|
||||
}
|
||||
|
||||
private:
|
||||
BaseType *get_base () override { return base; }
|
||||
|
||||
|
|
|
@ -1131,6 +1131,18 @@ public:
|
|||
resolved = type.clone ();
|
||||
}
|
||||
|
||||
void visit (InferType &type) override
|
||||
{
|
||||
if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL)
|
||||
{
|
||||
BaseRules::visit (type);
|
||||
return;
|
||||
}
|
||||
|
||||
resolved = base->clone ();
|
||||
resolved->set_ref (type.get_ref ());
|
||||
}
|
||||
|
||||
private:
|
||||
BaseType *get_base () override { return base; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue