feat: Allow TraitAsType syntax to refer to associated constants in expressions#9041
Merged
feat: Allow TraitAsType syntax to refer to associated constants in expressions#9041
Conversation
5 tasks
jfecher
commented
Jul 2, 2025
Contributor
Author
jfecher
left a comment
There was a problem hiding this comment.
Unnecessary test changes
test_programs/compile_success_empty/comptime_function_definition/src/main.nr
Outdated
Show resolved
Hide resolved
test_programs/compile_success_empty/comptime_function_definition/src/main.nr
Outdated
Show resolved
Hide resolved
jfecher
commented
Jul 2, 2025
test_programs/compile_success_empty/comptime_function_definition/src/main.nr
Outdated
Show resolved
Hide resolved
jfecher
commented
Jul 2, 2025
test_programs/compile_success_empty/associated_constants_in_as_trait_expr/src/main.nr
Show resolved
Hide resolved
asterite
reviewed
Jul 3, 2025
Contributor
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Test Suite Duration'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: 41d25ee | Previous: 6145aaa | Ratio |
|---|---|---|---|
test_report_zkpassport_noir_rsa_ |
1 s |
0 s |
+∞ |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
Collaborator
|
I reviewed this and it looks good, though I added some more commits so it might be better for someone else to also review this. |
TomAFrench
reviewed
Jul 3, 2025
5 tasks
github-merge-queue bot
pushed a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Jul 4, 2025
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: remove redundant associated constant lookup (noir-lang/noir#9114) chore: test that associated function and constant with the same name collide (noir-lang/noir#9112) feat: Allow TraitAsType syntax to refer to associated constants in expressions (noir-lang/noir#9041) chore: clippy (noir-lang/noir#9101) chore(fuzz): Recursively generate lvalue for multi dimensional arrays and nested tuples (noir-lang/noir#9086) fix!: remove `hash_to_field` from stdlib (noir-lang/noir#9098) chore(docs): Brillig gen (noir-lang/noir#9085) chore(fuzz): Test AST print-and-parse roundtrip (noir-lang/noir#9083) fix(ssa): Do not fail for static assertions in a map over empty dynamic slices (noir-lang/noir#9060) chore: merge `RangeCheckFailed` and `RangeCheckFailedWithMessage` (noir-lang/noir#9093) chore(fuzz): Capture printed output in `comptime_vs_brillig_direct` (noir-lang/noir#9090) chore(debug): Add trait constraint to string helper (noir-lang/noir#9082) chore: bump some deps (noir-lang/noir#9076) END_COMMIT_OVERRIDE --------- Co-authored-by: AztecBot <tech@aztecprotocol.com> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
5 tasks
danielntmd
pushed a commit
to danielntmd/aztec-packages
that referenced
this pull request
Jul 16, 2025
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: remove redundant associated constant lookup (noir-lang/noir#9114) chore: test that associated function and constant with the same name collide (noir-lang/noir#9112) feat: Allow TraitAsType syntax to refer to associated constants in expressions (noir-lang/noir#9041) chore: clippy (noir-lang/noir#9101) chore(fuzz): Recursively generate lvalue for multi dimensional arrays and nested tuples (noir-lang/noir#9086) fix!: remove `hash_to_field` from stdlib (noir-lang/noir#9098) chore(docs): Brillig gen (noir-lang/noir#9085) chore(fuzz): Test AST print-and-parse roundtrip (noir-lang/noir#9083) fix(ssa): Do not fail for static assertions in a map over empty dynamic slices (noir-lang/noir#9060) chore: merge `RangeCheckFailed` and `RangeCheckFailedWithMessage` (noir-lang/noir#9093) chore(fuzz): Capture printed output in `comptime_vs_brillig_direct` (noir-lang/noir#9090) chore(debug): Add trait constraint to string helper (noir-lang/noir#9082) chore: bump some deps (noir-lang/noir#9076) END_COMMIT_OVERRIDE --------- Co-authored-by: AztecBot <tech@aztecprotocol.com> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem*
Resolves #8797
Summary
Implements
<Type as Trait>::Constantin an expression position.This also makes
T::Constantwork in a context where we haveT: Trait.Additional Context
I wanted to implement this without adding new concepts or things for the compiler to track. I ended up generalizing
TraitMethodIdinto aTraitItemIdby changing themethod_index: usizeinto adefinition_id: DefinitionIdfield and giving associated constants a definition id. I did end up adding some new things to track these new definition ids though so it isn't perfect.Documentation
Check one:
PR Checklist
cargo fmton default settings.