Skip to content

fix(frontend): lex << as two Less tokens to support nested generics#11555

Merged
TomAFrench merged 4 commits intomasterfrom
tf/fix-nested-angle-brackets
Feb 12, 2026
Merged

fix(frontend): lex << as two Less tokens to support nested generics#11555
TomAFrench merged 4 commits intomasterfrom
tf/fix-nested-angle-brackets

Conversation

@TomAFrench
Copy link
Copy Markdown
Member

@TomAFrench TomAFrench commented Feb 11, 2026

Summary

  • Stop the lexer from combining << into a single ShiftLeft token; emit two Less tokens instead (mirrors the existing >> fix)
  • Reconstruct << from two < tokens in the expression parser's parse_shift
  • Handle <<= (now lexed as < <=) in next_is_op_assign and guard parse_less_or_greater against it
  • Update the formatter to treat ShiftLeft as a 2-token operator (like ShiftRight)

Closes 11553 Not going to close the issue as there are typechecking errors afterwards and this PR had to simplify the test

Closes #11553
Closes #11549

Test plan

  • New regression test nested_angle_brackets_in_type_position passes
  • All 1371 noirc_frontend tests pass
  • All 516 nargo_fmt tests pass
  • All 46 bit-shift integration tests pass
  • All 30 operator overloading integration tests pass

The lexer previously combined `<<` into a single `ShiftLeft` token, which
caused `Store<<T as HasKey>::Key>` to fail parsing since the type parser
expected `Token::Less`. This applies the same fix already used for `>>`:
always emit two separate tokens and reconstruct the shift operator in the
expression parser.

Closes #11553
@TomAFrench TomAFrench requested a review from a team February 11, 2026 16:12
@TomAFrench
Copy link
Copy Markdown
Member Author

TomAFrench commented Feb 11, 2026

This follows the pattern set out in #1319 for >> (over 10000 issues/PRs ago!)

@jfecher jfecher enabled auto-merge February 11, 2026 16:21
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Brillig Execution Time'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: a59043a Previous: c32d7a4 Ratio
rollup-tx-merge 0.002 s 0.001 s 2

This comment was automatically generated by workflow using github-action-benchmark.

CC: @TomAFrench

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

⚠️ 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: e274fb1 Previous: 2db78f8 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

@jfecher jfecher added this pull request to the merge queue Feb 11, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 11, 2026
@TomAFrench TomAFrench added this pull request to the merge queue Feb 11, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 11, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'ACVM Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: 3d72807 Previous: 33ebdad Ratio
perfectly_parallel_batch_inversion_opcodes 3144832 ns/iter (± 15332) 2201746 ns/iter (± 1256) 1.43

This comment was automatically generated by workflow using github-action-benchmark.

CC: @TomAFrench

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Compilation Time'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: 3d72807 Previous: 33ebdad Ratio
rollup-checkpoint-root 385 s 290 s 1.33

This comment was automatically generated by workflow using github-action-benchmark.

CC: @TomAFrench

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Execution Time'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: d0b7bc0 Previous: 2db78f8 Ratio
rollup-tx-merge 0.003 s 0.002 s 1.50

This comment was automatically generated by workflow using github-action-benchmark.

CC: @TomAFrench

@TomAFrench TomAFrench enabled auto-merge February 12, 2026 10:28
@TomAFrench TomAFrench added this pull request to the merge queue Feb 12, 2026
Merged via the queue into master with commit 00b5696 Feb 12, 2026
139 checks passed
@TomAFrench TomAFrench deleted the tf/fix-nested-angle-brackets branch February 12, 2026 11:04
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.

Parser fails on nested angle brackets << in type position Nested associated type resolution fails

2 participants