Skip to content

Zzq/function contracts/general nonnil#8

Open
lizard-boy wants to merge 3 commits into
mainfrom
zzq/function-contracts/general-nonnil
Open

Zzq/function contracts/general nonnil#8
lizard-boy wants to merge 3 commits into
mainfrom
zzq/function-contracts/general-nonnil

Conversation

@lizard-boy

Copy link
Copy Markdown

No description provided.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Overall, this PR refines contract handling by switching from a global check to a per-return scheme, improving granularity when applying contract annotations.

• Refactored /assertion/function/assertiontree/parse_expr_producer.go to use r.RetHasContract(funcObj, i) for per-return checking.
• Updated /assertion/function/analyzer.go to duplicate triggers based on the correct nonnil parameter/return index, improving error clarity.
• Added helper methods (getSingleNonnilToNonnilContract, ParamHasContract, RetHasContract) in /assertion/function/assertiontree/root_assertion_node.go.
• Introduced concurrent contract inference and strict parsing in the functioncontracts package; verify edge cases in branch handling.

💡 (4/5) You can add custom instructions or style guidelines for the bot here!

9 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +38 to +40
// parseContracts parses a slice of function contracts from a singe comment group. If no contract
// is found from the comment group, an empty slice is returned.
func parseContracts(doc *ast.CommentGroup) []*FunctionContract {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Typo in comment: 'singe comment group' should be 'single comment group'.

Suggested change
// parseContracts parses a slice of function contracts from a singe comment group. If no contract
// is found from the comment group, an empty slice is returned.
func parseContracts(doc *ast.CommentGroup) []*FunctionContract {
// parseContracts parses a slice of function contracts from a single comment group. If no contract
// is found from the comment group, an empty slice is returned.
func parseContracts(doc *ast.CommentGroup) []*FunctionContract {

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.

2 participants