diff options
-rw-r--r-- | src/resp.hpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/resp.hpp b/src/resp.hpp index 7820d28..197a60b 100644 --- a/src/resp.hpp +++ b/src/resp.hpp @@ -364,26 +364,26 @@ struct AType : public ATuple { tag(T_TYPE); loc = cur; } - - bool concrete() const { - switch (kind) { - case VAR: return false; - case NAME: return false; - case PRIM: return head()->str() != "Nothing"; - case EXPR: - FOREACHP(const_iterator, t, this) { - const AType* kid = (*t)->to_type(); - if (kid && !kid->concrete()) - return false; - } - case DOTS: return false; - } - return true; - } Kind kind; unsigned id; }; +static bool concrete_type(const AType* type) { + switch (type->kind) { + case AType::VAR: return false; + case AType::NAME: return false; + case AType::PRIM: return type->head()->str() != "Nothing"; + case AType::EXPR: + FOREACHP(AType::const_iterator, t, type) { + const AType* kid = (*t)->to_type(); + if (kid && !concrete_type(kid)) + return false; + } + case AType::DOTS: return false; + } + return true; +} + // Utility class for easily building lists from left to right template<typename CT, typename ET> // ConsType, ElementType struct List { @@ -608,7 +608,7 @@ struct Subst : public list<Constraint> { const_iterator i = find(in); if (i != end()) { const AType* out = i->second->as_type(); - if (out->kind == AType::EXPR && !out->concrete()) + if (out->kind == AType::EXPR && !concrete_type(out)) out = apply(out->as_type()); return out; } else { |