Skip to content

fix(typecheck): zero-arg thunk calls, tuple-destructuring let, RuntimeError catch (#128)#186

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/128-zeroarg-tuplelet-runtimeerror
May 18, 2026
Merged

fix(typecheck): zero-arg thunk calls, tuple-destructuring let, RuntimeError catch (#128)#186
hyperpolymath merged 1 commit into
mainfrom
fix/128-zeroarg-tuplelet-runtimeerror

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

STAGE A (#128/#135). Three compiler-level fixes surfaced by stdlib/testing.affine, taking the AOT stdlib to 14/19:

  • ExprApp f [] — a zero-arg call f() on an explicit () -> T thunk (record field / param / lambda) now consumes the unit and yields T. Zero-param fn declarations are bare-return-typed (unaffected); curried/partial application never reaches the empty-arg branch, so peeling one unit arrow is sound.
  • StmtLet — each destructured name is generalized at its own component type, not the whole value type. let x = e unchanged; let (a, b) = e now types a/b at their element types (was Unify (Int, (Int,Int))).
  • RuntimeError(String) — registered as the interpreter's builtin exception variant (resolve seed + typecheck constructor_env) so try/catch arms in the honest stdlib resolve and type-check.

Plus stdlib/testing.affine: let mut found; tot / float(iterations).

Full suite 233/233, zero regression. Refs #128.

…eError catch — stdlib AOT 14/19 (#128)

Three compiler-level fixes surfaced by stdlib/testing.affine:

- ExprApp f []: a zero-arg call f() on an explicit () -> T thunk
  (record field / param / lambda) now consumes the unit and yields T.
  Zero-param fn *declarations* are bare-return-typed, so they are
  unaffected; curried/partial application never reaches this branch
  with an empty arg list, so peeling one unit arrow is sound.
- StmtLet: each destructured name is generalized at *its own*
  component type, not the whole value type. let x = e is unchanged;
  let (a, b) = e now types a and b at their element types.
- RuntimeError(String): registered as the interpreter's builtin
  exception variant (resolve seed + typecheck constructor_env) so
  try/catch arms in the honest stdlib resolve and type-check.

Plus stdlib/testing.affine: let mut found; tot / float(iterations).

Full suite 233/233, zero regression. Refs #128.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hyperpolymath hyperpolymath merged commit e3d4806 into main May 18, 2026
11 of 12 checks passed
@hyperpolymath hyperpolymath deleted the fix/128-zeroarg-tuplelet-runtimeerror branch May 18, 2026 02:28
@github-actions
Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 44 issues detected

Severity Count
🔴 Critical 12
🟠 High 21
🟡 Medium 11

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Stray AI.a2ml in root -- use 0-AI-MANIFEST.a2ml only",
    "type": "banned",
    "file": "AI.a2ml",
    "action": "delete",
    "rule_module": "root_hygiene",
    "severity": "high"
  },
  {
    "reason": "Superseded by 0-AI-MANIFEST.a2ml",
    "type": "banned",
    "file": "AI.djot",
    "action": "delete",
    "rule_module": "root_hygiene",
    "severity": "high"
  },
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/example/smoke_driver.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/cli.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/lib/compile.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/lib/runner.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant