diff --git a/App/lib/core/Gen/Type/TypeGenErr.vp b/App/lib/core/Gen/Type/TypeGenErr.vp index dee3e29..a357627 100644 --- a/App/lib/core/Gen/Type/TypeGenErr.vp +++ b/App/lib/core/Gen/Type/TypeGenErr.vp @@ -102,10 +102,15 @@ novirtual class TypeGenErr(TypeGenBase.TypeGenBase): # The subscript test uses TypeGenResolve as the single source of truth (the t.Callable # Attribute form is equivalent to the bare-name callable / Callable forms) if self.Gen.TypeGenResolve._IsCallableSubscriptValue(sub_cr.value) == 0: return None - # slice must be Tuple(elts=[args_list, ret_node]) + # slice must be Tuple(elts=[args_list, ret_node]); the one-element form + # `callable[[A, B]]` omits the return type and means the default int (i32) — the same + # degradation a missing annotation gets elsewhere. It must still register, otherwise the + # indirect call fails fast with "Return type ... is not registered". if sub_cr.slice is None or sub_cr.slice.kind() != ast.ASTKind.Tuple: return None tp_cr: ast.Tuple* = ast.Tuple*(sub_cr.slice) - if tp_cr.elts is None or len(tp_cr.elts) != 2: return None + if tp_cr.elts is None: return None + if len(tp_cr.elts) == 1: return mlirlite.Int32(pool) + if len(tp_cr.elts) != 2: return None ret_node_cr: ast.AST* = tp_cr.elts.get(1) if ret_node_cr is None: return None return self.Gen.TypeGenResolve.resolve_annotation_type(pool, ret_node_cr, imported_modules, from_imports, trans, 0)