Skip to content

Commit 6433ddf

Browse files
committed
chore(docs): Extend stable documentation versions to build to cover multiple beta.n releases (noir-lang/noir#7685)
chore(docs): Minor fixes on local documentation development workflows (noir-lang/noir#7684) chore: add trailing slash to link on docs homepage (noir-lang/noir#7682) fix: allow referring to comptime locals at runtime (noir-lang/noir#7681) chore: easier way to test monormophization errors (noir-lang/noir#7679) chore(docs): update bb commands to match the new version (noir-lang/noir#7677) chore: update yarn version to 4.5.2 (noir-lang/noir#7678) chore: migrate to use new flat eslint config file (noir-lang/noir#7676) chore: bump JS dependencies (noir-lang/noir#7669) chore: bump wasm-pack to 0.13.1 (noir-lang/noir#7675) chore: bump node to v22.18.3 (noir-lang/noir#7668) chore!: make `ResolverError::UnnecessaryPub` a hard error (noir-lang/noir#7664) fix: correctly format let followed by comment before unsafe (noir-lang/noir#7659) chore: bump external pinned commits (noir-lang/noir#7667) chore: fixing timeouts (noir-lang/noir#7666) chore(ssa): Do not print entire functions in underconstrained values check trace (noir-lang/noir#7665) chore(ci): Exclude enum tests from Brillig reports (noir-lang/noir#7661) chore: add regression tests for PR #7570 from lambda interpreter test (noir-lang/noir#7638) chore: remove some unused HIR code (noir-lang/noir#7643) chore: update examples to use UltraHonk (noir-lang/noir#7653) fix: allow method call after block, if and match (noir-lang/noir#7655) chore: address recurring typo in docs (noir-lang/noir#7656) fix(ssa): don't check Brillig calls for coverage if they don't return anything (e.g. println) (noir-lang/noir#7644)
2 parents 811cbc6 + 21b3974 commit 6433ddf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+13010
-10577
lines changed

.noir-sync-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
70007925eb4e57a1e0482ae329862afce98c1119
1+
99830073ec96932948bbdec7a269f025e0bac136

noir/noir-repo/.eslintrc.js

-24
This file was deleted.

noir/noir-repo/.github/actions/setup/action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ runs:
77
- uses: actions/setup-node@v4
88
id: node
99
with:
10-
node-version: 18.19.0
10+
node-version: 20.18.3
1111
cache: 'yarn'
1212
cache-dependency-path: 'yarn.lock'
13-
13+
1414
- name: Install
1515
run: yarn --immutable
1616
shell: bash

noir/noir-repo/.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
4545
- uses: actions/setup-node@v3
4646
with:
47-
node-version: 18.19.0
47+
node-version: 20.18.3
4848
cache: 'yarn'
4949
cache-dependency-path: 'yarn.lock'
5050

noir/noir-repo/.github/workflows/test-js-packages.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ jobs:
438438
run: |
439439
# Note the lack of spaces between package names.
440440
PACKAGES_TO_BUILD="@noir-lang/types,@noir-lang/noir_js"
441-
yarn workspaces foreach -vtp --from "{$PACKAGES_TO_BUILD}" run build
441+
yarn workspaces foreach -Wvtp --from "{$PACKAGES_TO_BUILD}" run build
442442
443443
- name: Run `integration-tests`
444444
working-directory: ./compiler/integration-tests
@@ -483,7 +483,7 @@ jobs:
483483
run: |
484484
# Note the lack of spaces between package names.
485485
PACKAGES_TO_BUILD="@noir-lang/types,@noir-lang/noir_js"
486-
yarn workspaces foreach -vtp --from "{$PACKAGES_TO_BUILD}" run build
486+
yarn workspaces foreach -Wvtp --from "{$PACKAGES_TO_BUILD}" run build
487487
488488
- name: Run `integration-tests`
489489
working-directory: ./compiler/integration-tests

noir/noir-repo/.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.18.3

noir/noir-repo/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

-541
This file was deleted.

noir/noir-repo/.yarn/plugins/@yarnpkg/plugin-typescript.cjs

-9
This file was deleted.

noir/noir-repo/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

-28
This file was deleted.

noir/noir-repo/.yarn/releases/yarn-3.6.3.cjs

-874
This file was deleted.

noir/noir-repo/.yarn/releases/yarn-4.5.2.cjs

+934
Large diffs are not rendered by default.

noir/noir-repo/.yarnrc.yml

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1+
compressionLevel: mixed
2+
3+
enableGlobalCache: false
4+
15
logFilters:
26
- code: YN0013
37
level: discard
48

59
nodeLinker: node-modules
610

7-
plugins:
8-
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
9-
spec: "@yarnpkg/plugin-typescript"
10-
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
11-
spec: "@yarnpkg/plugin-workspace-tools"
12-
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
13-
spec: "@yarnpkg/plugin-interactive-tools"
14-
15-
yarnPath: .yarn/releases/yarn-3.6.3.cjs
11+
yarnPath: .yarn/releases/yarn-4.5.2.cjs

noir/noir-repo/acvm-repo/acvm_js/.eslintignore

-2
This file was deleted.

noir/noir-repo/acvm-repo/acvm_js/.eslintrc.js

-3
This file was deleted.

noir/noir-repo/acvm-repo/acvm_js/package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
"package.json"
2727
],
2828
"sideEffects": false,
29-
"packageManager": "yarn@3.5.1",
29+
"packageManager": "yarn@4.5.2",
3030
"scripts": {
3131
"build": "bash ./build.sh",
3232
"test": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha",
3333
"test:browser": "web-test-runner",
34-
"lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0",
34+
"lint": "NODE_NO_WARNINGS=1 eslint . --max-warnings 0",
3535
"publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
3636
"nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json",
3737
"clean": "chmod u+w web nodejs || true && rm -rf web nodejs"
@@ -42,11 +42,11 @@
4242
"@web/test-runner": "^0.18.1",
4343
"@web/test-runner-playwright": "^0.11.0",
4444
"chai": "^4.4.1",
45-
"eslint": "^8.57.0",
46-
"eslint-plugin-prettier": "^5.1.3",
47-
"mocha": "^10.2.0",
48-
"prettier": "3.2.5",
45+
"eslint": "^9.22.0",
46+
"eslint-plugin-prettier": "^5.2.3",
47+
"mocha": "^11.1.0",
48+
"prettier": "3.5.3",
4949
"ts-node": "^10.9.1",
50-
"typescript": "^5.4.2"
50+
"typescript": "^5.8.2"
5151
}
5252
}

noir/noir-repo/acvm-repo/acvm_js/test/node/build_info.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ it('returns the correct build info', () => {
88

99
try {
1010
revision = process.env.GIT_COMMIT || child_process.execSync('git rev-parse HEAD').toString().trim();
11-
} catch (error) {
11+
} catch (_error) {
1212
console.log('Failed to get revision, skipping test.');
1313
return;
1414
}

noir/noir-repo/acvm-repo/acvm_js/web-test-runner.config.mjs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { esbuildPlugin } from "@web/dev-server-esbuild";
2-
import { playwrightLauncher } from "@web/test-runner-playwright";
1+
import { esbuildPlugin } from '@web/dev-server-esbuild';
2+
import { playwrightLauncher } from '@web/test-runner-playwright';
33

44
export default {
55
browsers: [
6-
playwrightLauncher({ product: "chromium" }),
7-
playwrightLauncher({ product: "webkit" }),
6+
playwrightLauncher({ product: 'chromium' }),
7+
playwrightLauncher({ product: 'webkit' }),
88
// Firefox requires 40s to perform a Pedersen hash so we recommend using either
99
// a Chromium- or Webkit-based browser
1010
// playwrightLauncher({ product: "firefox" }),
@@ -14,11 +14,11 @@ export default {
1414
ts: true,
1515
}),
1616
],
17-
files: ["test/browser/**/*.test.ts"],
17+
files: ['test/browser/**/*.test.ts'],
1818
nodeResolve: true,
1919
testFramework: {
2020
config: {
21-
ui: "bdd",
21+
ui: 'bdd',
2222
timeout: 40000,
2323
},
2424
},

noir/noir-repo/compiler/integration-tests/.eslintignore

-1
This file was deleted.

noir/noir-repo/compiler/integration-tests/.eslintrc.js

-3
This file was deleted.

noir/noir-repo/compiler/integration-tests/package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@
1010
"test:browser": "web-test-runner",
1111
"test:integration:browser": "web-test-runner test/browser/**/*.test.ts",
1212
"test:integration:browser:watch": "web-test-runner test/browser/**/*.test.ts --watch",
13-
"lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0"
13+
"lint": "NODE_NO_WARNINGS=1 eslint . --max-warnings 0"
1414
},
1515
"dependencies": {
1616
"@aztec/bb.js": "portal:../../../../barretenberg/ts",
1717
"@noir-lang/noir_js": "workspace:*",
1818
"@noir-lang/noir_wasm": "workspace:*",
19-
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
20-
"@nomicfoundation/hardhat-ethers": "^3.0.0",
19+
"@nomicfoundation/hardhat-chai-matchers": "^2.0.8",
20+
"@nomicfoundation/hardhat-ethers": "^3.0.8",
2121
"@web/dev-server-esbuild": "^0.3.6",
2222
"@web/dev-server-import-maps": "^0.2.0",
2323
"@web/test-runner": "^0.18.1",
2424
"@web/test-runner-playwright": "^0.11.0",
25-
"eslint": "^8.57.0",
26-
"eslint-plugin-prettier": "^5.1.3",
27-
"ethers": "^6.7.1",
28-
"hardhat": "^2.22.6",
29-
"prettier": "3.2.5",
25+
"eslint": "^9.22.0",
26+
"eslint-plugin-prettier": "^5.2.3",
27+
"ethers": "^6.13.5",
28+
"hardhat": "^2.22.19",
29+
"prettier": "3.5.3",
3030
"smol-toml": "^1.1.2",
3131
"toml": "^3.0.0",
3232
"tslog": "^4.9.2"

noir/noir-repo/compiler/integration-tests/test/browser/recursion.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/ban-ts-comment */
21
import { expect } from '@esm-bundle/chai';
32
import { TEST_LOG_LEVEL } from '../environment.js';
43
import { Logger } from 'tslog';

noir/noir-repo/compiler/integration-tests/web-test-runner.config.mjs

+10-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { importMapsPlugin } from '@web/dev-server-import-maps';
77

88
let reporter = summaryReporter();
99
const debugPlugins = [];
10-
// eslint-disable-next-line no-undef
10+
1111
if (process.env.CI !== 'true' || process.env.RUNNER_DEBUG === '1') {
1212
reporter = defaultReporter();
1313
debugPlugins.push({
@@ -26,12 +26,14 @@ export default {
2626
// playwrightLauncher({ product: "webkit" }),
2727
// playwrightLauncher({ product: "firefox" }),
2828
],
29-
middleware: [async (ctx, next) => {
30-
if (ctx.url.endsWith('.wasm.gz')) {
31-
ctx.url = ctx.url.replace('/', "/node_modules/@aztec/bb.js/dest/browser/");
32-
}
33-
await next();
34-
}],
29+
middleware: [
30+
async (ctx, next) => {
31+
if (ctx.url.endsWith('.wasm.gz')) {
32+
ctx.url = ctx.url.replace('/', '/node_modules/@aztec/bb.js/dest/browser/');
33+
}
34+
await next();
35+
},
36+
],
3537
plugins: [
3638
esbuildPlugin({
3739
ts: true,
@@ -55,7 +57,7 @@ export default {
5557
ui: 'bdd',
5658
},
5759
},
58-
// eslint-disable-next-line no-undef
60+
5961
rootDir: fileURLToPath(new URL('./../..', import.meta.url)),
6062
testsFinishTimeout: 60 * 20e3, // 20 minutes
6163
reporters: [reporter],

noir/noir-repo/compiler/noirc_frontend/src/elaborator/patterns.rs

+24-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ use crate::{
1717
expr::{HirExpression, HirIdent, HirMethodReference, ImplKind, TraitMethod},
1818
stmt::HirPattern,
1919
},
20-
node_interner::{DefinitionId, DefinitionKind, ExprId, FuncId, GlobalId, TraitImplKind},
20+
node_interner::{
21+
DefinitionId, DefinitionInfo, DefinitionKind, ExprId, FuncId, GlobalId, TraitImplKind,
22+
},
2123
};
2224

2325
use super::{Elaborator, ResolverMeta, path_resolution::PathResolutionItem};
@@ -542,8 +544,10 @@ impl Elaborator<'_> {
542544

543545
let type_generics = item.map(|item| self.resolve_item_turbofish(item)).unwrap_or_default();
544546

545-
let definition_kind =
546-
self.interner.try_definition(definition_id).map(|definition| definition.kind.clone());
547+
let definition = self.interner.try_definition(definition_id);
548+
let is_comptime_local = !self.in_comptime_context()
549+
&& definition.is_some_and(DefinitionInfo::is_comptime_local);
550+
let definition_kind = definition.as_ref().map(|definition| definition.kind.clone());
547551

548552
let mut bindings = TypeBindings::new();
549553

@@ -574,7 +578,23 @@ impl Elaborator<'_> {
574578
let typ = self.type_check_variable_with_bindings(expr, id, generics, bindings);
575579
self.interner.push_expr_type(id, typ.clone());
576580

577-
(id, typ)
581+
// If this variable it a comptime local variable, use its current value as the final expression
582+
if is_comptime_local {
583+
let mut interpreter = self.setup_interpreter();
584+
let value = interpreter.evaluate(id);
585+
// If the value is an error it means the variable already had an error, so don't report it here again
586+
// (the error will make no sense, it will say that a non-comptime variable was referenced at runtime
587+
// but that's not true)
588+
if value.is_ok() {
589+
let (id, typ) = self.inline_comptime_value(value, location);
590+
self.debug_comptime(location, |interner| id.to_display_ast(interner).kind);
591+
(id, typ)
592+
} else {
593+
(id, typ)
594+
}
595+
} else {
596+
(id, typ)
597+
}
578598
}
579599

580600
/// Solve any generics that are part of the path before the function, for example:

noir/noir-repo/compiler/noirc_frontend/src/monomorphization/tests.rs

+22-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#![cfg(test)]
2-
use crate::tests::get_program;
2+
use crate::{
3+
elaborator::UnstableFeature,
4+
tests::{check_monomorphization_error_using_features, get_program},
5+
};
36

47
use super::{ast::Program, errors::MonomorphizationError, monomorphize};
58

@@ -29,6 +32,8 @@ fn bounded_recursive_type_errors() {
2932
let src = "
3033
fn main() {
3134
let _tree: Tree<Tree<Tree<()>>> = Tree::Branch(
35+
^^^^^^^^^^^^ Type `Tree<Tree<()>>` is recursive
36+
~~~~~~~~~~~~ All types in Noir must have a known size at compile-time
3237
Tree::Branch(Tree::Leaf, Tree::Leaf),
3338
Tree::Branch(Tree::Leaf, Tree::Leaf),
3439
);
@@ -37,10 +42,10 @@ fn bounded_recursive_type_errors() {
3742
enum Tree<T> {
3843
Branch(T, T),
3944
Leaf,
40-
}";
41-
42-
let error = get_monomorphized(src).unwrap_err();
43-
assert!(matches!(error, MonomorphizationError::RecursiveType { .. }));
45+
}
46+
";
47+
let features = vec![UnstableFeature::Enums];
48+
check_monomorphization_error_using_features(src, &features);
4449
}
4550

4651
#[test]
@@ -63,17 +68,19 @@ fn recursive_type_with_alias_errors() {
6368
let src = "
6469
fn main() {
6570
let _tree: Opt<OptAlias<()>> = Opt::Some(OptAlias::None);
71+
^^^^^^^^^ Type `Opt<()>` is recursive
72+
~~~~~~~~~ All types in Noir must have a known size at compile-time
6673
}
6774
6875
type OptAlias<T> = Opt<T>;
6976
7077
enum Opt<T> {
7178
Some(T),
7279
None,
73-
}";
74-
75-
let error = get_monomorphized(src).unwrap_err();
76-
assert!(matches!(error, MonomorphizationError::RecursiveType { .. }));
80+
}
81+
";
82+
let features = vec![UnstableFeature::Enums];
83+
check_monomorphization_error_using_features(src, &features);
7784
}
7885

7986
#[test]
@@ -85,16 +92,18 @@ fn mutually_recursive_types_error() {
8592
8693
enum Even {
8794
Zero,
95+
^^^^ Type `Odd` is recursive
96+
~~~~ All types in Noir must have a known size at compile-time
8897
Succ(Odd),
8998
}
9099
91100
enum Odd {
92101
One,
93102
Succ(Even),
94-
}";
95-
96-
let error = get_monomorphized(src).unwrap_err();
97-
assert!(matches!(error, MonomorphizationError::RecursiveType { .. }));
103+
}
104+
";
105+
let features = vec![UnstableFeature::Enums];
106+
check_monomorphization_error_using_features(src, &features);
98107
}
99108

100109
#[test]

noir/noir-repo/compiler/noirc_frontend/src/node_interner.rs

+4
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,10 @@ impl DefinitionInfo {
573573
pub fn is_global(&self) -> bool {
574574
self.kind.is_global()
575575
}
576+
577+
pub fn is_comptime_local(&self) -> bool {
578+
self.comptime && matches!(self.kind, DefinitionKind::Local(..))
579+
}
576580
}
577581

578582
#[derive(Debug, Clone, Eq, PartialEq)]

0 commit comments

Comments
 (0)