diff --git a/codon/parser/ast/expr.cpp b/codon/parser/ast/expr.cpp index 7c0d2099..20903dff 100644 --- a/codon/parser/ast/expr.cpp +++ b/codon/parser/ast/expr.cpp @@ -74,7 +74,7 @@ ASTNode::ASTNode(const ASTNode &node) : Node(node), cache(node.cache) {} Expr::Expr() : AcceptorExtend(), type(nullptr), done(false), origExpr(nullptr) {} Expr::Expr(const Expr &expr) : AcceptorExtend(expr), type(expr.type), done(expr.done), origExpr(expr.origExpr) {} -Expr::Expr(const Expr &expr, bool clean) : AcceptorExtend(expr) { +Expr::Expr(const Expr &expr, bool clean) : Expr(expr) { if (clean) { type = nullptr; done = false; diff --git a/codon/parser/ast/types/link.cpp b/codon/parser/ast/types/link.cpp index 7f6ad508..01bf301b 100644 --- a/codon/parser/ast/types/link.cpp +++ b/codon/parser/ast/types/link.cpp @@ -183,7 +183,8 @@ std::string LinkType::debugString(char mode) const { std::string LinkType::realizedName() const { if (kind == Unbound) - return "?"; + // return "?"; + return fmt::format("#{}", genericName); if (kind == Generic) return fmt::format("#{}", genericName); seqassert(kind == Link, "unexpected generic link"); diff --git a/codon/parser/visitors/typecheck/infer.cpp b/codon/parser/visitors/typecheck/infer.cpp index bd852150..5739c25b 100644 --- a/codon/parser/visitors/typecheck/infer.cpp +++ b/codon/parser/visitors/typecheck/infer.cpp @@ -371,15 +371,16 @@ types::TypePtr TypecheckVisitor::realizeFunc(types::FuncType *type, bool force) auto pc = ast->getAttribute(Attr::ParentClass); if (!pc || pc->value.empty()) ctx->addFunc(ctx->cache->rev(ast->name), ast->name, ctx->find(ast->name)->type); - for (size_t i = 0, j = 0; hasAst && i < ast->args.size(); i++) + for (size_t i = 0, j = 0; hasAst && i < ast->args.size(); i++) { if (ast->args[i].status == Param::Normal) { std::string varName = ast->args[i].name; trimStars(varName); auto v = ctx->addVar(ctx->cache->rev(varName), varName, std::make_shared(type->getArgTypes()[j++])); // LOG("[param] {}| {}: {} -> {}", type->debugString(2), ctx->cache->rev(varName), - // v->canonicalName, v->type); + // v->canonicalName, v->type); } + } // Populate realization table in advance to support recursive realizations auto key = type->realizedName(); // note: the key might change later