Conversation
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: 89ee869 | Previous: 4a6d6f9 | Ratio |
|---|---|---|---|
test_report_zkpassport_noir-ecdsa_ |
3 s |
2 s |
1.50 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
|
Nice! Maybe we could return a |
I had thought about doing that as well. We would have to clone the types but we could remove the need to deconstruct the result type at all. Do you prefer that to this? |
Yes, or at least it would make it harder to forget if we eventually add a new generic type. |
|
Ah, actually, there's an unreachable if we forget to handle that case, so no need to change anything 👍 |
Yeah without the unreachable we would still have a silent fallback. I will keep the type deconstruction as that is what we already have and we can avoid cloning when we don't need to (this method is also used in |
|
@asterite could I get an approval or do you think we should still switch to the cloned type method? |
asterite
left a comment
There was a problem hiding this comment.
Sorry! I thought I had approved.
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore(elaborator): Infer type of lambdas in tuple args; more docs (noir-lang/noir#10405) fix: revert "feat(ACIR): reuse element_type_sizes blocks with the same str… (noir-lang/noir#10428) chore(frontend): Avoid silent fallback when returning turbofish generics for primitive types (noir-lang/noir#10416) fix: mark ECDSA verification as `PureWithPredicate` (noir-lang/noir#10423) fix(parser): don't crash on incomplete type alias (noir-lang/noir#10421) chore(github): Refine pull request template wording (noir-lang/noir#10418) chore: refactor codegen_memory (noir-lang/noir#10323) chore(frontend): Primitive types generic count unit tests (noir-lang/noir#10412) chore: use SignedField::from_signed in enums.rs (noir-lang/noir#10408) chore: use `map_data_bus_in_place` in mem2reg (noir-lang/noir#10407) chore: apply typo fixes from Cantina (noir-lang/noir#10406) chore(frontend): Various comptime blocks unit tests (noir-lang/noir#10398) fix: clarify predicate comment in BrilligCall and Call opcodes (noir-lang/noir#10356) END_COMMIT_OVERRIDE
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore(elaborator): Infer type of lambdas in tuple args; more docs (noir-lang/noir#10405) fix: revert "feat(ACIR): reuse element_type_sizes blocks with the same str… (noir-lang/noir#10428) chore(frontend): Avoid silent fallback when returning turbofish generics for primitive types (noir-lang/noir#10416) fix: mark ECDSA verification as `PureWithPredicate` (noir-lang/noir#10423) fix(parser): don't crash on incomplete type alias (noir-lang/noir#10421) chore(github): Refine pull request template wording (noir-lang/noir#10418) chore: refactor codegen_memory (noir-lang/noir#10323) chore(frontend): Primitive types generic count unit tests (noir-lang/noir#10412) chore: use SignedField::from_signed in enums.rs (noir-lang/noir#10408) chore: use `map_data_bus_in_place` in mem2reg (noir-lang/noir#10407) chore: apply typo fixes from Cantina (noir-lang/noir#10406) chore(frontend): Various comptime blocks unit tests (noir-lang/noir#10398) fix: clarify predicate comment in BrilligCall and Call opcodes (noir-lang/noir#10356) END_COMMIT_OVERRIDE
Description
Problem*
Working towards the audit of the elaborator group 7a
I noticed that in
resolve_item_turbofish_and_self_typewe deconstruct the resolved primitive type to fetch any possible generics as they are used later in the elaboration flow. The logic is currently correct but could be incorrect if we ever add another primitive type with generics and forget to return its generics after instantiating the type.Summary*
When instantiating a primitive type with turbofish we now also return a bool as to whether that type should have generics. That bool then determines whether we return an empty list of generics, not the instantiated type. Now if we were to add another primitive type with generics and not return any generics, we would hit the new panic added in this PR.
I thought about just adding a
has_genericshelper onPrimitiveTypebut this felt like we then still have two sources of truth when removing that is the goal of this refactor. We would have to remember to update this helper if we added a new primitive type.Additional Context
Documentation*
Check one:
PR Checklist*
cargo fmton default settings.