Skip to content

[P1-HIGH] Lambda/Closure Transpilation Enhancement - 29 Categories Blocked #205

@noahgift

Description

@noahgift

Problem Statement

Lambda expressions have 0.783 Tarantula suspiciousness and block 29 corpus categories.

Evidence

From Tarantula Fault Localization:

lambda: 0.783 suspiciousness (4th highest)

Affected Categories (29):

  • async_queue, callback_pattern, event_bus, event_emitter, event_observable
  • event_saga, event_stream, expression_eval, func_curry, func_either
  • func_lens, func_maybe, func_pipeline, functools_ops, generic_container
  • generic_iterator, generic_result, generic_visitor, graph_traversal
  • graph_unionfind, json_basic, log_parser, lru_cache, and more...

From OIP Historical Analysis:

  • Part of ASTTransform category (60.2% of bugs)

Root Cause

Python lambdas don't always map cleanly to Rust closures:

  • Capture semantics differ (Python captures by reference, Rust needs explicit)
  • Type inference for closure parameters
  • Higher-order function compatibility

Files to Modify

  • crates/depyler-core/src/rust_gen/expr_gen.rs - Lambda expression codegen
  • crates/depyler-core/src/hir.rs - Lambda HIR representation
  • crates/depyler-core/src/borrowing_context.rs - Capture analysis

Acceptance Criteria

  • Simple lambdas (lambda x: x + 1) transpile correctly
  • Lambdas with captures work (lambda x: x + captured_var)
  • Higher-order functions with lambdas (map, filter, sorted key=)
  • 20+ of 29 blocked categories now compile

Impact: +8-10% single-shot compile rate


🤖 Generated from OIP/pmat/Tarantula analysis

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1-highHigh priority - fix this sprintenhancementNew feature or requesttarantula-verifiedVerified by Tarantula fault localization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions