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: allow underscores in integer literals #3746

Merged
merged 4 commits into from
Dec 9, 2023

Conversation

hayleykwan
Copy link
Contributor

Description

Problem*

Resolves #3283

Summary*

This PR adds support for underscores in numeric literals. This is restricted to not allow multiple underscores in a row and a literal cannot start or end with an underscore.

Additional Context

Documentation*

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [Exceptional Case] Documentation to be submitted in a separate PR.

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

hayleykwan and others added 2 commits December 9, 2023 17:56
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
@kevaundray kevaundray added this pull request to the merge queue Dec 9, 2023
Merged via the queue into noir-lang:master with commit 2c06a64 Dec 9, 2023
33 checks passed
@hayleykwan hayleykwan deleted the hk/underscores_in_literals branch December 10, 2023 22:44
TomAFrench added a commit that referenced this pull request Dec 11, 2023
* master: (120 commits)
  feat: allow passing custom foreign call handlers when creating proofs in NoirJS (#3764)
  fix: add missing assertion to test (#3765)
  chore: re-export the items needed for the lsp from the fm crate instead of importing codespan_reporting (#3757)
  chore: remove special casing for `pedersen_hash` black box function (#3744)
  chore: remove extraneous dbg statement (#3761)
  chore: fix un-needed fully qualified path (#3755)
  feat: aztec-packages (#3754)
  feat: allow underscores in integer literals (#3746)
  fix: deserialize odd length hex literals (#3747)
  feat: optimize out unnecessary truncation instructions (#3717)
  chore: use `tsx` instead of `ts-node` for `noir_js` (#3750)
  chore(ci): fail `tests-end` job if any dependants failed (#3737)
  chore: allow common ascii punctuation in attributes (#3733)
  chore: fix broken onboarding link in README (#3732)
  feat: Dockerfile to test cargo and JS packages (#3684)
  feat(lsp): add goto definition for locals (#3705)
  feat: docs landing page with a playground (#3667)
  fix: `try_unify` no longer binds types on failure (#3697)
  fix: parse negative integer literals (#3698)
  fix: unsigned integers cannot be negated (#3688)
  ...
kevaundray added a commit that referenced this pull request Dec 15, 2023
🤖 I have created a release *beep* *boop*
---


<details><summary>0.21.0</summary>

## [0.21.0](v0.20.0...v0.21.0)
(2023-12-15)


### ⚠ BREAKING CHANGES

* remove unused `source-resolver` package
([#3791](#3791))
* Make file manager read-only to the compiler
([#3760](#3760))

### Features

* Add `prelude.nr`
([#3693](#3693))
([5f0f81f](5f0f81f))
* Add some traits to the stdlib
([#3796](#3796))
([8e11352](8e11352))
* Add support for writing tracing debug info to file
([#3790](#3790))
([98a5004](98a5004))
* Allow passing custom foreign call handlers when creating proofs in
NoirJS ([#3764](#3764))
([6076e08](6076e08))
* Allow underscores in integer literals
([#3746](#3746))
([2c06a64](2c06a64))
* Avoid overflow checks on boolean multiplication
([#3745](#3745))
([9b5b686](9b5b686))
* Aztec-packages
([#3754](#3754))
([c043265](c043265))
* Dockerfile to test cargo and JS packages
([#3684](#3684))
([513d619](513d619))
* Docs landing page with a playground
([#3667](#3667))
([9a95fbe](9a95fbe))
* Enhance test information output
([#3696](#3696))
([468fbbc](468fbbc))
* Implement print without newline
([#3650](#3650))
([9827dfe](9827dfe))
* **lsp:** Add goto definition for locals
([#3705](#3705))
([9dd465c](9dd465c))
* **lsp:** Add goto definition for structs
([#3718](#3718))
([a576c5b](a576c5b))
* Optimize out unnecessary truncation instructions
([#3717](#3717))
([c9c72ae](c9c72ae))
* Remove experimental feature warning for traits
([#3783](#3783))
([cb52242](cb52242))
* Reorganizing docs to fit diataxis framework
([#3711](#3711))
([54a1ed5](54a1ed5))
* Simplify explicit equality assertions to assert equality directly
([#3708](#3708))
([2fc46e2](2fc46e2))
* Speed up transformation of debug messages
([#3815](#3815))
([2a8af1e](2a8af1e))


### Bug Fixes

* `try_unify` no longer binds types on failure
([#3697](#3697))
([f03e581](f03e581))
* Add missing assertion to test
([#3765](#3765))
([bcbe116](bcbe116))
* Add negative integer literals
([#3690](#3690))
([8b3a68f](8b3a68f))
* Allow trait method references from the trait name
([#3774](#3774))
([cfa34d4](cfa34d4))
* Deserialize odd length hex literals
([#3747](#3747))
([4000fb2](4000fb2))
* **docs:** Trigger `update-docs` workflow when the `release-please` PR
gets merged and not on every merge to master
([#3677](#3677))
([9a3d1d2](9a3d1d2))
* Initialise strings as u8 array
([#3682](#3682))
([8da40b7](8da40b7))
* **lsp:** Package resolution on save
([#3794](#3794))
([14f2fff](14f2fff))
* Parse negative integer literals
([#3698](#3698))
([463ab06](463ab06))
* Pub is required on return for entry points
([#3616](#3616))
([7f1d796](7f1d796))
* Remove `noirc_driver/aztec` feature flag in docker
([#3784](#3784))
([a48d562](a48d562))
* Remove include-keys option
([#3692](#3692))
([95d7ce2](95d7ce2))
* Revert chnage to modify version in workspace file for acvm
dependencies ([#3673](#3673))
([0696f75](0696f75))
* Sequence update-lockfile workflow so it gets modified after the ACVM
version in the root has been changed
([#3676](#3676))
([c00cd85](c00cd85))
* **ssa:** Handle array arguments to side effectual constrain statements
([#3740](#3740))
([028d65e](028d65e))
* Stop cloning Traits!
([#3736](#3736))
([fcff412](fcff412))
* Stop issuing unused variable warnings for variables in trait
definitions ([#3797](#3797))
([0bb44c3](0bb44c3))
* Unsigned integers cannot be negated
([#3688](#3688))
([f904ae1](f904ae1))


### Miscellaneous Chores

* Make file manager read-only to the compiler
([#3760](#3760))
([e3dcc21](e3dcc21))
* Remove unused `source-resolver` package
([#3791](#3791))
([57d2505](57d2505))
</details>

<details><summary>0.37.1</summary>

## [0.37.1](v0.37.0...v0.37.1)
(2023-12-15)


### Features

* Aztec-packages
([#3754](#3754))
([c043265](c043265))
* Speed up transformation of debug messages
([#3815](#3815))
([2a8af1e](2a8af1e))


### Bug Fixes

* Deserialize odd length hex literals
([#3747](#3747))
([4000fb2](4000fb2))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
@Savio-Sou
Copy link
Collaborator

Doesn't seem necessary but @noir-lang/developerrelations will defer to you guys on if we want to showcase this in our docs / educational materials.

@signorecello
Copy link
Contributor

Thanks for the tag. Didn't know this was even possible in Rust!

AztecBot added a commit that referenced this pull request Mar 27, 2024
🤖 I have created a release *beep* *boop*
---

<details><summary>aztec-package: 0.32.0</summary>

##
[0.32.0](AztecProtocol/aztec-packages@aztec-package-v0.31.0...aztec-package-v0.32.0)
(2024-03-27)

### Features

* Sequencer checks list of allowed FPCs
([#5310](AztecProtocol/aztec-packages#5310))
([adf20dc](AztecProtocol/aztec-packages@adf20dc)),
closes
[#5000](AztecProtocol/aztec-packages#5000)
</details>

<details><summary>barretenberg.js: 0.32.0</summary>

##
[0.32.0](AztecProtocol/aztec-packages@barretenberg.js-v0.31.0...barretenberg.js-v0.32.0)
(2024-03-27)

### Miscellaneous

* **barretenberg.js:** Synchronize aztec-packages versions
</details>

<details><summary>aztec-cli: 0.32.0</summary>

##
[0.32.0](AztecProtocol/aztec-packages@aztec-cli-v0.31.0...aztec-cli-v0.32.0)
(2024-03-27)

### Miscellaneous

* **aztec-cli:** Synchronize aztec-packages versions
</details>

<details><summary>aztec-packages: 0.32.0</summary>

##
[0.32.0](AztecProtocol/aztec-packages@aztec-packages-v0.31.0...aztec-packages-v0.32.0)
(2024-03-27)

### ⚠ BREAKING CHANGES

* Brillig typed memory
([#5395](AztecProtocol/aztec-packages#5395))

### Features

* Add specific error for attempting `string[x] = ".."`
(#4611)
([27bd8d3](AztecProtocol/aztec-packages@27bd8d3))
* **avm:** Dynamic gas costs for arithmetic, calldatacopy, and set
([#5473](AztecProtocol/aztec-packages#5473))
([bbd33fb](AztecProtocol/aztec-packages@bbd33fb))
* **avm:** EQ opcode output u8 and execution
([#5402](AztecProtocol/aztec-packages#5402))
([3450e24](AztecProtocol/aztec-packages@3450e24)),
closes
[#5290](AztecProtocol/aztec-packages#5290)
* Benchmark tx size with fee
([#5414](AztecProtocol/aztec-packages#5414))
([543f8a2](AztecProtocol/aztec-packages@543f8a2)),
closes
[#5403](AztecProtocol/aztec-packages#5403)
* Brillig typed memory
([#5395](AztecProtocol/aztec-packages#5395))
([16b0bdd](AztecProtocol/aztec-packages@16b0bdd))
* Sequencer checks list of allowed FPCs
([#5310](AztecProtocol/aztec-packages#5310))
([adf20dc](AztecProtocol/aztec-packages@adf20dc)),
closes
[#5000](AztecProtocol/aztec-packages#5000)

### Bug Fixes

* `l1-contracts/bootstrap.sh`
([#5479](AztecProtocol/aztec-packages#5479))
([f7d1d70](AztecProtocol/aztec-packages@f7d1d70))
* Add FPC to allowlist
([#5464](AztecProtocol/aztec-packages#5464))
([424960f](AztecProtocol/aztec-packages@424960f))
* **ci:** Fix earthly ctest
([#5424](AztecProtocol/aztec-packages#5424))
([9cac8a4](AztecProtocol/aztec-packages@9cac8a4))
* Docs example e2e test
([#5456](AztecProtocol/aztec-packages#5456))
([ae5126a](AztecProtocol/aztec-packages@ae5126a))
* Serial bb builds for mac
([#5462](AztecProtocol/aztec-packages#5462))
([4317819](AztecProtocol/aztec-packages@4317819))
* Slice coercions (#4640)
([27bd8d3](AztecProtocol/aztec-packages@27bd8d3))
* **ssa:** Fix slice intrinsic handling in the capacity tracker
(#4643)
([27bd8d3](AztecProtocol/aztec-packages@27bd8d3))
* **ssa:** Use accurate type during SSA AsSlice simplficiation
(#4610)
([27bd8d3](AztecProtocol/aztec-packages@27bd8d3))

### Miscellaneous

* Append-only merkle tree generics
([#5355](AztecProtocol/aztec-packages#5355))
([ef7bf79](AztecProtocol/aztec-packages@ef7bf79))
* **avm:** Deterministic codegen from pil and some renaming
([#5476](AztecProtocol/aztec-packages#5476))
([ba834a4](AztecProtocol/aztec-packages@ba834a4))
* **avm:** Test cleanup and update yp to allow for zero gas
([#5459](AztecProtocol/aztec-packages#5459))
([1829741](AztecProtocol/aztec-packages@1829741))
* **avm:** Unify noir macros flow
([#5461](AztecProtocol/aztec-packages#5461))
([54aee58](AztecProtocol/aztec-packages@54aee58))
* **ci:** Add missing dependency to circleci config
([#5437](AztecProtocol/aztec-packages#5437))
([753cb78](AztecProtocol/aztec-packages@753cb78))
* **ci:** Add warning sticky comment
(#4647)
([27bd8d3](AztecProtocol/aztec-packages@27bd8d3))
* Convert `BlockExpression` into a standard struct
(#4623)
([27bd8d3](AztecProtocol/aztec-packages@27bd8d3))
* Delete `R1CSTransformer` (#4649)
([27bd8d3](AztecProtocol/aztec-packages@27bd8d3))
* Fallback to building barretenberg targets sequentially when RAM
constrained
([#5426](AztecProtocol/aztec-packages#5426))
([29588e0](AztecProtocol/aztec-packages@29588e0))
* Fix acvm crates reporting errors as JS packages
(#4637)
([27bd8d3](AztecProtocol/aztec-packages@27bd8d3))
* Fix versioning of `bn254_blackbox_solver` crate
(#4638)
([27bd8d3](AztecProtocol/aztec-packages@27bd8d3))
* **github:** Improve PR template "document later" checkbox description
(#4625)
([27bd8d3](AztecProtocol/aztec-packages@27bd8d3))
* Introduce selectors to enable range checks of 8-bit and 16-bit sizes
([#5465](AztecProtocol/aztec-packages#5465))
([ef44674](AztecProtocol/aztec-packages@ef44674))
* Leveraging `Bufferable` in `pedersenHash(...)` and
`sha256ToField(...)`
([#5444](AztecProtocol/aztec-packages#5444))
([0e0748c](AztecProtocol/aztec-packages@0e0748c))
* Release Noir(0.26.0) (#4526)
([27bd8d3](AztecProtocol/aztec-packages@27bd8d3))
* Renaming rand() as unsafe_rand()
([#5457](AztecProtocol/aztec-packages#5457))
([19ad2bb](AztecProtocol/aztec-packages@19ad2bb)),
closes
[#3746](AztecProtocol/aztec-packages#3746)
* Replace relative paths to noir-protocol-circuits
([d332ad1](AztecProtocol/aztec-packages@d332ad1))
* Timestamp as u64 instead of a Field
([#5453](AztecProtocol/aztec-packages#5453))
([d80dbbf](AztecProtocol/aztec-packages@d80dbbf)),
closes
[#5446](AztecProtocol/aztec-packages#5446)
* Typed encrypted and unencrypted L2 log containers
([#5422](AztecProtocol/aztec-packages#5422))
([a4d4ee8](AztecProtocol/aztec-packages@a4d4ee8))
* Update docs with function names to match version 0.25.0 specifications
(#4466)
([27bd8d3](AztecProtocol/aztec-packages@27bd8d3))
* Update integers.md to note support for Fields using `from_integer`
(#4536)
([27bd8d3](AztecProtocol/aztec-packages@27bd8d3))

### Documentation

* **yp:** Spec how bytecode is encoded in class registerer
([#5471](AztecProtocol/aztec-packages#5471))
([e3bced2](AztecProtocol/aztec-packages@e3bced2))
</details>

<details><summary>barretenberg: 0.32.0</summary>

##
[0.32.0](AztecProtocol/aztec-packages@barretenberg-v0.31.0...barretenberg-v0.32.0)
(2024-03-27)

### ⚠ BREAKING CHANGES

* Brillig typed memory
([#5395](AztecProtocol/aztec-packages#5395))

### Features

* **avm:** EQ opcode output u8 and execution
([#5402](AztecProtocol/aztec-packages#5402))
([3450e24](AztecProtocol/aztec-packages@3450e24)),
closes
[#5290](AztecProtocol/aztec-packages#5290)
* Brillig typed memory
([#5395](AztecProtocol/aztec-packages#5395))
([16b0bdd](AztecProtocol/aztec-packages@16b0bdd))

### Bug Fixes

* **ci:** Fix earthly ctest
([#5424](AztecProtocol/aztec-packages#5424))
([9cac8a4](AztecProtocol/aztec-packages@9cac8a4))
* Serial bb builds for mac
([#5462](AztecProtocol/aztec-packages#5462))
([4317819](AztecProtocol/aztec-packages@4317819))

### Miscellaneous

* **avm:** Deterministic codegen from pil and some renaming
([#5476](AztecProtocol/aztec-packages#5476))
([ba834a4](AztecProtocol/aztec-packages@ba834a4))
* Fallback to building barretenberg targets sequentially when RAM
constrained
([#5426](AztecProtocol/aztec-packages#5426))
([29588e0](AztecProtocol/aztec-packages@29588e0))
* Introduce selectors to enable range checks of 8-bit and 16-bit sizes
([#5465](AztecProtocol/aztec-packages#5465))
([ef44674](AztecProtocol/aztec-packages@ef44674))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

Underscores in numeric literals
5 participants