Fix tests

pull/12/head
Ibrahim Numanagić 2022-01-15 11:39:24 -08:00
parent 5ee92bd6c9
commit 6ee84e09b9
2 changed files with 3 additions and 8 deletions

View File

@ -506,7 +506,7 @@ void SimplifyVisitor::visit(FunctionStmt *stmt) {
ctx->bases.emplace_back(SimplifyContext::Base{canonicalName}); // Add new base...
if (isClassMember && ctx->bases[0].deducedMembers)
ctx->bases.back().deducedMembers = ctx->bases[0].deducedMembers;
ctx->addBlock(); // ... and a block!
ctx->addBlock(); // ... and a block!
// Set atomic flag if @atomic attribute is present.
if (attr.has(Attr::Atomic))
ctx->bases.back().attributes |= FLAG_ATOMIC;
@ -542,7 +542,6 @@ void SimplifyVisitor::visit(FunctionStmt *stmt) {
error("non-default argument '{}' after a default argument", varName);
defaultsStarted |= bool(a.deflt);
auto name = ctx->generateCanonicalName(varName);
auto typeAst = a.type;
@ -1095,7 +1094,8 @@ StmtPtr SimplifyVisitor::transformAssignment(const ExprPtr &lhs, const ExprPtr &
} else if (auto ed = lhs->getDot()) {
seqassert(!type, "unexpected type annotation");
auto l = transform(ed->expr);
if (ctx->bases.back().deducedMembers && l->isId(ctx->bases.back().selfName)) {
if (ctx->bases.size() && ctx->bases.back().deducedMembers &&
l->isId(ctx->bases.back().selfName)) {
if (std::find(ctx->bases.back().deducedMembers->begin(),
ctx->bases.back().deducedMembers->end(),
ed->member) == ctx->bases.back().deducedMembers->end())

View File

@ -158,11 +158,6 @@ types::TypePtr TypecheckVisitor::realizeFunc(types::FuncType *type) {
// Find parents!
ctx->bases.push_back({type->ast->name, type->getFunc(), type->args[0],
{}, findSuperMethods(type->getFunc())});
// if (startswith(type->ast->name, "Foo")) {
// LOG(": {}", type->toString());
// for (auto &s: ctx->bases.back().supers)
// LOG(" - {}", s->toString());
// }
auto clonedAst = ctx->cache->functions[type->ast->name].ast->clone();
auto *ast = (FunctionStmt *)clonedAst.get();
addFunctionGenerics(type);