Skip to content

feat: add inline call matching for assertion mapping (86.4% accuracy) - #58

Merged
jflowers merged 1 commit into
unbound-force:mainfrom
jflowers:ast-ssa-bridge-continued
Mar 15, 2026
Merged

jflowers merged 1 commit into
unbound-force:mainfrom
jflowers:ast-ssa-bridge-continued

Conversation

@jflowers

Copy link
Copy Markdown
Collaborator

Summary

The inline call pattern

// Before (unmapped): target's return used inline, no assignment
if c.Value() != 5 {
    t.Errorf("Value() = %d, want 5", c.Value())
}

// The normal tracing pipeline only handles assignments:
got := c.Value()  // traced: got -> ReturnValue effect

matchInlineCall scans the assertion expression for *ast.CallExpr nodes whose callee name and package match the target function. When found, it maps to the ReturnValue effect at confidence 60.

Remaining gap to 90%

9/66 assertions remain unmapped (86.4%). The remaining cases are:

  • Cross-target assertions (asserting on a different function's output)
  • go-cmp cmp.Diff with stub packages (type info issues in test fixtures)
  • Helper-internal variables (not parameters, not bridgeable)

These require more sophisticated analysis and are tracked in #6.

Partially addresses #6

Add matchInlineCall to detect assertions that call the target function
inline without assignment (e.g., if c.Value() != 5). When the assertion
expression contains a call to the target, it is matched to the
ReturnValue effect at confidence 60.

Combined with the helper parameter bridge from the previous commit:
- Mapping accuracy: 78.8% (52/66) -> 86.4% (57/66)
- Ratchet floor raised: 76.0% -> 85.0%
- 5 additional assertions mapped total (4 via helper bridge, 1 via inline call)

Partially addresses unbound-force#6
@jflowers jflowers added this to the v1.4.0 milestone Mar 15, 2026
@jflowers
jflowers merged commit 790baf9 into unbound-force:main Mar 15, 2026
5 checks passed
@jflowers
jflowers deleted the ast-ssa-bridge-continued branch November 15, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant