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: Sync from noir #9034

Merged
merged 25 commits into from
Oct 8, 2024
Merged
Changes from 3 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3d17e4a
[1 changes] feat(perf): Follow array sets backwards in array set from…
AztecBot Oct 5, 2024
0178e71
chore: apply sync fixes
AztecBot Oct 5, 2024
ebd7820
[1 changes] feat(perf): Follow array sets backwards in array set from…
AztecBot Oct 6, 2024
44a4d46
chore: apply sync fixes
AztecBot Oct 6, 2024
66fcb08
feat(perf): Follow array sets backwards in array set from get optimiz…
AztecBot Oct 6, 2024
7fcceac
[1 changes] feat(perf): Follow array sets backwards in array set from…
AztecBot Oct 7, 2024
414f3d3
chore: apply sync fixes
AztecBot Oct 7, 2024
dfc1444
feat(perf): Follow array sets backwards in array set from get optimiz…
AztecBot Oct 7, 2024
33140b3
[1 changes] feat: add more `Type` and `UnresolvedType` methods (https…
AztecBot Oct 7, 2024
d67386c
chore: apply sync fixes
AztecBot Oct 7, 2024
a256d70
feat: add more `Type` and `UnresolvedType` methods (https://github.co…
AztecBot Oct 7, 2024
484b386
Merge branch 'master' into sync-noir
sirasistant Oct 7, 2024
c17bc36
[1 changes] fix: handle nested arrays in calldata (https://github.com…
AztecBot Oct 7, 2024
1cb2abd
chore: apply sync fixes
AztecBot Oct 7, 2024
4ce6453
fix: handle nested arrays in calldata (https://github.com/noir-lang/n…
AztecBot Oct 7, 2024
fe9b4a4
fix: restore verify honk
sirasistant Oct 7, 2024
104725a
[1 changes] feat: handwritten parser (https://github.com/noir-lang/no…
AztecBot Oct 7, 2024
b47ebaf
chore: apply sync fixes
AztecBot Oct 7, 2024
a8b414c
feat: handwritten parser (https://github.com/noir-lang/noir/pull/6180)
AztecBot Oct 7, 2024
898b6a1
[1 changes] feat: handwritten parser (https://github.com/noir-lang/no…
AztecBot Oct 8, 2024
d16681f
chore: apply sync fixes
AztecBot Oct 8, 2024
cc51963
feat: handwritten parser (https://github.com/noir-lang/noir/pull/6180)
AztecBot Oct 8, 2024
576c7c7
fix: restore deleted tests
sirasistant Oct 8, 2024
b2ca704
update cargo lock
sirasistant Oct 8, 2024
94a8dc4
Merge branch 'master' into sync-noir
sirasistant Oct 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .noir-sync-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0ab8f5e3c32af05a3c158562c0fcf9729741e0ab
c4273a0c8f8b751a3dbe097e070e4e7b2c8ec438
38 changes: 5 additions & 33 deletions noir/noir-repo/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions noir/noir-repo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -87,8 +87,12 @@ bb_abstraction_leaks = { path = "tooling/bb_abstraction_leaks" }
acvm_cli = { path = "tooling/acvm_cli" }

# Arkworks
ark-bn254 = { version = "^0.4.0", default-features = false, features = ["curve"] }
ark-bls12-381 = { version = "^0.4.0", default-features = false, features = ["curve"] }
ark-bn254 = { version = "^0.4.0", default-features = false, features = [
"curve",
] }
ark-bls12-381 = { version = "^0.4.0", default-features = false, features = [
"curve",
] }
grumpkin = { version = "0.1.0", package = "noir_grumpkin", features = ["std"] }
ark-ec = { version = "^0.4.0", default-features = false }
ark-ff = { version = "^0.4.0", default-features = false }
@@ -117,10 +121,6 @@ clap = { version = "4.3.19", features = ["derive", "env"] }
codespan = { version = "0.11.1", features = ["serialization"] }
codespan-lsp = "0.11.1"
codespan-reporting = "0.11.1"
chumsky = { git = "https://github.com/jfecher/chumsky", rev = "ad9d312", default-features = false, features = [
"ahash",
"std",
] }

# Benchmarking
criterion = "0.5.0"
@@ -153,6 +153,8 @@ rand = "0.8.5"
proptest = "1.2.0"
proptest-derive = "0.4.0"
rayon = "1.8.0"
sha2 = { version = "0.10.6", features = ["compress"] }
sha3 = "0.10.6"

im = { version = "15.1", features = ["serde"] }
tracing = "0.1.40"
4 changes: 2 additions & 2 deletions noir/noir-repo/acvm-repo/blackbox_solver/Cargo.toml
Original file line number Diff line number Diff line change
@@ -22,8 +22,8 @@ num-bigint = "0.4"

blake2 = "0.10.6"
blake3 = "1.5.0"
sha2 = { version="0.10.6", features = ["compress",] }
sha3 = "0.10.6"
sha2.workspace = true
sha3.workspace = true
keccak = "0.1.4"
k256 = { version = "0.11.0", features = [
"ecdsa",
1 change: 0 additions & 1 deletion noir/noir-repo/compiler/noirc_errors/Cargo.toml
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@ acvm.workspace = true
codespan-reporting.workspace = true
codespan.workspace = true
fm.workspace = true
chumsky.workspace = true
noirc_printable_type.workspace = true
serde.workspace = true
serde_with = "3.2.0"
22 changes: 1 addition & 21 deletions noir/noir-repo/compiler/noirc_errors/src/position.rs
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ use std::{

pub type Position = u32;

#[derive(PartialOrd, Eq, Ord, Debug, Clone)]
#[derive(PartialOrd, Eq, Ord, Debug, Clone, Default)]
pub struct Spanned<T> {
pub contents: T,
span: Span,
@@ -121,26 +121,6 @@ impl From<Range<u32>> for Span {
}
}

impl chumsky::Span for Span {
type Context = ();

type Offset = u32;

fn new(_context: Self::Context, range: Range<Self::Offset>) -> Self {
Span(ByteSpan::from(range))
}

fn context(&self) -> Self::Context {}

fn start(&self) -> Self::Offset {
self.start()
}

fn end(&self) -> Self::Offset {
self.end()
}
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
pub struct Location {
pub span: Span,
1 change: 0 additions & 1 deletion noir/noir-repo/compiler/noirc_frontend/Cargo.toml
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@ noirc_errors.workspace = true
noirc_printable_type.workspace = true
fm.workspace = true
iter-extended.workspace = true
chumsky.workspace = true
thiserror.workspace = true
smol_str.workspace = true
im.workspace = true
3 changes: 2 additions & 1 deletion noir/noir-repo/compiler/noirc_frontend/src/ast/expression.rs
Original file line number Diff line number Diff line change
@@ -309,6 +309,7 @@ impl Expression {
pub type BinaryOp = Spanned<BinaryOpKind>;

#[derive(PartialEq, PartialOrd, Eq, Ord, Hash, Debug, Copy, Clone)]
#[cfg_attr(test, derive(strum_macros::EnumIter))]
pub enum BinaryOpKind {
Add,
Subtract,
@@ -873,7 +874,7 @@ impl FunctionDefinition {
impl Display for FunctionDefinition {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
writeln!(f, "{:?}", self.attributes)?;
write!(f, "fn {} {}", self.signature(), self.body)
write!(f, "{} {}", self.signature(), self.body)
}
}

57 changes: 27 additions & 30 deletions noir/noir-repo/compiler/noirc_frontend/src/ast/statement.rs
Original file line number Diff line number Diff line change
@@ -180,7 +180,7 @@ impl StatementKind {
}
}

#[derive(Eq, Debug, Clone)]
#[derive(Eq, Debug, Clone, Default)]
pub struct Ident(pub Spanned<String>);

impl Ident {
@@ -333,12 +333,12 @@ impl Display for UseTree {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.prefix)?;

if !self.prefix.segments.is_empty() {
write!(f, "::")?;
}

match &self.kind {
UseTreeKind::Path(name, alias) => {
if !(self.prefix.segments.is_empty() && self.prefix.kind == PathKind::Plain) {
write!(f, "::")?;
}

write!(f, "{name}")?;

if let Some(alias) = alias {
@@ -348,7 +348,7 @@ impl Display for UseTree {
Ok(())
}
UseTreeKind::List(trees) => {
write!(f, "::{{")?;
write!(f, "{{")?;
let tree = vecmap(trees, ToString::to_string).join(", ");
write!(f, "{tree}}}")
}
@@ -467,7 +467,9 @@ impl Path {
}

pub fn is_ident(&self) -> bool {
self.segments.len() == 1 && self.kind == PathKind::Plain
self.kind == PathKind::Plain
&& self.segments.len() == 1
&& self.segments.first().unwrap().generics.is_none()
}

pub fn as_ident(&self) -> Option<&Ident> {
@@ -484,6 +486,10 @@ impl Path {
self.segments.first().cloned().map(|segment| segment.ident)
}

pub fn is_empty(&self) -> bool {
self.segments.is_empty() && self.kind == PathKind::Plain
}

pub fn as_string(&self) -> String {
let mut string = String::new();

@@ -650,14 +656,6 @@ impl Pattern {
}
}

pub(crate) fn into_ident(self) -> Ident {
match self {
Pattern::Identifier(ident) => ident,
Pattern::Mutable(pattern, _, _) => pattern.into_ident(),
other => panic!("Pattern::into_ident called on {other} pattern with no identifier"),
}
}

pub(crate) fn try_as_expression(&self, interner: &NodeInterner) -> Option<Expression> {
match self {
Pattern::Identifier(ident) => Some(Expression {
@@ -726,37 +724,36 @@ impl LValue {
Expression::new(kind, span)
}

pub fn from_expression(expr: Expression) -> LValue {
pub fn from_expression(expr: Expression) -> Option<LValue> {
LValue::from_expression_kind(expr.kind, expr.span)
}

pub fn from_expression_kind(expr: ExpressionKind, span: Span) -> LValue {
pub fn from_expression_kind(expr: ExpressionKind, span: Span) -> Option<LValue> {
match expr {
ExpressionKind::Variable(path) => LValue::Ident(path.as_ident().unwrap().clone()),
ExpressionKind::MemberAccess(member_access) => LValue::MemberAccess {
object: Box::new(LValue::from_expression(member_access.lhs)),
ExpressionKind::Variable(path) => Some(LValue::Ident(path.as_ident().unwrap().clone())),
ExpressionKind::MemberAccess(member_access) => Some(LValue::MemberAccess {
object: Box::new(LValue::from_expression(member_access.lhs)?),
field_name: member_access.rhs,
span,
},
ExpressionKind::Index(index) => LValue::Index {
array: Box::new(LValue::from_expression(index.collection)),
}),
ExpressionKind::Index(index) => Some(LValue::Index {
array: Box::new(LValue::from_expression(index.collection)?),
index: index.index,
span,
},
}),
ExpressionKind::Prefix(prefix) => {
if matches!(
prefix.operator,
crate::ast::UnaryOp::Dereference { implicitly_added: false }
) {
LValue::Dereference(Box::new(LValue::from_expression(prefix.rhs)), span)
Some(LValue::Dereference(Box::new(LValue::from_expression(prefix.rhs)?), span))
} else {
panic!("Called LValue::from_expression with an invalid prefix operator")
None
}
}
ExpressionKind::Interned(id) => LValue::Interned(id, span),
_ => {
panic!("Called LValue::from_expression with an invalid expression")
}
ExpressionKind::Parenthesized(expr) => LValue::from_expression(*expr),
ExpressionKind::Interned(id) => Some(LValue::Interned(id, span)),
_ => None,
}
}

19 changes: 18 additions & 1 deletion noir/noir-repo/compiler/noirc_frontend/src/ast/traits.rs
Original file line number Diff line number Diff line change
@@ -216,7 +216,24 @@ impl Display for TraitBound {

impl Display for NoirTraitImpl {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
writeln!(f, "impl {}{} for {} {{", self.trait_name, self.trait_generics, self.object_type)?;
write!(f, "impl")?;
if !self.impl_generics.is_empty() {
write!(
f,
"<{}>",
self.impl_generics.iter().map(ToString::to_string).collect::<Vec<_>>().join(", ")
)?;
}

write!(f, " {}{} for {}", self.trait_name, self.trait_generics, self.object_type)?;
if !self.where_clause.is_empty() {
write!(
f,
" where {}",
self.where_clause.iter().map(ToString::to_string).collect::<Vec<_>>().join(", ")
)?;
}
writeln!(f, "{{")?;

for item in self.items.iter() {
let item = item.to_string();
3 changes: 2 additions & 1 deletion noir/noir-repo/compiler/noirc_frontend/src/debug/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::ast::PathSegment;
use crate::parser::{parse_program, ParsedModule};
use crate::parse_program;
use crate::parser::ParsedModule;
use crate::{
ast,
ast::{Path, PathKind},
Loading
Loading