Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fv): add semantic analysis for fv attributes #88

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

Aristotelis2002
Copy link
Collaborator

Added name resolution and type checking for the expression bodies of the formal verification attributes. This means that functions in HIR now have resolved formal verification attributes attached to them.

Added tests which showcase the newly added functionality.

Copy link
Collaborator

@smanilov smanilov left a comment

Choose a reason for hiding this comment

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

LGTM

Exciting progress!

compiler/noirc_frontend/src/elaborator/mod.rs Show resolved Hide resolved
@@ -1381,4 +1395,75 @@ impl<'context> Elaborator<'context> {
_ => true,
})
}

fn elaborate_fv_attributes(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
fn elaborate_fv_attributes(
/// Performs semantic analysis on the formal verification attributes discovered by the parser.
///
/// `fv_attributes` - the parsed attributes
/// `func_id` - this is the `FuncId` of the function to which the attributes are attached
/// `body_type` - this is the semantically inferred type of the expression that is the body of the function
/// `hir_func` - this identifies the same expression
/// `func_span` - represents the span in code
fn elaborate_fv_attributes(

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, also figure out what's the correct way to cite parameters in a doccomment in Rust (rustdoc).

Copy link
Collaborator Author

@Aristotelis2002 Aristotelis2002 Sep 19, 2024

Choose a reason for hiding this comment

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

Citing parameters is not a part of rustdoc anymore. Source: rust-lang/rust-by-example#1804 .
Still, I will add old style comments for the arguments.

compiler/noirc_frontend/src/elaborator/mod.rs Outdated Show resolved Hide resolved
compiler/noirc_frontend/src/elaborator/mod.rs Show resolved Hide resolved
compiler/noirc_frontend/src/elaborator/mod.rs Show resolved Hide resolved
compiler/noirc_frontend/src/elaborator/mod.rs Show resolved Hide resolved
Added name resolution and type checking for the expression bodies of the
formal verification attributes. This means that functions in HIR now
have resolved formal verification attributes attached to them.

Added tests which showcase the newly added functionality.
@Aristotelis2002 Aristotelis2002 merged commit fead529 into blocksense Sep 19, 2024
@Aristotelis2002 Aristotelis2002 deleted the semantic-fv-support branch September 19, 2024 11:07
Aristotelis2002 added a commit that referenced this pull request Sep 20, 2024
Formal verification attributes are now ignored in all other (non fv)
nargo cli commands and won't produce any errors related to semantic
analysis.

Also expanded the testing logic. Now there are two directories for
testing formal verification functionality. Them being
`formal_verify_failure` and `formal_verify_success`.

Moved the tests from PR #88 in their matching directories.
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