Skip to content

Conversation

@sonalmahajan15
Copy link
Contributor

This PR addresses the false positives that were reported for generic rich-check-effect functions. Example:

func GenericFunc[T any]() (*T, error) {
	var resp T
	if someCond {
		return nil, errors.New("some error")
	}
	return &resp, nil
}

func CallGenericFunc() {
        v, err := GenericFunc[int]()
	if err != nil {
		return
	}
	print(*v)  // FP reported here: unassigned variable `v` dereferenced
}

Currently we do not handle generic rich-check-effect function calls in NilAway. So as a temporary solution, we suppress reporting of errors related to generic rich-check-effect functions. Note that this does help suppress false positives, but it also means that we don't report true positives either. We should fix this in the future when we add support for generics in NilAway.

@sonalmahajan15 sonalmahajan15 requested a review from yuxincs July 8, 2025 06:19
@codecov
Copy link

codecov bot commented Jul 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.63%. Comparing base (fb40f5d) to head (b3798e6).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #354      +/-   ##
==========================================
+ Coverage   87.58%   87.63%   +0.04%     
==========================================
  Files          73       73              
  Lines       10834    10841       +7     
==========================================
+ Hits         9489     9500      +11     
+ Misses       1156     1152       -4     
  Partials      189      189              

☔ 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.

@github-actions
Copy link

github-actions bot commented Jul 8, 2025

Golden Test

Note

✅ NilAway errors reported on standard libraries are identical.

2540 errors on base branch (main, fb40f5d)
2540 errors on test branch (13b775a)

@sonalmahajan15 sonalmahajan15 merged commit aa1ea38 into main Jul 9, 2025
9 checks passed
@sonalmahajan15 sonalmahajan15 deleted the sonalmahajan15/suppress-generic-rich-check-effect-funcs branch July 9, 2025 16:23
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.

3 participants