Skip to content

fix: Handle bound method calls in defer statements#22

Merged
mpyw merged 1 commit intomainfrom
fix/deferred-bound-method
Dec 26, 2025
Merged

fix: Handle bound method calls in defer statements#22
mpyw merged 1 commit intomainfrom
fix/deferred-bound-method

Conversation

@mpyw
Copy link
Copy Markdown
Owner

@mpyw mpyw commented Dec 26, 2025

Summary

  • Added bound method checking to checkDeferredCall
  • Added checkDeferredBoundMethodTerminator function
  • Added test cases for deferred bound methods

Fixes #21

Test plan

  • Added test cases for deferred bound method with/without ctx
  • ./test_all.sh passes

🤖 Generated with Claude Code

Previously, `checkDeferredCall` did not handle bound method calls
(method values), causing false negatives when a bound method was
deferred.

Example that was previously missed:
  e := logger.Info()
  msg := e.Msg
  defer msg("deferred")  // Now correctly reports missing ctx

Added `checkDeferredBoundMethodTerminator` which mirrors the logic
of `checkBoundMethodTerminator` for defer statements.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@mpyw mpyw merged commit 3672fdc into main Dec 26, 2025
6 checks passed
@mpyw mpyw deleted the fix/deferred-bound-method branch December 26, 2025 03:23
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 26, 2025

Codecov Report

❌ Patch coverage is 71.42857% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.79%. Comparing base (a4ac07d) to head (2c0851e).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/ssa/checker.go 71.42% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #22      +/-   ##
==========================================
- Coverage   89.31%   88.79%   -0.52%     
==========================================
  Files           7        7              
  Lines         468      482      +14     
==========================================
+ Hits          418      428      +10     
- Misses         29       31       +2     
- Partials       21       23       +2     
Flag Coverage Δ
unittests 88.79% <71.42%> (-0.52%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Bug: Deferred bound method calls not checked for context

1 participant