mirror of https://github.com/exaloop/codon.git
Fix call tests [wip]
parent
32b2af6b1b
commit
abadfeb03e
|
@ -434,6 +434,14 @@ void TranslateVisitor::visit(AssignStmt *stmt) {
|
|||
seqassert(stmt->lhs->getId(), "expected IdExpr, got {}", stmt->lhs);
|
||||
auto var = stmt->lhs->getId()->value;
|
||||
if (!stmt->rhs || (!stmt->rhs->isType() && stmt->rhs->type)) {
|
||||
if (stmt->rhs && stmt->rhs->type->getFunc())
|
||||
return;
|
||||
if (stmt->rhs && stmt->rhs->type->getPartial() &&
|
||||
!ctx->find(stmt->rhs->type->getClass()->realizedTypeName())) {
|
||||
// Partial generic; ignore [TODO]
|
||||
return;
|
||||
}
|
||||
|
||||
auto isGlobal = in(ctx->cache->globals, var);
|
||||
ir::Var *v = nullptr;
|
||||
|
||||
|
|
|
@ -150,6 +150,8 @@ StmtPtr TypecheckVisitor::transformAssignment(AssignStmt *stmt, bool mustExist)
|
|||
unify(assign->lhs->type, assign->rhs->type);
|
||||
if (stmt->rhs->isType())
|
||||
val->type = val->type->getClass();
|
||||
else if (stmt->rhs->type->getFunc())
|
||||
val->type = val->type->getFunc();
|
||||
auto type = assign->lhs->getType();
|
||||
// Generalize non-variable types. That way we can support cases like:
|
||||
// `a = foo(x, ...); a(1); a('s')`
|
||||
|
|
Loading…
Reference in New Issue