noir-lang / noir

Noir is a domain specific language for zero knowledge proofs
https://noir-lang.org
Apache License 2.0
872 stars 188 forks source link

Docs for `Field` methods are out of date and fail to compile #6070

Closed michaeljklein closed 2 weeks ago

michaeljklein commented 2 weeks ago

Aim

Attempted to learn how to_le_bytes and to_be_bytes worked from their noir-lang.org/docs page

Expected Behavior

Expected to find how those methods worked, including each parameter, along with working example code

Bug

fn main() {
    let field = 2;
    let bytes = field.to_le_bytes(4);
}
warning: unused variable bytes
  ┌─ src/main.nr:3:9
  │
3 │     let bytes = field.to_le_bytes(4);
  │         ----- unused variable 
  │

error: Function expects 1 parameter but 2 were given
  ┌─ src/main.nr:3:17
  │
3 │     let bytes = field.to_le_bytes(4);
  │                 --------------------
  │

Aborting due to 1 previous error

To Reproduce

1. 2. 3. 4.

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

None

Blocker Context

No response

Nargo Version

nargo version = 0.33.0 noirc version = 0.33.0+e84f7d2e81c1f59e9af015f38c2d477607a9c558 (git version hash: e84f7d2e81c1f59e9af015f38c2d477607a9c558, is dirty: false)

NoirJS Version

No response

Proving Backend Tooling & Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

TomAFrench commented 2 weeks ago

This is expected as those are the docs for the version 0.33.0 which is from before these changes. The latest docs are correct.