You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's a minimal example. I want to write A<B<C>> for some concrete type C, but the compiler complains with error: Unexpected <, expected one of >, ,, ::, binary operator; I.e. it didn't expect to see < twice.
I conjured this example just as a way of being able to justify writing A<B<Field>>.
structA<T>{b:T,}impl<T>A<T>{fnnew(b:T) -> Self{A{ b }}}structB<T>{c:T,}impl<T>B<T>{fnnew(c:T) -> Self{B{ c }}}fnmain(c:Field,d:Field) -> pubA<B<Field>>{letmut b = B::new(c);letmut a = A::new(b);letmut ab = a.b;
ab.c *= d;
ab
}
error: Unexpected <, expected one of >, ,, ::, binary operator
┌─ /mnt/user-data/mike/packages/yarn-project/noir-contracts/src/contracts/zk_nft_contract/src/main.nr:50:44
│
50 │ fn main (c: Field, d: Field) -> pub A<B<Field>> {
│ -
Installation method
noirup
Nargo version
nargo 0.4.1 (git version hash: 3d2233d, is dirty: false)
The text was updated successfully, but these errors were encountered:
Ah, this is caused by the >> being tokenized as a right shift. So the parser sees A lessthan B lessthan Field rightshift rather than two separate greater-than tokens to terminate each generics list.
Aim
Here's a minimal example. I want to write
A<B<C>>
for some concrete typeC
, but the compiler complains witherror: Unexpected <, expected one of >, ,, ::, binary operator
; I.e. it didn't expect to see<
twice.I conjured this example just as a way of being able to justify writing
A<B<Field>>
.Installation method
noirup
Nargo version
nargo 0.4.1 (git version hash: 3d2233d, is dirty: false)
The text was updated successfully, but these errors were encountered: