diff --git a/codon/parser/visitors/typecheck/loops.cpp b/codon/parser/visitors/typecheck/loops.cpp index 8777aa1b..d415f5e8 100644 --- a/codon/parser/visitors/typecheck/loops.cpp +++ b/codon/parser/visitors/typecheck/loops.cpp @@ -289,6 +289,15 @@ TypecheckVisitor::transformStaticLoopCall( !ctx->cache->functions[method.name].type) continue; if (method.age <= ctx->age) { + if (typ->getHeterogenousTuple()) { + auto &ast = ctx->cache->functions[method.name].ast; + if (ast->hasAttr("autogenerated") && + (endswith(ast->name, ".__iter__:0") || + endswith(ast->name, ".__getitem__:0"))) { + // ignore __getitem__ and other heterogenuous methods + continue; + } + } stmt->rhs = N(method.name); block.push_back(wrap(stmt->clone())); }