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: Add assert_constant #2242

Merged
merged 4 commits into from
Aug 11, 2023
Merged

feat: Add assert_constant #2242

merged 4 commits into from
Aug 11, 2023

Conversation

jfecher
Copy link
Contributor

@jfecher jfecher commented Aug 9, 2023

Description

Problem*

Resolves #2223

Summary*

Used for debugging if a value is a known constant before the time of loop unrolling. It is useful to know before loop unrolling since that is the only pass which will fail if a value (loop bounds) are not constant.

Example error:

error: 
  ┌─ /.../example/src/main.nr:5:5
  │
5 │     assert_constant(x);
  │     ------------------ Argument is not constant

Documentation

  • This PR requires documentation updates when merged.

    • I will submit a noir-lang/docs PR.
    • I will request for and support Dev Rel's help in documenting this PR.

Additional Context

PR Checklist*

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

@jfecher jfecher requested a review from vezenovm August 10, 2023 21:19
@kevaundray kevaundray added this pull request to the merge queue Aug 11, 2023
Merged via the queue into master with commit a72daa4 Aug 11, 2023
@kevaundray kevaundray deleted the jf/assert-comptime branch August 11, 2023 08:48
TomAFrench added a commit that referenced this pull request Aug 11, 2023
* master:
  fix: Fix assignment when both `mut` and `&mut` are used (#2264)
  feat: Add `assert_constant` (#2242)
TomAFrench added a commit that referenced this pull request Aug 15, 2023
* master: (23 commits)
  chore: Reuse workspace target directory in wasm build script (#2312)
  feat(nargo): Add `--workspace` flag to run commands in every package (#2313)
  chore(frontend): Replace `ModuleOrigin` with `Location` on `ModuleData` (#2308)
  fix: Fix 3 parser test cases in parsing (#2284)
  fix: Require package names to be non-empty (#2293)
  fix(nargo)!: Remove `-p` short flag from the `--program-dir` flag (#2300)
  feat: optionally output a debug artifact on compile (#2260)
  chore: `nargo info` now prints information as a prettified table  (#2282)
  fix(lsp): Pass `--program-dir` to test command from codelens (#2292)
  fix(nargo): Allow `--program-dir` flag anywhere in a command (#2290)
  feat: Execute brillig opcodes with constant inputs at compile-time (#2190)
  feat: Add basic benchmarking (#2213)
  feat: Include struct names in ABIs (#2266)
  feat(nargo): Add `--exact` flag to `nargo test` (#2272)
  fix: Fix assignment when both `mut` and `&mut` are used (#2264)
  feat: Add `assert_constant` (#2242)
  feat(nargo): Add support for contracts in `nargo check` (#2267)
  chore(ci): Name wasm job more clearly (#2269)
  chore(ci): Create cache key with consideration to target (#2273)
  chore(ci): Run publish workflow against PRs (#2268)
  ...
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.

Add assert_comptime builtin to panic if a value is not compile-time known
2 participants