Skip to content

Add Lambda/Proc type inference support#104

Merged
dak2 merged 1 commit into
mainfrom
feature/v020-lambda-proc
Mar 29, 2026
Merged

Add Lambda/Proc type inference support#104
dak2 merged 1 commit into
mainfrom
feature/v020-lambda-proc

Conversation

@dak2

@dak2 dak2 commented Mar 28, 2026

Copy link
Copy Markdown
Owner

Motivation

Lambda/Proc literals were silently ignored by the type checker, meaning type errors inside their bodies and on .call return values went undetected.

Changes

  • Add Type::Proc variant with return_vertex and param_vertices for graph-based type propagation
  • Add ScopeKind::Lambda so return inside lambdas targets the lambda scope, not the enclosing method
  • Add GlobalEnv::enter_lambda() to create a lambda scope with its own merge vertex
  • Add lambdas.rs handler: processes parameters, body, and wires the body result into the merge vertex
  • Detect lambda {}, proc {}, and Proc.new {} in dispatch and route them through process_block_as_proc
  • Handle .call on Type::Proc in MethodCallBox: connect return vertex and propagate arguments

Checked

  • cargo test --lib passed
  • bundle exec rake test passed

🤖 Generated with Claude Code

@dak2 dak2 force-pushed the feature/v020-lambda-proc branch from f34342f to ea80f3d Compare March 28, 2026 07:12
@dak2 dak2 added this to the v0.2.0 milestone Mar 28, 2026
@dak2 dak2 force-pushed the feature/v020-lambda-proc branch from ea80f3d to cb9e4d7 Compare March 29, 2026 02:12
Lambda literals were silently ignored by the type checker,
so type errors inside lambda bodies and on `.call` return values went
undetected.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dak2 dak2 force-pushed the feature/v020-lambda-proc branch from cb9e4d7 to 0057b1d Compare March 29, 2026 02:44
@dak2 dak2 merged commit d2fa752 into main Mar 29, 2026
4 checks passed
@dak2 dak2 deleted the feature/v020-lambda-proc branch March 29, 2026 03:05
@dak2 dak2 mentioned this pull request Apr 5, 2026
4 tasks
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