From 398e6f546940bb02079d6899f8a821fee25e0570 Mon Sep 17 00:00:00 2001 From: gluax <16431709+gluax@users.noreply.github.com> Date: Mon, 28 Mar 2022 06:21:17 -0700 Subject: [PATCH 01/10] merge upstream testnet3 --- Cargo.lock | 38 +---- Cargo.toml | 2 +- compiler/ast/src/chars/char_value.rs | 12 ++ compiler/parser/src/parser/context.rs | 6 +- compiler/parser/src/parser/expression.rs | 20 +-- compiler/parser/src/parser/file.rs | 9 +- compiler/parser/src/parser/statement.rs | 8 +- compiler/parser/src/tokenizer/lexer.rs | 2 +- docs/grammar/README.md | Bin 22137 -> 46142 bytes docs/grammar/abnf-grammar.txt | 9 +- leo/errors/src/parser/parser_errors.rs | 4 +- .../parser/parser/circuits/consts.leo.out | 124 ++++++++++++++ .../parser/circuits/consts_fail.leo.out | 5 + .../circuits/token_circuit_name.leo.out | 15 ++ .../parser/parser/circuits/types_fail.leo.out | 5 + .../expression/literal/char_fail.leo.out | 2 + .../expression/literal/static_fail.leo.out | 19 +++ .../expression/literal/string_fail.leo.out | 8 +- .../parser/expression/token_format.leo.out | 82 +++++++++ .../parser/expression/unary/negate.leo.out | 62 ++++--- .../parser/functions/ident_token_fail.leo.out | 5 + .../parser/parser/functions/mut_input.leo.out | 5 + .../parser/functions/mut_input_fail.leo.out | 5 + .../functions/test_keyword_fail.leo.out | 5 + .../parser/parser/inputs/input_fail.leo.out | 5 + .../parser/parser/program/q_eof.leo.out | 2 +- .../parser/parser/statement/alias.leo.out | 58 +++++++ .../parser/statement/global_const.leo.out | 109 ++++++++++++ .../statement/test_keyword_fail.leo.out | 5 + tests/parser/circuits/consts.leo | 7 + tests/parser/circuits/token_circuit_name.leo | 6 + tests/parser/circuits/types_fail.leo | 17 ++ tests/parser/expression/literal/char_fail.leo | 2 + tests/parser/expression/token_format.leo | 160 ++++++++++++++++++ tests/parser/functions/ident_token_fail.leo | 6 + tests/parser/functions/mut_input_fail.leo | 6 + tests/parser/functions/test_keyword_fail.leo | 6 + tests/parser/inputs/input_fail.leo | 6 + tests/parser/statement/alias.leo | 12 ++ tests/parser/statement/global_const.leo | 14 ++ 40 files changed, 780 insertions(+), 93 deletions(-) create mode 100644 tests/expectations/parser/parser/circuits/consts_fail.leo.out create mode 100644 tests/expectations/parser/parser/circuits/token_circuit_name.leo.out create mode 100644 tests/expectations/parser/parser/circuits/types_fail.leo.out create mode 100644 tests/expectations/parser/parser/expression/literal/static_fail.leo.out create mode 100644 tests/expectations/parser/parser/expression/token_format.leo.out create mode 100644 tests/expectations/parser/parser/functions/ident_token_fail.leo.out create mode 100644 tests/expectations/parser/parser/functions/mut_input.leo.out create mode 100644 tests/expectations/parser/parser/functions/mut_input_fail.leo.out create mode 100644 tests/expectations/parser/parser/functions/test_keyword_fail.leo.out create mode 100644 tests/expectations/parser/parser/inputs/input_fail.leo.out create mode 100644 tests/expectations/parser/parser/statement/alias.leo.out create mode 100644 tests/expectations/parser/parser/statement/global_const.leo.out create mode 100644 tests/expectations/parser/parser/statement/test_keyword_fail.leo.out create mode 100644 tests/parser/circuits/token_circuit_name.leo create mode 100644 tests/parser/circuits/types_fail.leo create mode 100644 tests/parser/expression/token_format.leo create mode 100644 tests/parser/functions/ident_token_fail.leo create mode 100644 tests/parser/functions/mut_input_fail.leo create mode 100644 tests/parser/functions/test_keyword_fail.leo create mode 100644 tests/parser/inputs/input_fail.leo create mode 100644 tests/parser/statement/alias.leo create mode 100644 tests/parser/statement/global_const.leo diff --git a/Cargo.lock b/Cargo.lock index 7af375330d..2fd675137b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1150,7 +1150,7 @@ dependencies = [ "toml", "tracing", "tracing-subscriber", - "zip 0.6.0", + "zip", ] [[package]] @@ -1164,7 +1164,7 @@ dependencies = [ "toml", "tracing", "walkdir", - "zip 0.6.0", + "zip", ] [[package]] @@ -1719,9 +1719,9 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.20.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26aab6b48e2590e4a64d1ed808749ba06257882b461d01ca71baeb747074a6dd" +checksum = "8533f14c8382aaad0d592c812ac3b826162128b65662331e1127b45c3d18536b" dependencies = [ "memchr", ] @@ -2018,9 +2018,9 @@ dependencies = [ [[package]] name = "self_update" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc3e89793fe56c82104ddc103c998e4e94713cb975202207829e61031eb4be6" +checksum = "710b9f39843957861314222c3bad16b9138f664665125ba277a48930253c4ed5" dependencies = [ "hyper", "indicatif", @@ -2031,7 +2031,7 @@ dependencies = [ "semver 0.11.0", "serde_json", "tempfile", - "zip 0.5.13", + "zip", ] [[package]] @@ -2363,16 +2363,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "time" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" -dependencies = [ - "libc", - "winapi 0.3.9", -] - [[package]] name = "time" version = "0.3.7" @@ -2819,18 +2809,6 @@ dependencies = [ "linked-hash-map", ] -[[package]] -name = "zip" -version = "0.5.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815" -dependencies = [ - "byteorder", - "crc32fast", - "thiserror", - "time 0.1.43", -] - [[package]] name = "zip" version = "0.6.0" @@ -2846,7 +2824,7 @@ dependencies = [ "hmac", "pbkdf2", "sha1", - "time 0.3.7", + "time", "zstd", ] diff --git a/Cargo.toml b/Cargo.toml index 9064a12f60..7a0b36ba6b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -86,7 +86,7 @@ version = "0.11.10" features = [ "blocking", "json", "multipart" ] [dependencies.self_update] -version = "0.28.0" +version = "0.29.0" features = [ "archive-zip" ] [dependencies.serde] diff --git a/compiler/ast/src/chars/char_value.rs b/compiler/ast/src/chars/char_value.rs index 37b6fbd87f..18ed903bfb 100644 --- a/compiler/ast/src/chars/char_value.rs +++ b/compiler/ast/src/chars/char_value.rs @@ -53,6 +53,18 @@ impl fmt::Display for Char { } } +pub struct Chars(pub Vec); + +impl fmt::Display for Chars { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + for character in self.0.iter() { + write!(f, "{}", character)?; + } + + Ok(()) + } +} + #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct CharValue { pub character: Char, diff --git a/compiler/parser/src/parser/context.rs b/compiler/parser/src/parser/context.rs index 55abbf3ba0..565a36adbb 100644 --- a/compiler/parser/src/parser/context.rs +++ b/compiler/parser/src/parser/context.rs @@ -30,8 +30,8 @@ pub struct ParserContext<'a> { pub(crate) handler: &'a Handler, tokens: Vec, end_span: Span, - // true if parsing an expression for an if statement -- means circuit inits are not legal - pub(crate) fuzzy_struct_state: bool, + // true if parsing an expression for if and loop statements -- means circuit inits are not legal + pub(crate) disallow_circuit_construction: bool, } impl Iterator for ParserContext<'_> { @@ -61,7 +61,7 @@ impl<'a> ParserContext<'a> { .map(|x| x.span.clone()) .unwrap_or_default(), tokens, - fuzzy_struct_state: false, + disallow_circuit_construction: false, } } diff --git a/compiler/parser/src/parser/expression.rs b/compiler/parser/src/parser/expression.rs index 58d0b4a4c2..db38bd54f2 100644 --- a/compiler/parser/src/parser/expression.rs +++ b/compiler/parser/src/parser/expression.rs @@ -41,16 +41,16 @@ impl ParserContext<'_> { /// pub fn parse_expression(&mut self) -> Result { // Store current parser state. - let prior_fuzzy_state = self.fuzzy_struct_state; + let prior_fuzzy_state = self.disallow_circuit_construction; // Allow circuit init expressions. - self.fuzzy_struct_state = false; + self.disallow_circuit_construction = false; // Parse expression. let result = self.parse_conditional_expression(); // Restore prior parser state. - self.fuzzy_struct_state = prior_fuzzy_state; + self.disallow_circuit_construction = prior_fuzzy_state; result } @@ -248,16 +248,6 @@ impl ParserContext<'_> { Token::Minus => UnaryOperation::Negate, _ => unreachable!("parse_unary_expression_ shouldn't produce this"), }; - // hack for const signed integer overflow issues - if matches!(operation, UnaryOperation::Negate) { - if let Expression::Value(ValueExpression::Integer(type_, value, span)) = inner { - inner = Expression::Value(ValueExpression::Integer(type_, format!("-{}", value), &op.span + &span)); - continue; - } else if let Expression::Value(ValueExpression::Implicit(value, span)) = inner { - inner = Expression::Value(ValueExpression::Implicit(format!("-{}", value), &op.span + &span)); - continue; - } - } inner = Expression::Unary(UnaryExpression { span: &op.span + inner.span(), op: operation, @@ -557,7 +547,7 @@ impl ParserContext<'_> { Token::LeftSquare => self.parse_array_expression(&span)?, Token::Ident(name) => { let ident = Identifier { name, span }; - if !self.fuzzy_struct_state && self.peek_token().as_ref() == &Token::LeftCurly { + if !self.disallow_circuit_construction && self.peek_token().as_ref() == &Token::LeftCurly { self.parse_circuit_expression(ident)? } else { Expression::Identifier(ident) @@ -568,7 +558,7 @@ impl ParserContext<'_> { name: sym::SelfUpper, span, }; - if !self.fuzzy_struct_state && self.peek_token().as_ref() == &Token::LeftCurly { + if !self.disallow_circuit_construction && self.peek_token().as_ref() == &Token::LeftCurly { self.parse_circuit_expression(ident)? } else { Expression::Identifier(ident) diff --git a/compiler/parser/src/parser/file.rs b/compiler/parser/src/parser/file.rs index 6318e66600..51732e0370 100644 --- a/compiler/parser/src/parser/file.rs +++ b/compiler/parser/src/parser/file.rs @@ -293,11 +293,11 @@ impl ParserContext<'_> { // `IDENT: TYPE = EXPR`: let (name, type_) = self.parse_typed_field_name()?; self.expect(Token::Assign)?; - let literal = self.parse_primary_expression()?; + let expr = self.parse_expression()?; self.expect(Token::Semicolon)?; - Ok(CircuitMember::CircuitConst(name, type_, literal)) + Ok(CircuitMember::CircuitConst(name, type_, expr)) } /// @@ -336,11 +336,6 @@ impl ParserContext<'_> { pub fn parse_circuit(&mut self) -> Result<(Identifier, Circuit)> { let name = if let Some(ident) = self.eat_identifier() { ident - } else if let Some(scalar_type) = self.eat_any(crate::type_::TYPE_TOKENS) { - Identifier { - name: scalar_type.token.keyword_to_symbol().unwrap(), - span: scalar_type.span, - } } else { let next = self.peek()?; return Err(ParserError::unexpected_str(&next.token, "ident", &next.span).into()); diff --git a/compiler/parser/src/parser/statement.rs b/compiler/parser/src/parser/statement.rs index 3155a0b633..2482f4a44c 100644 --- a/compiler/parser/src/parser/statement.rs +++ b/compiler/parser/src/parser/statement.rs @@ -167,9 +167,9 @@ impl ParserContext<'_> { /// Returns a [`ConditionalStatement`] AST node if the next tokens represent a conditional statement. pub fn parse_conditional_statement(&mut self) -> Result { let start = self.expect(Token::If)?; - self.fuzzy_struct_state = true; + self.disallow_circuit_construction = true; let expr = self.parse_conditional_expression()?; - self.fuzzy_struct_state = false; + self.disallow_circuit_construction = false; let body = self.parse_block()?; let next = if self.eat(Token::Else).is_some() { let s = self.parse_statement()?; @@ -199,9 +199,9 @@ impl ParserContext<'_> { let start = self.parse_expression()?; self.expect(Token::DotDot)?; let inclusive = self.eat(Token::Assign).is_some(); - self.fuzzy_struct_state = true; + self.disallow_circuit_construction = true; let stop = self.parse_conditional_expression()?; - self.fuzzy_struct_state = false; + self.disallow_circuit_construction = false; let block = self.parse_block()?; diff --git a/compiler/parser/src/tokenizer/lexer.rs b/compiler/parser/src/tokenizer/lexer.rs index 233ea4d0a0..35656915b0 100644 --- a/compiler/parser/src/tokenizer/lexer.rs +++ b/compiler/parser/src/tokenizer/lexer.rs @@ -209,7 +209,7 @@ impl Token { return Ok((len + 2, Token::StringLit(string))); } - return Err(ParserError::lexer_string_not_closed(string).into()); + return Err(ParserError::lexer_string_not_closed(leo_ast::Chars(string)).into()); } Some('\'') => { input.next(); diff --git a/docs/grammar/README.md b/docs/grammar/README.md index 1e1075618883b069f1e8a3971d57ce9c9aa7ade4..40f6173c509eb689baded4f67ecd94063ee1e2b9 100644 GIT binary patch literal 46142 zcmeHQX>**#5uVSf%755w$^kpbhaB612vUx*om3H^B2yFrib%3-6m&%gwjuoWB>haQ zGc)h>O!ur-Mxjz$(q7X~_w+SA$NTQT|Megogv0PE9EF|mJbWEa!YsTQ9)zp(yc%wX zTjA}n5?`&-|5>;ncEdK&%)&ZR9aH=5ut(3c@TagJw!-!B^YF9qgphXPr_bma6tlDU zhhc+wfy+U7M*mN!CBFUO40V^EVEA%pD`?MaLzcn+jqqu!j*J>yiOEH^!i4$ ze~R>D`sBS#JCJQ<^1x^E2gzQNZjjHAMIICC2Km(<{pX0BQkU-qXN}sUAE4b1?}j-c z!UjOwqJAJw=Oo!0$+tnzp!-{VY*2LUpZRG`Gb5~7xI!}Cq+Z;j|BucdGx~fMBSkX8 zCxnBZAjd+7>D3{9hG;&?__ig7A0d~2N6(;vW>(_!rlSu%>eQRJqx3BQ8pY+4LMLt6 z5benNE2J@a%2S6#HBFKOu`POBqqu(Llmq^96t%QLUI=**r6=T>M!`6+n~kHpZ*Kj<}L+apJdGM8#KlWOkr zW{ktgOQ@j6TZdR9(&}t8kWBrID?lCorb6 zMo|0k*m`Xt$yZ{YKu=JMVEnQDe%hBB!|vTGjkT%Aw_|2}KirFXF@64!KF6cf1|o+2 z+WwC!gmbH|GpQSH3~8^{x!9G&ytv)nM zkA5VNF8ye>Zv9xI>rqXw(D?BzjtCeZWNruj_iNhnTjWluMFnHo_MYNfR-Lw&*z@aD z*Nw&Zy!hjCE>EK6`nRsXWqQ5NL1N(sWt~w^F8x~G!N2FjSxlF1c@j-MT;>^RUE`u- zu;ys_qAl~d|Lc0TB>AbwsjoV)qtS2|b3Y3aJN0M_9rk<9`+IgP?2Tjpi1(VU_RmT4SbaY<`R~xmg@v|5D^7PEt!~pA zw2gH){KnDh7GZfLd*;BxK1|;V@Dkhl@aD9$(?>jYNPp_m>nW}9*?K)C3)y-F$E4SC zEu_u{@Sj8K^HE$Cf!|{W2p#ZT+0Jzqf@F-BB>OEwzZ3F(xcl_UU!&zLNim0gaV|+M zge2+RDCxaI(hZXIJEx>0`pdP=64)B$b(g+A;Jc+x>yG94T@<&vS82!1j@T|XURIJT1t6ZZsZLHL$yu^BG%Pe~PD(diR^cI=f)z9#C z*{kTWZgi3zcRMfhCJhABUjie*OUXlo7B<5nq|W#zK9$Id<7*xKz;TbkusJ=cy@=H+L# zW_Ql2!?N9F(`=eGjeBjIR@W+fW}@O5f;9q^-m-k(I*jwSr<6%B;;&E?%RFveBYv!& zhLQxALqp}*Fs_w8J!^t}1LxRJDThj(ARdG4p4I?LkE!!(cx$*w8ROY3N! zv1Xi~l{3Z>WggY)hsCi)=NSvfrL{-MaZJfyIA4lAH{G7HN?M=Yf~D)a)&2xC4{+nF z53o9-$-Yf(uriC4l=E=H$x6&ocP^L@>c4b)+}Ecv3)VH+i0qcXj$lb_$lCe1Z&=bS zjx4f`d5|T~7@Ej1YI949Q9MtsY1=N3Fgw5aa5$&T!xwS(Omn)>6qqxIHl%VG`Z${m1PUb(p-zqqq%ylK>d*Nx$SKhLedsIt*$xhN=w`S z8uB^02 zW7{MBSjjhUI(3RH<*$ZpS;z2L-d3h8ZMsM$hI+4+O_qahWs60nwjzE}+>t0we{k18dXgpTFZx8bRI7n>D~D>UF!;WUy!w)Rv(tR!uUGY7QtgACyv)w z;4m7g9`75G+VaQ|EXkjXdx9m+;>aS~*qq6dXADhb7`3@2#VDR9oA8yadvUFMJWuzi zIZs1oXs>k=!;U7&0p~+Vd)(7r`Xuo0Bm40BJFq^C{;sGGL))uCjh;>#`EYup5)iEU zV!tm|Wb~;e9{W1Cc=V}-hpkVGkBuO_+CFXZXj2Nd-`_1>ek9@D%NG{69&N&JSC=+^ zn^y3xoM-W{=skJ;n66;ii)RQur||ODoVVxU7jbTY>^l#?qKBLSnTLPUgIAZ!-C=I~ zZoJy})SZVN@DsqKK?mv?DgiP-?3<8Pft3cjx)Us<U&KC7} zhWnA?B#`X|ZCdsT&R`dH+8TW-vqasyvf}XfOsC6xbx|jsJ-x!(8|DDGn(AuZ+`rNO1jVkx2^u2GCPp6(o?5|Pf zQl#&FQs7=veD7n78@T#sYseq_^ekE1XW^4cZ%Ge4+N8duZ#=%LAzB`#(TJaFa#(m8 zjo`KPVPUrDJU&02U;F*OMVWh@wDI~}e%*eutvy~%S0bbrxh!QHpG4ZKfMDBF^{8{n zq@7PDJ^_ZiosNwVIvvX~z3wgPo+HkRX2ff$-zkFhF+Za(n)JkO3*Cy17M;Xgzh^dj zFG~s!i2}Z+Floj@Z_x>EPp1}kkJghn#CCQRNK5uK-3vV)pi^4?)Tul@%riA+9(-RC zYenOA`9mcDhGTE`Z$rFDzmV~0^~ zm+e`nz10*M7kt+C#JAVpmiD|jl0|#Hw0U7oLEp#oSSh!3X#qPv+O%vv{|>-U$Cmy+ zTbA`BdF%`{zQYH84GAYaUeZd8+@VVDt7NU|dQjN*+Il5ouv`ysy+buudgB$KbRq6zR&AtxaSt`9f#jz;jt4dDaUbr%o-ClIW7OtXe6U}3#n}Fi3U&K?EL3JDQg2%S(@E&dJR>WR0et*)L>kvas7Zg4S&g>U!R}Z z_uocjAQ~3WHWoq}WvtBR%O1!&vj1uE9zo=)+Jk7>&y##@~pYs@%@v_IsxV@}s9Y^$J zXkOvOUd{R9$A`l)Gv1St$U(GtrI`m_5xYzhamBHiL{?Pz^kR9U4@E|d@t#=x#}Pe| zz$>&^HO2ZPu7Kg3G&;}r;cz7QGFsho;VtUZ=jyz~;-mG|<5?P= zy}P1O<@w6zsUBO5_^PF&5iF1HaD648_SqwwVMo!{TumcYMZM=MztV^EM8csJU04;# ze+6cg_FL)+YQ+t@J`GoS;Fl)w>j`|4kk?<4cY6F;zuZG;V{weye`>w;B*8Cy9MB&6 zs1|U=y_`N5jgMl87WfyQMyb;;WqP8+E3Xw9UL2{?l9U#5YALj>D6B1PVf&Fv-ty~P znr(bMdk9lr$PvA0@N%?pgs+yH7wM@NNBH()&gx^2R`9LtX7RA-g^xEATKv2?o{=U+ zkv+nswmh=T&+aJ1_uwhVE7VGIHEg-ITwnj<^#@x*FH(DCgxt6W*OMbPZkFvd8jqbU zAG391A+S#P>}lS%R}EiAO?jik)|eM5*BmMwRBQTm&1nXaPN!pq?{evw=L*_MEz7$# z8p(drV+%vtd7?rpB5MS*ZS6(MZJlWTZ}0RgT^DKZO`1ud=D}4YwoUWax!oXZJL1wP z=NSW1Ys;@wOVN-v7FZ}6jXzR6vmaZp{_2>up4*`{x5`gS<*zaO%<1J9x6-fD;(Jti zTXc_#i$M4H_M-hI*MsFJd0X)}e@`rQKa$5cdo{Z4jXml->g895y(6>Fm$+WSzJEKT z%;RtMwZ8Z9DSf=GsOu|%QfteSsik;{mSHRujYjaan!v)-XarB{0}Dgic|1^GrNBB5 zUkit;Z9Km}>BC{K{#(4v4omc`R>*UMsI0Hqw#1b*Xs1@AzMd1>ReOsR{U}%#wotCl4}#xN6+aq z&q$N=s;_AqleMO2Y2_+Cj9=*tQF%2NW&n#`8|C+bo&=UJ^k_$YLNdjeeuav)npq8Nqn!PLz8jawIt}P5{x0sh}9#Af zTObQ?RUlP2?^Ph;HD9dvD?A$3kSvXAG#42O`WX~k*E(Ix)AiOK9o8PEV_ACj;`qFE zhvtNyI}qVcJZQ;!xz;)HQ`YIwOz-Zck79khMrR3!hMn+^F@4eFFYvTJ){=5sNJKp$Bg!)vFfr<*E^ihz6W1p zgjMg;sD;6L lCC?*;h9`2=o^NrgDSYF1%Ub7&W{%!#-N-BB9lnac{{YIFa{vGU literal 22137 zcmdU1e{;u$ybSoU;M+mldtJc$iOUU@v*YMSrf zw*Zd-9+zjSR%hB|MwYN|7rSp4AP9ndR4*@^;_SRNJCAnF(ZS&t>CwT_kvT5&+MHaj z+WcZ=o>sH{$;n%2|{)1K$%8IWah+GNe;{sge7MZk+D&&{e{wC}Sf z|I%F6YctC#)8zAF)i%ZHx`oZwWYv6HH|C#H2-sQ~- zf1BHz4mxYMOx;X&vQ`{!OuZDPU3htE$_x%|^z@j0Xme9kHi+|jnd282L~QSivNWf; zS+DZNy1X?33Ffa)Uw-@jtC!~ZyC2M7k6*kv{_f=u_ke8AYe@5VxwBJTEXxA%fz2kX z+Do`S`OD)MkG=)|`0J<7p1%A6o|`96Uw-%a<>ua3LcenbDq7+k;YkGyn{cPnW30AB#s-M zWMy5Q*|;n(Vf~n=3scqYEwh4e_s`pQx%zTCegFRb{#mu&ubZ8I?pT1@(O^T7P> z!$Ep@@C5%EWA53kzp9E^JFu7^P4UmVYO^wJvr{r23vCZySkw2v zeQ8|?43$Ndr;9wFla0RJsvkS`XHQsthQcVavpj9`cHLBDgrwHgpPi{kFWA&-nay%C zVB4(P(Sg%DdCq$C8pAM8|FN!HRu4ta%8|8_5Sy!_IvX(&ikykN*2Evk1S%LQ3ePn%l+|e)rr62px4h-+}ebl13eScU;LP?l;asD)${X9nB zD0V~Tp-bBB^s}$+Z=e17s(zExiFo`*Av&zGkGVUF-MD+lx%>GiyZZ;tU7KXNNETJr z)?Du-g-d-=z$+>trKLwZlD?@;TYqVOd`+5fcYcej8EO(!U|zLco4dEn>)sM$d%^CH z_b`|DQ|kNkqRq8Q$O{mTn~|o5=Gdu=)AK_9$8dHjmiFFzYph^n@M6)hjxo+QQk=8; z;sTt}`0ZK|;b~dVeg?A^g%su0Jgpb0?Xqj7;35rnArgwCiapj*AQVJol|qSR2q>BE zC0IJFS_vZ(QXDFVeN#c?or)nZRg8E$=4_fRka2sF8JRDqvYxSkD}}oObA+3ANtWtm z;0fz~3_oh~N`|gNbKu-n7!TmKRFV;HgUi$OQ*sp9*)Z)d-YS1orUNbJZU7i%J&2x- zsGbD)QJYsXM440uJS9&-*nCYBvnTQPv%0cWas2fY{m=R3`?}!;Z`TT=zgs2Qe2(~6 zz8J7-TP3G;T~d>*R&|*xtu3|X<%(g8A}{9z!;KNQtgD&aB2x2NQ?HlQR(#G4 zhj+N;_7S(-`4hJs9t{jF7{mUQIY->xCG=y=(z<5L>w$~wfs5;bi)-s*e4DghF7sxV zt@0GUVD_Y8 z201`e1B-bqvRno+_rf|Xr=dH~XT=3>L+8a=!HbGWX34-^$ZdBodXRoWWYjacoz?6F zlHQ8D4LeBhl9luPLl*T*IUmSjF~VcXlVpkfJheY(_UGLG%0TmNF(p|?s!I7@SM_eE&I!E+v zv$msKh{)`P+4kSB8oDLHh)I$&{beJYUVSWxiD>Tg{5%dMazTvpZCZt6jIuWa=nM!B!sF%vP{VsLBo78KKZFGDgB? z6JzvHsYEGuiJ~G=5Gar2O%jzqYT%xE)9vNDhu;*{ACmhsFbj}8V(NQ^MMHM94 zN>Q?|0-=dXzjo2U&_UhU{eZ_Q{+7`UZtSQg26Fa!0FYRN9vB~pD7LYy7)3V*>*8Dg zlHj)K&cH2`{5qIsaJHd38(AvK!3Qsd@vscdUM%ici6MxX3`I;zC?i(%j))T-1gB+@ z5*okK%I@0Bx+%_eTxU%;#mN!-sD5zGAkK8N%$|<2BX(Q(Y-TH0ZUq02E$Hwl@uHZG z6mTp=E%1H-Uo9l<;da7M9^D2H#p+G!5JoqWLjc_t4gvmlqucoyLgEp@W#u-iH^gxv zQ2&y8@|iVAEE)qJS!Vzct%zaPh=hVx31=-8B-(MdSuK`Yd^95t@R3yTTyLzwa-R4u zFHZ5~AU*-KvW+O_Gkp_Md{u;f3$6> z{fVcEu!E;0__?+4AGK7u_y3Ss&W1}y#ZX!_n2_&wU z>ulCiFF351pW#8h(oHBrKXG*ZMN1SZkAZ)jh(IJ6i)=DB5>m~%DOqva3mi4}Z(e}9 z9bZM;3!Jt({<8)LPcL#*jK&&CVJG5oij%^4XlgYvWBCq=LyuxwyhIrE1{mihf(xBs zWGEw^Hy2oit5D?Fk`|_Vb4^zagd%64YhfGyimh0Qh0cz&u@UT#mYG`TfduL%iVG|3 zINQis5BXpJFp-ix`n~aX7R0Im^(gd;s>L~C) z!hHoI>d2Mstj2i;RWEUlaFnFcWZ|yRYnPfT9sk_^?!ozs|AeF5IOXO(~c1y$90>92` zCO+=CjsHl7u+)Y3e?L04Tc$<@QQDRbjwm#jY5rj;$9m-COuQH$0uZ%d;BA(`;UgnC z@oAq`>q4nj-ke>nRKq&u=!OW%7@K7+mJ>6etghsw3eM+v`Y4Y&2rRMjVeD>5 z$X;5U0ej0TIahig=34=AoVuwSVCZ69wgujmn&Ew~clkI;qd4%SJ2%D_IGdVrb8?LM zW({HwVZ>luqdMs7nHY_UO^gDmda)`jwr52_ARnXl)s)y(EcavAO*di(bHliuH~~sD zOq~LeK``0_>yHA7dMrD0`|trppvl{y1AY2yE%jjT1IvD8YXE zn5~=TOm~23(^146VwWpcU2R)#=^!wtcX55@zKT}c3AXtCBuBLL|h$IC~g_U${O zUo*+%YZ#fRtUU(XMv;ao>my~f3hK1uNEFQ&u+d`rHATjVu2vbWt6@Yp&KYaPQo(bP zu?EXUN2@*7(=aqhY<_5f*ftD~1Wz4tBBdJ^%1IY3ezK)OqH$-EdpEFMzzmTWEQSZz zm2|D)RC+VcXta|<8pJt;7dnz)x68;}Z?~fptgSqo|EZ^_9KV0W_2MN`VbUujq>U;_ zo8u^24dSA;lK-!G@xhyF#$SGLjV`8Q5hcowCYok#8*^(Lg?OK3hIq*^3B&8iFbhKr zTz0+(*R6O{vd}cLNNyt z%BcE7(TG#FL+l5w@U;*5%tu+qWjn>QDLiauH2I|`@kO?o_5LicFf52FAf_QQ{N%;qd}o zmy1d-V?29TLGw^=Q{0NAe;i3AHH30ZL&R92^xl2ceR%&`?l)wL#p3?0x@L&yOHVC3 z=q1-6J=lIAZv#n4a?m_RVE|ztdlCZ-(})jBk}LKblMjr%o8E7xSXRR0j8E$30$)-* zvB!ePk2K21|AJ$Uat0qO#=$4;`gR$|`0^jV4T0JC!(I19w7Z*6qPY(N`tP0nBCqNH z>WJxAFIWx2Gwik4XDrAyKAeb;RdSFz3jHU);CQc%cf=%?GnE=e+_Q&SqrYr7IxA~@ zkVE4pwi@8X?5`j3wR^pJYw(*_pxx^v)`gMz4yOur+OCNAlw46Eh?dJgcEqzc7z1NK s8MY(ge8k44q=puJfZI)YoY?5ApOtz6585!MZMj8>?8Py5$(~I94Z or -not-double-quote-or-backslash = %x0-21 / %x23-5B / %x5D-10FFFF +not-double-quote-or-backslash = %x0-21 / %x23-5B / %x5D-D7FF / %xE000-10FFFF ; anything but " or \ -not-single-quote-or-backslash = %x0-26 / %x28-5B / %x5D-10FFFF +not-single-quote-or-backslash = %x0-26 / %x28-5B / %x5D-D7FF / %xE000-10FFFF ; anything but ' or \ line-terminator = line-feed / carriage-return / carriage-return line-feed diff --git a/leo/errors/src/parser/parser_errors.rs b/leo/errors/src/parser/parser_errors.rs index 64afc7e82d..9ce55319ca 100644 --- a/leo/errors/src/parser/parser_errors.rs +++ b/leo/errors/src/parser/parser_errors.rs @@ -235,8 +235,8 @@ create_errors!( /// When a string is not properly closed. @backtraced lexer_string_not_closed { - args: (input: impl Debug), - msg: format!("Expected a closed string but found `{:?}`.", input), + args: (input: impl Display), + msg: format!("Expected a closed string but found `{}`.", input), help: None, } diff --git a/tests/expectations/parser/parser/circuits/consts.leo.out b/tests/expectations/parser/parser/circuits/consts.leo.out index 84c302700b..b641879948 100644 --- a/tests/expectations/parser/parser/circuits/consts.leo.out +++ b/tests/expectations/parser/parser/circuits/consts.leo.out @@ -37,5 +37,129 @@ outputs: col_stop: 28 path: "" content: " static const y: u32 = 5;" + - CircuitConst: + - "{\"name\":\"G\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const G: u8 = G;\\\"}\"}" + - IntegerType: U8 + - Identifier: "{\"name\":\"G\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const G: u8 = G;\\\"}\"}" + - CircuitConst: + - "{\"name\":\"FOO\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":18,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const FOO: Foo = Foo {};\\\"}\"}" + - Identifier: "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":23,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const FOO: Foo = Foo {};\\\"}\"}" + - CircuitInit: + name: "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":29,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const FOO: Foo = Foo {};\\\"}\"}" + members: [] + span: + line_start: 7 + line_stop: 7 + col_start: 29 + col_stop: 35 + path: "" + content: " static const FOO: Foo = Foo {};" + - CircuitConst: + - "{\"name\":\"INDEXED\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":18,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const INDEXED: Foo = A[0];\\\"}\"}" + - Identifier: "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":27,\\\"col_stop\\\":30,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const INDEXED: Foo = A[0];\\\"}\"}" + - Access: + Array: + array: + Identifier: "{\"name\":\"A\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":33,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const INDEXED: Foo = A[0];\\\"}\"}" + index: + Value: + Implicit: + - "0" + - span: + line_start: 8 + line_stop: 8 + col_start: 35 + col_stop: 36 + path: "" + content: " static const INDEXED: Foo = A[0];" + span: + line_start: 8 + line_stop: 8 + col_start: 33 + col_stop: 37 + path: "" + content: " static const INDEXED: Foo = A[0];" + - CircuitConst: + - "{\"name\":\"TINDEXED\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":18,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const TINDEXED: Foo = T.0;\\\"}\"}" + - Identifier: "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":28,\\\"col_stop\\\":31,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const TINDEXED: Foo = T.0;\\\"}\"}" + - Access: + Tuple: + tuple: + Identifier: "{\"name\":\"T\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":34,\\\"col_stop\\\":35,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const TINDEXED: Foo = T.0;\\\"}\"}" + index: + value: "0" + span: + line_start: 9 + line_stop: 9 + col_start: 34 + col_stop: 37 + path: "" + content: " static const TINDEXED: Foo = T.0;" + - CircuitConst: + - "{\"name\":\"TWO\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":18,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const TWO: i8 = 1i8 + 1i8;\\\"}\"}" + - IntegerType: I8 + - Binary: + left: + Value: + Integer: + - I8 + - "1" + - span: + line_start: 10 + line_stop: 10 + col_start: 28 + col_stop: 31 + path: "" + content: " static const TWO: i8 = 1i8 + 1i8;" + right: + Value: + Integer: + - I8 + - "1" + - span: + line_start: 10 + line_stop: 10 + col_start: 34 + col_stop: 37 + path: "" + content: " static const TWO: i8 = 1i8 + 1i8;" + op: Add + span: + line_start: 10 + line_stop: 10 + col_start: 28 + col_stop: 37 + path: "" + content: " static const TWO: i8 = 1i8 + 1i8;" + - CircuitConst: + - "{\"name\":\"mult\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":18,\\\"col_stop\\\":22,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = x * y;\\\"}\"}" + - IntegerType: I8 + - Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":29,\\\"col_stop\\\":30,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = x * y;\\\"}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":33,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = x * y;\\\"}\"}" + op: Mul + span: + line_start: 11 + line_stop: 11 + col_start: 29 + col_stop: 34 + path: "" + content: " static const mult: i8 = x * y;" + - CircuitConst: + - "{\"name\":\"mult\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":18,\\\"col_stop\\\":22,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = one();\\\"}\"}" + - IntegerType: I8 + - Call: + function: + Identifier: "{\"name\":\"one\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":29,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = one();\\\"}\"}" + arguments: [] + span: + line_start: 12 + line_stop: 12 + col_start: 29 + col_stop: 34 + path: "" + content: " static const mult: i8 = one();" global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/circuits/consts_fail.leo.out b/tests/expectations/parser/parser/circuits/consts_fail.leo.out new file mode 100644 index 0000000000..9614d661e4 --- /dev/null +++ b/tests/expectations/parser/parser/circuits/consts_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370000]: Function calls not allowed in circuit members.\n --> test:4:27\n |\n 4 | static const x: u32 = foo();\n | ^^^^^" diff --git a/tests/expectations/parser/parser/circuits/token_circuit_name.leo.out b/tests/expectations/parser/parser/circuits/token_circuit_name.leo.out new file mode 100644 index 0000000000..cb22bdf26f --- /dev/null +++ b/tests/expectations/parser/parser/circuits/token_circuit_name.leo.out @@ -0,0 +1,15 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + import_statements: [] + imports: {} + aliases: {} + circuits: + "{\"name\":\"u32\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit u32 {}\\\"}\"}": + circuit_name: "{\"name\":\"u32\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit u32 {}\\\"}\"}" + members: [] + global_consts: {} + functions: {} diff --git a/tests/expectations/parser/parser/circuits/types_fail.leo.out b/tests/expectations/parser/parser/circuits/types_fail.leo.out new file mode 100644 index 0000000000..da52e8669f --- /dev/null +++ b/tests/expectations/parser/parser/circuits/types_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'address'\n --> test:3:9\n |\n 3 | circuit address {}\n | ^^^^^^^" diff --git a/tests/expectations/parser/parser/expression/literal/char_fail.leo.out b/tests/expectations/parser/parser/expression/literal/char_fail.leo.out index 4c79c63c00..f429609540 100644 --- a/tests/expectations/parser/parser/expression/literal/char_fail.leo.out +++ b/tests/expectations/parser/parser/expression/literal/char_fail.leo.out @@ -8,6 +8,7 @@ outputs: - "Error [EPAR0370030]: Could not lex the following content: `\\n`." - "Error [EPAR0370023]: Expected more characters to lex but found none." - "Error [EPAR0370023]: Expected more characters to lex but found none." + - "Error [EPAR0370023]: Expected more characters to lex but found none." - "Error [EPAR0370031]: Expected a valid hex character but found `'`." - "Error [EPAR0370031]: Expected a valid hex character but found `'`." - "Error [EPAR0370031]: Expected a valid hex character but found `9A`." @@ -44,5 +45,6 @@ outputs: - "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `0`." - "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `0`." - "Error [EPAR0370034]: The escaped unicode char `110000` is greater than 0x10FFFF." + - "Error [EPAR0370033]: The escaped unicode char `1234567890` is not within valid length of [1, 6]." - "Error [EPAR0370026]: Expected a closed char but found `򻮻`." - "Error [EPAR0370026]: Expected a closed char but found `😭`." diff --git a/tests/expectations/parser/parser/expression/literal/static_fail.leo.out b/tests/expectations/parser/parser/expression/literal/static_fail.leo.out new file mode 100644 index 0000000000..424ff34fa8 --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/static_fail.leo.out @@ -0,0 +1,19 @@ +--- +namespace: ParseExpression +expectation: Fail +outputs: + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'address'\n --> test:1:1\n |\n 1 | address::call()\n | ^^^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'bool'\n --> test:1:1\n |\n 1 | bool::call()\n | ^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'char'\n --> test:1:1\n |\n 1 | char::call()\n | ^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'field'\n --> test:1:1\n |\n 1 | field::call()\n | ^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'group'\n --> test:1:1\n |\n 1 | group::call()\n | ^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'i8'\n --> test:1:1\n |\n 1 | i8::call()\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'i16'\n --> test:1:1\n |\n 1 | i16::call()\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'i32'\n --> test:1:1\n |\n 1 | i32::call()\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'i64'\n --> test:1:1\n |\n 1 | i64::call()\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'i128'\n --> test:1:1\n |\n 1 | i128::call()\n | ^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'u8'\n --> test:1:1\n |\n 1 | u8::call()\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'u16'\n --> test:1:1\n |\n 1 | u16::call()\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'u32'\n --> test:1:1\n |\n 1 | u32::call()\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'u64'\n --> test:1:1\n |\n 1 | u64::call()\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'u128'\n --> test:1:1\n |\n 1 | u128::call()\n | ^^^^" diff --git a/tests/expectations/parser/parser/expression/literal/string_fail.leo.out b/tests/expectations/parser/parser/expression/literal/string_fail.leo.out index bac30c2c73..331ee1f2d9 100644 --- a/tests/expectations/parser/parser/expression/literal/string_fail.leo.out +++ b/tests/expectations/parser/parser/expression/literal/string_fail.leo.out @@ -2,8 +2,8 @@ namespace: Token expectation: Fail outputs: - - "Error [EPAR0370025]: Expected a closed string but found `[Scalar('H'), Scalar('e'), Scalar('l'), Scalar('l'), Scalar('o'), Scalar(' '), Scalar('w'), Scalar('o'), Scalar('r'), Scalar('l'), Scalar('d'), Scalar('!')]`." - - "Error [EPAR0370025]: Expected a closed string but found `[Scalar('\"')]`." + - "Error [EPAR0370025]: Expected a closed string but found `Hello world!`." + - "Error [EPAR0370025]: Expected a closed string but found `\"`." - "Error [EPAR0370023]: Expected more characters to lex but found none." - "Error [EPAR0370024]: Expected a valid escape character but found `l`." - "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `a`." @@ -13,5 +13,5 @@ outputs: - "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `}`." - "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `6`." - "Error [EPAR0370032]: There was no closing `}` after a escaped unicode `af🦀\"`." - - "Error [EPAR0370025]: Expected a closed string but found `[Scalar('\"')]`." - - "Error [EPAR0370025]: Expected a closed string but found `[Scalar('⭇'), Scalar('😍'), Scalar(';')]`." + - "Error [EPAR0370025]: Expected a closed string but found `\"`." + - "Error [EPAR0370025]: Expected a closed string but found `⭇😍;`." diff --git a/tests/expectations/parser/parser/expression/token_format.leo.out b/tests/expectations/parser/parser/expression/token_format.leo.out new file mode 100644 index 0000000000..abe50e978e --- /dev/null +++ b/tests/expectations/parser/parser/expression/token_format.leo.out @@ -0,0 +1,82 @@ +--- +namespace: ParseExpression +expectation: Fail +outputs: + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '@'\n --> test:1:1\n |\n 1 | @test\n | ^" + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '&&'\n --> test:1:1\n |\n 1 | &&\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '||'\n --> test:1:1\n |\n 1 | ||\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '=='\n --> test:1:1\n |\n 1 | ==\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '!='\n --> test:1:1\n |\n 1 | !=\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '<'\n --> test:1:1\n |\n 1 | <\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '<='\n --> test:1:1\n |\n 1 | <=\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '>'\n --> test:1:1\n |\n 1 | >\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '>='\n --> test:1:1\n |\n 1 | >=\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '+'\n --> test:1:1\n |\n 1 | +\n | ^" + - "Error [EPAR0370003]: unexpected EOF\n --> test:1:1\n |\n 1 | -\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '*'\n --> test:1:1\n |\n 1 | *\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '**'\n --> test:1:1\n |\n 1 | **\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '/'\n --> test:1:1\n |\n 1 | /\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:1\n |\n 1 | =\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '+='\n --> test:1:1\n |\n 1 | +=\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '-='\n --> test:1:1\n |\n 1 | -=\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '*='\n --> test:1:1\n |\n 1 | *=\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '/='\n --> test:1:1\n |\n 1 | /=\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '**='\n --> test:1:1\n |\n 1 | **=\n | ^^^" + - "Error [EPAR0370003]: unexpected EOF\n --> test:1:1\n |\n 1 | (\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got ')'\n --> test:1:1\n |\n 1 | )\n | ^" + - "Error [EPAR0370003]: unexpected EOF\n --> test:1:1\n |\n 1 | [\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got ']'\n --> test:1:1\n |\n 1 | ]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '{'\n --> test:1:1\n |\n 1 | {\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '}'\n --> test:1:1\n |\n 1 | }\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:1\n |\n 1 | ,\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '.'\n --> test:1:1\n |\n 1 | .\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '..'\n --> test:1:1\n |\n 1 | ..\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '...'\n --> test:1:1\n |\n 1 | ...\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got ';'\n --> test:1:1\n |\n 1 | ;\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got ':'\n --> test:1:1\n |\n 1 | :\n | ^" + - "Error [EPAR0370003]: unexpected EOF\n --> test:1:2\n |\n 1 | h::\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '?'\n --> test:1:1\n |\n 1 | ?\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '->'\n --> test:1:1\n |\n 1 | ->\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '_'\n --> test:1:1\n |\n 1 | _\n | ^" + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'import'\n --> test:1:1\n |\n 1 | import\n | ^^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'as'\n --> test:1:1\n |\n 1 | as\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'circuit'\n --> test:1:1\n |\n 1 | circuit\n | ^^^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'console'\n --> test:1:1\n |\n 1 | console\n | ^^^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'const'\n --> test:1:1\n |\n 1 | const\n | ^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'else'\n --> test:1:1\n |\n 1 | else\n | ^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'for'\n --> test:1:1\n |\n 1 | for\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'function'\n --> test:1:1\n |\n 1 | function\n | ^^^^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'if'\n --> test:1:1\n |\n 1 | if\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'in'\n --> test:1:1\n |\n 1 | in\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'let'\n --> test:1:1\n |\n 1 | let\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'mut'\n --> test:1:1\n |\n 1 | mut\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '&'\n --> test:1:1\n |\n 1 | &\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'return'\n --> test:1:1\n |\n 1 | return\n | ^^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'static'\n --> test:1:1\n |\n 1 | static\n | ^^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'type'\n --> test:1:1\n |\n 1 | type\n | ^^^^" diff --git a/tests/expectations/parser/parser/expression/unary/negate.leo.out b/tests/expectations/parser/parser/expression/unary/negate.leo.out index 03766862d2..7982d0b8f4 100644 --- a/tests/expectations/parser/parser/expression/unary/negate.leo.out +++ b/tests/expectations/parser/parser/expression/unary/negate.leo.out @@ -122,24 +122,44 @@ outputs: col_stop: 4 path: "" content: "-!x" - - Value: - Implicit: - - "-5" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 3 - path: "" - content: "-5" - - Value: - Integer: - - I8 - - "-5" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "-5i8" + - Unary: + inner: + Value: + Implicit: + - "5" + - span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 3 + path: "" + content: "-5" + op: Negate + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 3 + path: "" + content: "-5" + - Unary: + inner: + Value: + Integer: + - I8 + - "5" + - span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: "" + content: "-5i8" + op: Negate + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: "-5i8" diff --git a/tests/expectations/parser/parser/functions/ident_token_fail.leo.out b/tests/expectations/parser/parser/functions/ident_token_fail.leo.out new file mode 100644 index 0000000000..7cbea7ef17 --- /dev/null +++ b/tests/expectations/parser/parser/functions/ident_token_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370005]: expected 'import', 'circuit', 'function', 'test', '@' -- got '1'\n --> test:3:1\n |\n 3 | 1 main() {}\n | ^" diff --git a/tests/expectations/parser/parser/functions/mut_input.leo.out b/tests/expectations/parser/parser/functions/mut_input.leo.out new file mode 100644 index 0000000000..96efaffce6 --- /dev/null +++ b/tests/expectations/parser/parser/functions/mut_input.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370013]: function func(mut a: u32) { ... } is deprecated. Passed variables are mutable by default.\n --> test:3:12\n |\n 3 | function f(mut a: u8) {}\n | ^^^^^" diff --git a/tests/expectations/parser/parser/functions/mut_input_fail.leo.out b/tests/expectations/parser/parser/functions/mut_input_fail.leo.out new file mode 100644 index 0000000000..96efaffce6 --- /dev/null +++ b/tests/expectations/parser/parser/functions/mut_input_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370013]: function func(mut a: u32) { ... } is deprecated. Passed variables are mutable by default.\n --> test:3:12\n |\n 3 | function f(mut a: u8) {}\n | ^^^^^" diff --git a/tests/expectations/parser/parser/functions/test_keyword_fail.leo.out b/tests/expectations/parser/parser/functions/test_keyword_fail.leo.out new file mode 100644 index 0000000000..22e16133ed --- /dev/null +++ b/tests/expectations/parser/parser/functions/test_keyword_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370015]: \"test function...\" is deprecated. Did you mean @test annotation?\n --> test:3:1\n |\n 3 | test main() {}\n | ^^^^" diff --git a/tests/expectations/parser/parser/inputs/input_fail.leo.out b/tests/expectations/parser/parser/inputs/input_fail.leo.out new file mode 100644 index 0000000000..5f8bf95de3 --- /dev/null +++ b/tests/expectations/parser/parser/inputs/input_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Input +expectation: Fail +outputs: + - "Error [EPAR0370000]: main\n --> test:3:1\n |\n 3 | main\n | ^^^^" diff --git a/tests/expectations/parser/parser/program/q_eof.leo.out b/tests/expectations/parser/parser/program/q_eof.leo.out index d7f4823873..185a49721f 100644 --- a/tests/expectations/parser/parser/program/q_eof.leo.out +++ b/tests/expectations/parser/parser/program/q_eof.leo.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370025]: Expected a closed string but found `[]`." + - "Error [EPAR0370025]: Expected a closed string but found ``." diff --git a/tests/expectations/parser/parser/statement/alias.leo.out b/tests/expectations/parser/parser/statement/alias.leo.out new file mode 100644 index 0000000000..5ebe4c024e --- /dev/null +++ b/tests/expectations/parser/parser/statement/alias.leo.out @@ -0,0 +1,58 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + import_statements: [] + imports: {} + aliases: + "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type a = u32;\\\"}\"}": + name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type a = u32;\\\"}\"}" + span: + line_start: 3 + line_stop: 3 + col_start: 1 + col_stop: 14 + path: "" + content: type a = u32; + represents: + IntegerType: U32 + "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type b = string;\\\"}\"}": + name: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type b = string;\\\"}\"}" + span: + line_start: 5 + line_stop: 5 + col_start: 1 + col_stop: 17 + path: "" + content: type b = string; + represents: + Identifier: "{\"name\":\"string\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":10,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type b = string;\\\"}\"}" + "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type c = a;\\\"}\"}": + name: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type c = a;\\\"}\"}" + span: + line_start: 7 + line_stop: 7 + col_start: 1 + col_stop: 12 + path: "" + content: type c = a; + represents: + Identifier: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type c = a;\\\"}\"}" + "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type b = [u8; 5];\\\"}\"}": + name: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type b = [u8; 5];\\\"}\"}" + span: + line_start: 9 + line_stop: 9 + col_start: 1 + col_stop: 18 + path: "" + content: "type b = [u8; 5];" + represents: + Array: + - IntegerType: U8 + - - value: "5" + circuits: {} + global_consts: {} + functions: {} diff --git a/tests/expectations/parser/parser/statement/global_const.leo.out b/tests/expectations/parser/parser/statement/global_const.leo.out new file mode 100644 index 0000000000..23cf4aa605 --- /dev/null +++ b/tests/expectations/parser/parser/statement/global_const.leo.out @@ -0,0 +1,109 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + import_statements: [] + imports: {} + aliases: {} + circuits: {} + global_consts: + x: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x: char = 'b';\\\"}\"}" + span: + line_start: 11 + line_stop: 11 + col_start: 7 + col_stop: 8 + path: "" + content: "const x: char = 'b';" + type_: Char + value: + Value: + Char: + character: + Scalar: 98 + span: + line_start: 11 + line_stop: 11 + col_start: 17 + col_stop: 20 + path: "" + content: "const x: char = 'b';" + span: + line_start: 11 + line_stop: 11 + col_start: 1 + col_stop: 20 + path: "" + content: "const x: char = 'b';" + f: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const f: u32 = x;\\\"}\"}" + span: + line_start: 5 + line_stop: 5 + col_start: 7 + col_stop: 8 + path: "" + content: "const f: u32 = x;" + type_: + IntegerType: U32 + value: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const f: u32 = x;\\\"}\"}" + span: + line_start: 5 + line_stop: 5 + col_start: 1 + col_stop: 17 + path: "" + content: "const f: u32 = x;" + y: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const y: string = \\\\\\\"hello world\\\\\\\";\\\"}\"}" + span: + line_start: 9 + line_stop: 9 + col_start: 7 + col_stop: 8 + path: "" + content: "const y: string = \"hello world\";" + type_: + Identifier: "{\"name\":\"string\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":10,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const y: string = \\\\\\\"hello world\\\\\\\";\\\"}\"}" + value: + Value: + String: + - - Scalar: 104 + - Scalar: 101 + - Scalar: 108 + - Scalar: 108 + - Scalar: 111 + - Scalar: 32 + - Scalar: 119 + - Scalar: 111 + - Scalar: 114 + - Scalar: 108 + - Scalar: 100 + - span: + line_start: 9 + line_stop: 9 + col_start: 19 + col_stop: 32 + path: "" + content: "const y: string = \"hello world\";" + span: + line_start: 9 + line_stop: 9 + col_start: 1 + col_stop: 32 + path: "" + content: "const y: string = \"hello world\";" + functions: {} diff --git a/tests/expectations/parser/parser/statement/test_keyword_fail.leo.out b/tests/expectations/parser/parser/statement/test_keyword_fail.leo.out new file mode 100644 index 0000000000..22e16133ed --- /dev/null +++ b/tests/expectations/parser/parser/statement/test_keyword_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370015]: \"test function...\" is deprecated. Did you mean @test annotation?\n --> test:3:1\n |\n 3 | test main() {}\n | ^^^^" diff --git a/tests/parser/circuits/consts.leo b/tests/parser/circuits/consts.leo index e50b3829a7..0126f3e23c 100644 --- a/tests/parser/circuits/consts.leo +++ b/tests/parser/circuits/consts.leo @@ -6,4 +6,11 @@ expectation: Pass circuit X { static const x: u32 = 2; static const y: u32 = 5; + static const G: u8 = G; + static const FOO: Foo = Foo {}; + static const INDEXED: Foo = A[0]; + static const TINDEXED: Foo = T.0; + static const TWO: i8 = 1i8 + 1i8; + static const mult: i8 = x * y; + static const mult: i8 = one(); } \ No newline at end of file diff --git a/tests/parser/circuits/token_circuit_name.leo b/tests/parser/circuits/token_circuit_name.leo new file mode 100644 index 0000000000..f0f997c474 --- /dev/null +++ b/tests/parser/circuits/token_circuit_name.leo @@ -0,0 +1,6 @@ +/* +namespace: Parse +expectation: Pass +*/ + +circuit u32 {} \ No newline at end of file diff --git a/tests/parser/circuits/types_fail.leo b/tests/parser/circuits/types_fail.leo new file mode 100644 index 0000000000..0e3151a6a5 --- /dev/null +++ b/tests/parser/circuits/types_fail.leo @@ -0,0 +1,17 @@ +/* +namespace: Parse +expectation: Fail +*/ + +circuit address {} +circuit bool {} +circuit char {} +circuit group {} +circuit i8 {} +circuit i16 {} +circuit i32 {} +circuit i64 {} +circuit u8 {} +circuit u16 {} +circuit u32 {} +circuit u64 {} \ No newline at end of file diff --git a/tests/parser/expression/literal/char_fail.leo b/tests/parser/expression/literal/char_fail.leo index 3a934152ab..fbd343b4e5 100644 --- a/tests/parser/expression/literal/char_fail.leo +++ b/tests/parser/expression/literal/char_fail.leo @@ -12,6 +12,7 @@ expectation: Fail '' +'\x '\x7' '\xz' '\x9A' @@ -51,6 +52,7 @@ expectation: Fail '\u00000000' '\u01000000' '\u{110000}' +'\u{1234567890}' '\u{bbbbb}\u{aaaa}' '😭😂😘' diff --git a/tests/parser/expression/token_format.leo b/tests/parser/expression/token_format.leo new file mode 100644 index 0000000000..a3cd81218e --- /dev/null +++ b/tests/parser/expression/token_format.leo @@ -0,0 +1,160 @@ +/* +namespace: ParseExpression +expectation: Fail +*/ + +"test" ~ + +u32 ~ + +1 ~ + +true ~ + +false ~ + +aleo13jgjyzhzhvrqecjct7scsjrfsfn09j9vryung8mfykt5502p75rsx7l9lr ~ + +'h' ~ + +@test + +!1 ~ + +&& + +|| + +== + +!= + +< + +<= + +> + +>= + ++ + +- + +* + +** + +/ + += + ++= + +-= + +*= + +/= + +**= + +( + +) + +[ + +] + +{ + +} + +, + +. + +.. + +... + +; + +: + +h:: + +? + +-> + +_ + +u8 ~ + +u16 ~ + +u32 ~ + +u64 ~ + +u128 ~ + +i8 ~ + +i16 ~ + +i32 ~ + +i64 ~ + +i128 ~ + +field ~ + +group ~ + +bool ~ + +address ~ + +char ~ + +Self ~ + +input ~ + +self ~ + +import + +as + +circuit + +console + +const + +else + +for + +function + +if + +in + +let + +mut + +& + +return + +static + +type \ No newline at end of file diff --git a/tests/parser/functions/ident_token_fail.leo b/tests/parser/functions/ident_token_fail.leo new file mode 100644 index 0000000000..edc97cfa61 --- /dev/null +++ b/tests/parser/functions/ident_token_fail.leo @@ -0,0 +1,6 @@ +/* +namespace: Parse +expectation: Fail +*/ + +1 main() {} \ No newline at end of file diff --git a/tests/parser/functions/mut_input_fail.leo b/tests/parser/functions/mut_input_fail.leo new file mode 100644 index 0000000000..94d4a16005 --- /dev/null +++ b/tests/parser/functions/mut_input_fail.leo @@ -0,0 +1,6 @@ +/* +namespace: Parse +expectation: Fail +*/ + +function f(mut a: u8) {} \ No newline at end of file diff --git a/tests/parser/functions/test_keyword_fail.leo b/tests/parser/functions/test_keyword_fail.leo new file mode 100644 index 0000000000..5e31c6a528 --- /dev/null +++ b/tests/parser/functions/test_keyword_fail.leo @@ -0,0 +1,6 @@ +/* +namespace: Parse +expectation: Fail +*/ + +test main() {} \ No newline at end of file diff --git a/tests/parser/inputs/input_fail.leo b/tests/parser/inputs/input_fail.leo new file mode 100644 index 0000000000..f678affff7 --- /dev/null +++ b/tests/parser/inputs/input_fail.leo @@ -0,0 +1,6 @@ +/* +namespace: Input +expectation: Fail +*/ + +main \ No newline at end of file diff --git a/tests/parser/statement/alias.leo b/tests/parser/statement/alias.leo new file mode 100644 index 0000000000..119df41acc --- /dev/null +++ b/tests/parser/statement/alias.leo @@ -0,0 +1,12 @@ +/* +namespace: Parse +expectation: Pass +*/ + +type a = u32; + +type b = string; + +type c = a; + +type b = [u8; 5]; \ No newline at end of file diff --git a/tests/parser/statement/global_const.leo b/tests/parser/statement/global_const.leo new file mode 100644 index 0000000000..bb51ae8aa2 --- /dev/null +++ b/tests/parser/statement/global_const.leo @@ -0,0 +1,14 @@ +/* +namespace: Parse +expectation: Pass +*/ + +const x: u32 = 1u32; + +const f: u32 = x; + +const x: i32 = 1i32; + +const y: string = "hello world"; + +const x: char = 'b'; From d37f9f29c2275ff4975387c8095c0648cfb4b2a7 Mon Sep 17 00:00:00 2001 From: gluax <16431709+gluax@users.noreply.github.com> Date: Mon, 28 Mar 2022 06:32:55 -0700 Subject: [PATCH 02/10] remove circuits --- compiler/ast-passes/src/lib.rs | 4 +- compiler/ast/src/circuits/circuit.rs | 56 ------- .../circuit_implied_variable_definition.rs | 25 --- compiler/ast/src/circuits/circuit_member.rs | 63 ------- .../circuits/circuit_variable_definition.rs | 25 --- compiler/ast/src/circuits/mod.rs | 21 --- compiler/ast/src/expression/circuit_init.rs | 73 --------- compiler/ast/src/expression/mod.rs | 7 - compiler/ast/src/lib.rs | 3 - compiler/ast/src/program.rs | 44 +---- .../src/reducer/reconstructing_director.rs | 66 -------- .../ast/src/reducer/reconstructing_reducer.rs | 37 ----- compiler/compiler/src/lib.rs | 7 +- compiler/parser/src/parser/expression.rs | 28 +--- compiler/parser/src/parser/file.rs | 155 ------------------ compiler/parser/src/tokenizer/lexer.rs | 1 - compiler/parser/src/tokenizer/token.rs | 4 - .../expression/circuit_init_fail.leo.out | 22 +-- .../parser/expression/literal/comment.leo.out | 1 - .../parser/expression/token_format.leo.out | 1 - .../parser/parser/functions/annotated.leo.out | 1 - .../parser/functions/annotated_param.leo.out | 1 - .../parser/functions/annotated_twice.leo.out | 1 - .../functions/bounded_recursion.leo.out | 1 - .../parser/functions/const_function.leo.out | 1 - .../parser/functions/const_param.leo.out | 1 - .../parser/functions/const_self_bad.leo.out | 1 - .../parser/parser/functions/empty.leo.out | 1 - .../parser/parser/functions/empty2.leo.out | 1 - .../parser/functions/ident_token_fail.leo.out | 2 +- .../functions/infinite_recursion.leo.out | 1 - .../parser/functions/param_array.leo.out | 1 - .../parser/functions/param_circuit.leo.out | 1 - .../parser/functions/param_tuple.leo.out | 1 - .../parser/parser/functions/params.leo.out | 1 - .../parser/functions/params_return.leo.out | 1 - .../parser/parser/functions/return.leo.out | 1 - .../parser/functions/return_tuple.leo.out | 1 - .../parser/serialize/one_plus_one.leo.out | 1 - .../parser/serialize/palindrome.leo.out | 1 - .../parser/serialize/parser_error.leo.out | 2 +- .../parser/parser/statement/alias.leo.out | 1 - .../parser/statement/assign_fail.leo.out | 2 +- .../parser/statement/global_const.leo.out | 1 - .../parser/unreachable/eat_ident.leo.out | 2 +- .../parser/unreachable/math_op_fail.leo.out | 4 +- .../parser/unreachable/postfix_fail.leo.out | 2 +- tests/parser/circuits/big_self.leo | 10 -- tests/parser/circuits/const_functions.leo | 23 --- tests/parser/circuits/consts.leo | 16 -- tests/parser/circuits/empty.leo | 8 - tests/parser/circuits/field_and_functions.leo | 16 -- tests/parser/circuits/fields.leo | 9 - tests/parser/circuits/fields_fail.leo | 15 -- tests/parser/circuits/functions.leo | 16 -- tests/parser/circuits/mixed_order_fail.leo | 19 --- tests/parser/circuits/mut_self_fail.leo | 10 -- tests/parser/circuits/ref_self.leo | 10 -- tests/parser/circuits/self.leo | 10 -- tests/parser/circuits/self_not_first_fail.leo | 10 -- tests/parser/circuits/struct_fail.leo | 9 - tests/parser/circuits/token_circuit_name.leo | 6 - tests/parser/circuits/types_fail.leo | 17 -- tests/parser/expression/circuit_init.leo | 22 --- tests/parser/expression/token_format.leo | 2 - tests/parser/serialize/linear_regression.leo | 70 -------- tests/parser/serialize/pedersen_hash.leo | 30 ---- 67 files changed, 28 insertions(+), 978 deletions(-) delete mode 100644 compiler/ast/src/circuits/circuit.rs delete mode 100644 compiler/ast/src/circuits/circuit_implied_variable_definition.rs delete mode 100644 compiler/ast/src/circuits/circuit_member.rs delete mode 100644 compiler/ast/src/circuits/circuit_variable_definition.rs delete mode 100644 compiler/ast/src/circuits/mod.rs delete mode 100644 compiler/ast/src/expression/circuit_init.rs delete mode 100644 tests/parser/circuits/big_self.leo delete mode 100644 tests/parser/circuits/const_functions.leo delete mode 100644 tests/parser/circuits/consts.leo delete mode 100644 tests/parser/circuits/empty.leo delete mode 100644 tests/parser/circuits/field_and_functions.leo delete mode 100644 tests/parser/circuits/fields.leo delete mode 100644 tests/parser/circuits/fields_fail.leo delete mode 100644 tests/parser/circuits/functions.leo delete mode 100644 tests/parser/circuits/mixed_order_fail.leo delete mode 100644 tests/parser/circuits/mut_self_fail.leo delete mode 100644 tests/parser/circuits/ref_self.leo delete mode 100644 tests/parser/circuits/self.leo delete mode 100644 tests/parser/circuits/self_not_first_fail.leo delete mode 100644 tests/parser/circuits/struct_fail.leo delete mode 100644 tests/parser/circuits/token_circuit_name.leo delete mode 100644 tests/parser/circuits/types_fail.leo delete mode 100644 tests/parser/expression/circuit_init.leo delete mode 100644 tests/parser/serialize/linear_regression.leo delete mode 100644 tests/parser/serialize/pedersen_hash.leo diff --git a/compiler/ast-passes/src/lib.rs b/compiler/ast-passes/src/lib.rs index 0f9455d9de..3264d2240a 100644 --- a/compiler/ast-passes/src/lib.rs +++ b/compiler/ast-passes/src/lib.rs @@ -16,8 +16,10 @@ #![doc = include_str!("../README.md")] -pub mod canonicalization; +// disable +/* pub mod canonicalization; pub use canonicalization::*; + */ // Temporarily disable import resolution // until we migrate stdlib and then import resolution. diff --git a/compiler/ast/src/circuits/circuit.rs b/compiler/ast/src/circuits/circuit.rs deleted file mode 100644 index c5caf5185f..0000000000 --- a/compiler/ast/src/circuits/circuit.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{CircuitMember, Identifier}; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -/// A record type definition, e.g., `circuit Foo { my_field: Bar }`. -/// In some languages these are called `struct`s. -/// -/// Type identity is decided by the full path including `circuit_name`, -/// as the record is nominal, not structural. -/// The fields are named so `circuit Foo(u8, u16)` is not allowed. -#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct Circuit { - /// The name of the type in the type system in this module. - pub circuit_name: Identifier, - /// The fields, constant variables, and functions of this structure. - pub members: Vec, -} - -impl Circuit { - fn format(&self, f: &mut fmt::Formatter) -> fmt::Result { - writeln!(f, "circuit {} {{ ", self.circuit_name)?; - for field in self.members.iter() { - writeln!(f, " {}", field)?; - } - write!(f, "}}") - } -} - -impl fmt::Debug for Circuit { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - self.format(f) - } -} - -impl fmt::Display for Circuit { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - self.format(f) - } -} diff --git a/compiler/ast/src/circuits/circuit_implied_variable_definition.rs b/compiler/ast/src/circuits/circuit_implied_variable_definition.rs deleted file mode 100644 index a53a428d43..0000000000 --- a/compiler/ast/src/circuits/circuit_implied_variable_definition.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{Expression, Identifier}; - -use serde::{Deserialize, Serialize}; - -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -pub struct CircuitImpliedVariableDefinition { - pub identifier: Identifier, - pub expression: Option, -} diff --git a/compiler/ast/src/circuits/circuit_member.rs b/compiler/ast/src/circuits/circuit_member.rs deleted file mode 100644 index f594130a5a..0000000000 --- a/compiler/ast/src/circuits/circuit_member.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{Expression, Function, Identifier, Type}; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -#[allow(clippy::large_enum_variant)] -/// A member of a circuit definition. -#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum CircuitMember { - /// A static constant in a circuit. - /// For example: `const foobar: u8 = 42;`. - CircuitConst( - /// The identifier of the constant. - Identifier, - /// The type the constant has. - Type, - /// The expression representing the constant's value. - /// Checked to be of the type above. - Expression, - ), - /// A varible definition in a circuit; - /// For example: `foobar: u8;`. - CircuitVariable( - /// The identifier of the constant. - Identifier, - /// The type the constant has. - Type, - ), - /// A function definition in a circuit. - /// For example: `function bar() -> u8 { return 2u8; }`. - CircuitFunction( - /// The function. - Box, - ), -} - -impl fmt::Display for CircuitMember { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - CircuitMember::CircuitConst(ref identifier, ref type_, ref value) => { - write!(f, "{}: {} = {}", identifier, type_, value) - } - CircuitMember::CircuitVariable(ref identifier, ref type_) => write!(f, "{}: {}", identifier, type_), - CircuitMember::CircuitFunction(ref function) => write!(f, "{}", function), - } - } -} diff --git a/compiler/ast/src/circuits/circuit_variable_definition.rs b/compiler/ast/src/circuits/circuit_variable_definition.rs deleted file mode 100644 index 1ba0a0243a..0000000000 --- a/compiler/ast/src/circuits/circuit_variable_definition.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{Expression, Identifier}; - -use serde::{Deserialize, Serialize}; - -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -pub struct CircuitVariableDefinition { - pub identifier: Identifier, - pub expression: Expression, -} diff --git a/compiler/ast/src/circuits/mod.rs b/compiler/ast/src/circuits/mod.rs deleted file mode 100644 index 962196abb7..0000000000 --- a/compiler/ast/src/circuits/mod.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -pub mod circuit; -pub use circuit::*; - -pub mod circuit_member; -pub use circuit_member::*; diff --git a/compiler/ast/src/expression/circuit_init.rs b/compiler/ast/src/expression/circuit_init.rs deleted file mode 100644 index 6ddaad5fb6..0000000000 --- a/compiler/ast/src/expression/circuit_init.rs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use super::*; - -/// An initializer for a single field / variable of a circuit initializer expression. -/// That is, in `Foo { bar: 42, baz }`, this is either `bar: 42`, or `baz`. -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -pub struct CircuitVariableInitializer { - /// The name of the field / variable to be initialized. - pub identifier: Identifier, - /// The expression to initialize the field with. - /// When `None`, a binding, in scope, with the name will be used instead. - pub expression: Option, -} - -impl fmt::Display for CircuitVariableInitializer { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - if let Some(expr) = &self.expression { - write!(f, "{}: {}", self.identifier, expr) - } else { - write!(f, "{}", self.identifier) - } - } -} - -/// A circuit initialization expression, e.g., `Foo { bar: 42, baz }`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct CircuitInitExpression { - /// The name of the structure type to initialize. - pub name: Identifier, - /// Initializer expressions for each of the fields in the circuit. - /// - /// N.B. Any functions or member constants in the circuit definition - /// are excluded from this list. - pub members: Vec, - /// A span from `name` to `}`. - pub span: Span, -} - -impl fmt::Display for CircuitInitExpression { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{} {{", self.name)?; - for member in self.members.iter() { - write!(f, "{}", member)?; - write!(f, ", ")?; - } - write!(f, "}}") - } -} - -impl Node for CircuitInitExpression { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/expression/mod.rs b/compiler/ast/src/expression/mod.rs index d5c473954f..0e9ea36b9c 100644 --- a/compiler/ast/src/expression/mod.rs +++ b/compiler/ast/src/expression/mod.rs @@ -35,8 +35,6 @@ mod array_init; pub use array_init::*; mod tuple_init; pub use tuple_init::*; -mod circuit_init; -pub use circuit_init::*; mod value; pub use value::*; mod call; @@ -70,8 +68,6 @@ pub enum Expression { ArrayInit(ArrayInitExpression), /// A tuple expression e.g., `(foo, 42, true)`. TupleInit(TupleInitExpression), - /// An expression constructing a structure like `Foo { bar: 42, baz }`. - CircuitInit(CircuitInitExpression), /// A call expression like `my_fun(args)`. Call(CallExpression), /// An expression of type "error". @@ -91,7 +87,6 @@ impl Node for Expression { ArrayInline(n) => n.span(), ArrayInit(n) => n.span(), TupleInit(n) => n.span(), - CircuitInit(n) => n.span(), Call(n) => n.span(), Cast(n) => n.span(), Access(n) => n.span(), @@ -110,7 +105,6 @@ impl Node for Expression { ArrayInline(n) => n.set_span(span), ArrayInit(n) => n.set_span(span), TupleInit(n) => n.set_span(span), - CircuitInit(n) => n.set_span(span), Call(n) => n.set_span(span), Cast(n) => n.set_span(span), Access(n) => n.set_span(span), @@ -131,7 +125,6 @@ impl fmt::Display for Expression { ArrayInline(n) => n.fmt(f), ArrayInit(n) => n.fmt(f), TupleInit(n) => n.fmt(f), - CircuitInit(n) => n.fmt(f), Call(n) => n.fmt(f), Cast(n) => n.fmt(f), Access(n) => n.fmt(f), diff --git a/compiler/ast/src/lib.rs b/compiler/ast/src/lib.rs index 52e817c2ff..cefb6c3e2d 100644 --- a/compiler/ast/src/lib.rs +++ b/compiler/ast/src/lib.rs @@ -31,9 +31,6 @@ pub use self::aliases::*; pub mod annotation; pub use self::annotation::*; -pub mod circuits; -pub use self::circuits::*; - pub mod chars; pub use self::chars::*; diff --git a/compiler/ast/src/program.rs b/compiler/ast/src/program.rs index 40ef1e0d00..1533bef23e 100644 --- a/compiler/ast/src/program.rs +++ b/compiler/ast/src/program.rs @@ -17,9 +17,9 @@ //! A Leo program consists of import, circuit, and function definitions. //! Each defined type consists of ast statements and expressions. -use crate::{Alias, Circuit, CircuitMember, DefinitionStatement, Function, FunctionInput, Identifier, ImportStatement}; +use crate::{Alias, DefinitionStatement, Function, FunctionInput, Identifier, ImportStatement}; -use leo_span::{sym, Symbol}; +use leo_span::Symbol; use indexmap::IndexMap; use serde::{Deserialize, Serialize}; @@ -41,8 +41,6 @@ pub struct Program { pub imports: IndexMap, Program>, /// A map from alias names to type aliases. pub aliases: IndexMap, - /// A map from circuit names to circuit definitions. - pub circuits: IndexMap, /// A map from constant names to their definitions. #[serde(with = "crate::common::global_consts_json")] pub global_consts: IndexMap, DefinitionStatement>, @@ -73,11 +71,6 @@ impl fmt::Display for Program { writeln!(f,)?; } writeln!(f,)?; - for (_, circuit) in self.circuits.iter() { - circuit.fmt(f)?; - writeln!(f,)?; - } - writeln!(f,)?; for (_, function) in self.functions.iter() { function.fmt(f)?; writeln!(f,)?; @@ -95,44 +88,11 @@ impl Program { import_statements: vec![], imports: IndexMap::new(), aliases: IndexMap::new(), - circuits: IndexMap::new(), global_consts: IndexMap::new(), functions: IndexMap::new(), } } - /// Handles all internal annotations like `@CoreFunction` and `@AlwaysConst`. - pub fn handle_internal_annotations(&mut self) { - self.circuits - .iter_mut() - .flat_map(|(_, circuit)| &mut circuit.members) - .filter_map(|member| { - if let CircuitMember::CircuitFunction(function) = member { - Some(function) - } else { - None - } - }) - .for_each(|function| { - function.annotations.retain(|name, core_map| { - match *name { - sym::CoreFunction => { - let new = core_map.arguments.get(0).copied().or(Some(function.identifier.name)); - function.core_mapping.replace(new); - false - } - sym::AlwaysConst => { - function.const_ = true; - false - } - // Could still be a valid annotation. - // Carry on and let ASG handle. - _ => true, - } - }) - }); - } - /// Extract the name of the program. pub fn get_name(&self) -> String { self.name.to_string() diff --git a/compiler/ast/src/reducer/reconstructing_director.rs b/compiler/ast/src/reducer/reconstructing_director.rs index e40dc08cad..15f80da3e7 100644 --- a/compiler/ast/src/reducer/reconstructing_director.rs +++ b/compiler/ast/src/reducer/reconstructing_director.rs @@ -67,8 +67,6 @@ impl ReconstructingDirector { Expression::TupleInit(tuple_init) => Expression::TupleInit(self.reduce_tuple_init(tuple_init)?), - Expression::CircuitInit(circuit_init) => Expression::CircuitInit(self.reduce_circuit_init(circuit_init)?), - Expression::Call(call) => Expression::Call(self.reduce_call(call)?), Expression::Err(s) => Expression::Err(s.clone()), }; @@ -238,32 +236,6 @@ impl ReconstructingDirector { self.reducer.reduce_tuple_init(tuple_init, elements) } - pub fn reduce_circuit_variable_initializer( - &mut self, - variable: &CircuitVariableInitializer, - ) -> Result { - let identifier = self.reduce_identifier(&variable.identifier)?; - let expression = variable - .expression - .as_ref() - .map(|expr| self.reduce_expression(expr)) - .transpose()?; - - self.reducer - .reduce_circuit_variable_initializer(variable, identifier, expression) - } - - pub fn reduce_circuit_init(&mut self, circuit_init: &CircuitInitExpression) -> Result { - let name = self.reduce_identifier(&circuit_init.name)?; - - let mut members = vec![]; - for member in circuit_init.members.iter() { - members.push(self.reduce_circuit_variable_initializer(member)?); - } - - self.reducer.reduce_circuit_init(circuit_init, name, members) - } - pub fn reduce_call(&mut self, call: &CallExpression) -> Result { let function = self.reduce_expression(&call.function)?; @@ -446,13 +418,6 @@ impl ReconstructingDirector { ); } - let mut circuits = IndexMap::new(); - self.reducer.swap_in_circuit(); - for (name, circuit) in program.circuits.iter() { - circuits.insert(name.clone(), self.reduce_circuit(circuit)?); - } - self.reducer.swap_in_circuit(); - let mut functions = IndexMap::new(); for (name, function) in program.functions.iter() { functions.insert(name.clone(), self.reduce_function(function)?); @@ -469,7 +434,6 @@ impl ReconstructingDirector { import_statements, imports, aliases, - circuits, functions, global_consts, ) @@ -531,36 +495,6 @@ impl ReconstructingDirector { self.reducer.reduce_import(new_identifer, new_import) } - pub fn reduce_circuit_member(&mut self, circuit_member: &CircuitMember) -> Result { - let new = match circuit_member { - CircuitMember::CircuitConst(identifier, type_, value) => CircuitMember::CircuitConst( - self.reduce_identifier(identifier)?, - self.reduce_type(type_, &identifier.span)?, - self.reduce_expression(value)?, - ), - CircuitMember::CircuitVariable(identifier, type_) => CircuitMember::CircuitVariable( - self.reduce_identifier(identifier)?, - self.reduce_type(type_, &identifier.span)?, - ), - CircuitMember::CircuitFunction(function) => { - CircuitMember::CircuitFunction(Box::new(self.reduce_function(function)?)) - } - }; - - self.reducer.reduce_circuit_member(circuit_member, new) - } - - pub fn reduce_circuit(&mut self, circuit: &Circuit) -> Result { - let circuit_name = self.reduce_identifier(&circuit.circuit_name)?; - - let mut members = vec![]; - for member in circuit.members.iter() { - members.push(self.reduce_circuit_member(member)?); - } - - self.reducer.reduce_circuit(circuit, circuit_name, members) - } - fn reduce_annotation(&mut self, annotation: &Annotation) -> Result { let name = self.reduce_identifier(&annotation.name)?; diff --git a/compiler/ast/src/reducer/reconstructing_reducer.rs b/compiler/ast/src/reducer/reconstructing_reducer.rs index 73ea29f35c..3fdeaa2912 100644 --- a/compiler/ast/src/reducer/reconstructing_reducer.rs +++ b/compiler/ast/src/reducer/reconstructing_reducer.rs @@ -221,28 +221,6 @@ pub trait ReconstructingReducer { }) } - fn reduce_circuit_variable_initializer( - &mut self, - _variable: &CircuitVariableInitializer, - identifier: Identifier, - expression: Option, - ) -> Result { - Ok(CircuitVariableInitializer { identifier, expression }) - } - - fn reduce_circuit_init( - &mut self, - circuit_init: &CircuitInitExpression, - name: Identifier, - members: Vec, - ) -> Result { - Ok(CircuitInitExpression { - name, - members, - span: circuit_init.span.clone(), - }) - } - fn reduce_call( &mut self, call: &CallExpression, @@ -390,7 +368,6 @@ pub trait ReconstructingReducer { import_statements: Vec, imports: IndexMap, Program>, aliases: IndexMap, - circuits: IndexMap, functions: IndexMap, global_consts: IndexMap, DefinitionStatement>, ) -> Result { @@ -400,7 +377,6 @@ pub trait ReconstructingReducer { import_statements, imports, aliases, - circuits, functions, global_consts, }) @@ -440,19 +416,6 @@ pub trait ReconstructingReducer { Ok((identifier, import)) } - fn reduce_circuit_member(&mut self, _circuit_member: &CircuitMember, new: CircuitMember) -> Result { - Ok(new) - } - - fn reduce_circuit( - &mut self, - _circuit: &Circuit, - circuit_name: Identifier, - members: Vec, - ) -> Result { - Ok(Circuit { circuit_name, members }) - } - fn reduce_annotation(&mut self, annotation: &Annotation, name: Identifier) -> Result { Ok(Annotation { span: annotation.span.clone(), diff --git a/compiler/compiler/src/lib.rs b/compiler/compiler/src/lib.rs index a391709356..c8c6de2e36 100644 --- a/compiler/compiler/src/lib.rs +++ b/compiler/compiler/src/lib.rs @@ -23,7 +23,6 @@ #![doc = include_str!("../README.md")] pub use leo_ast::Ast; -use leo_ast::AstPass; use leo_errors::emitter::Handler; use leo_errors::{CompilerError, Result}; use leo_span::symbol::create_session_if_not_set_then; @@ -76,7 +75,7 @@ impl<'a> Compiler<'a> { .map_err(|e| CompilerError::file_read_error(self.main_file_path.clone(), e))?; // Use the parser to construct the abstract syntax tree (ast). - let mut ast: leo_ast::Ast = leo_parser::parse_ast( + let ast: leo_ast::Ast = leo_parser::parse_ast( self.handler, self.main_file_path.to_str().unwrap_or_default(), program_string, @@ -85,9 +84,9 @@ impl<'a> Compiler<'a> { ast.to_json_file_without_keys(self.output_directory.clone(), "initial_ast.json", &["span"])?; // Canonicalize the AST. - ast = leo_ast_passes::Canonicalizer::do_pass(Default::default(), ast.into_repr())?; + // ast = leo_ast_passes::Canonicalizer::do_pass(Default::default(), ast.into_repr())?; // Write the AST snapshot post parsing - ast.to_json_file_without_keys(self.output_directory, "canonicalization_ast.json", &["span"])?; + // ast.to_json_file_without_keys(self.output_directory, "canonicalization_ast.json", &["span"])?; Ok(ast) } diff --git a/compiler/parser/src/parser/expression.rs b/compiler/parser/src/parser/expression.rs index db38bd54f2..b22c703f7d 100644 --- a/compiler/parser/src/parser/expression.rs +++ b/compiler/parser/src/parser/expression.rs @@ -380,22 +380,6 @@ impl ParserContext<'_> { }) } - /// Returns an [`Expression`] AST node if the next tokens represent a - /// circuit initialization expression. - pub fn parse_circuit_expression(&mut self, identifier: Identifier) -> Result { - let (members, _, span) = self.parse_list(Token::LeftCurly, Token::RightCurly, Token::Comma, |p| { - Ok(Some(CircuitVariableInitializer { - identifier: p.expect_ident()?, - expression: p.eat(Token::Colon).map(|_| p.parse_expression()).transpose()?, - })) - })?; - Ok(Expression::CircuitInit(CircuitInitExpression { - span: &identifier.span + &span, - name: identifier, - members, - })) - } - /// /// Returns an [`Expression`] AST node if the next tokens represent a /// tuple initialization expression or an affine group literal. @@ -547,22 +531,14 @@ impl ParserContext<'_> { Token::LeftSquare => self.parse_array_expression(&span)?, Token::Ident(name) => { let ident = Identifier { name, span }; - if !self.disallow_circuit_construction && self.peek_token().as_ref() == &Token::LeftCurly { - self.parse_circuit_expression(ident)? - } else { - Expression::Identifier(ident) - } + Expression::Identifier(ident) } Token::BigSelf => { let ident = Identifier { name: sym::SelfUpper, span, }; - if !self.disallow_circuit_construction && self.peek_token().as_ref() == &Token::LeftCurly { - self.parse_circuit_expression(ident)? - } else { - Expression::Identifier(ident) - } + Expression::Identifier(ident) } Token::LittleSelf => Expression::Identifier(Identifier { name: sym::SelfLower, diff --git a/compiler/parser/src/parser/file.rs b/compiler/parser/src/parser/file.rs index 51732e0370..4a4d2fd45d 100644 --- a/compiler/parser/src/parser/file.rs +++ b/compiler/parser/src/parser/file.rs @@ -27,10 +27,8 @@ impl ParserContext<'_> { pub fn parse_program(&mut self) -> Result { let mut import_statements = Vec::new(); let mut aliases = IndexMap::new(); - let mut circuits = IndexMap::new(); let mut functions = IndexMap::new(); let mut global_consts = IndexMap::new(); - // let mut tests = IndexMap::new(); while self.has_next() { let token = self.peek()?; @@ -38,19 +36,8 @@ impl ParserContext<'_> { Token::Import => { import_statements.push(self.parse_import_statement()?); } - Token::Circuit => { - self.expect(Token::Circuit)?; - let (id, circuit) = self.parse_circuit()?; - circuits.insert(id, circuit); - } Token::Ident(ident) => match *ident { sym::test => return Err(ParserError::test_function(&token.span).into()), - kw @ (sym::Struct | sym::Class) => { - self.emit_err(ParserError::unexpected(kw, "circuit", &token.span)); - self.bump().unwrap(); - let (id, circuit) = self.parse_circuit()?; - circuits.insert(id, circuit); - } _ => return Err(Self::unexpected_item(token).into()), }, // Const functions share the first token with the global Const. @@ -79,7 +66,6 @@ impl ParserContext<'_> { import_statements, imports: IndexMap::new(), aliases, - circuits, functions, global_consts, }) @@ -90,7 +76,6 @@ impl ParserContext<'_> { &token.token, [ Token::Import, - Token::Circuit, Token::Function, Token::Ident(sym::test), Token::At, @@ -213,146 +198,6 @@ impl ParserContext<'_> { }) } - /// Returns a [`CircuitMember`] AST node if the next tokens represent a circuit member variable - /// or circuit member function or circuit member constant. - pub fn parse_circuit_declaration(&mut self) -> Result> { - let mut members = Vec::new(); - - let (mut semi_colons, mut commas) = (false, false); - - while self.eat(Token::RightCurly).is_none() { - members.push(if self.peek_is_function()? { - // function - self.parse_member_function_declaration()? - } else if *self.peek_token() == Token::Static { - // static const - self.parse_const_member_variable_declaration()? - } else { - // variable - let variable = self.parse_member_variable_declaration()?; - - if let Some(semi) = self.eat(Token::Semicolon) { - if commas { - self.emit_err(ParserError::mixed_commas_and_semicolons(&semi.span)); - } - semi_colons = true; - } - - if let Some(comma) = self.eat(Token::Comma) { - if semi_colons { - self.emit_err(ParserError::mixed_commas_and_semicolons(&comma.span)); - } - commas = true; - } - - variable - }); - } - - self.ban_mixed_member_order(&members); - - Ok(members) - } - - /// Emits errors if order isn't `consts variables functions`. - fn ban_mixed_member_order(&self, members: &[CircuitMember]) { - let mut had_var = false; - let mut had_fun = false; - for member in members { - match member { - CircuitMember::CircuitConst(id, _, e) if had_var => { - self.emit_err(ParserError::member_const_after_var(&(id.span() + e.span()))); - } - CircuitMember::CircuitConst(id, _, e) if had_fun => { - self.emit_err(ParserError::member_const_after_fun(&(id.span() + e.span()))); - } - CircuitMember::CircuitVariable(id, _) if had_fun => { - self.emit_err(ParserError::member_var_after_fun(id.span())); - } - CircuitMember::CircuitConst(..) => {} - CircuitMember::CircuitVariable(..) => had_var = true, - CircuitMember::CircuitFunction(..) => had_fun = true, - } - } - } - - /// Parses `IDENT: TYPE`. - fn parse_typed_field_name(&mut self) -> Result<(Identifier, Type)> { - let name = self.expect_ident()?; - self.expect(Token::Colon)?; - let type_ = self.parse_type()?.0; - - Ok((name, type_)) - } - - /// Returns a [`CircuitMember`] AST node if the next tokens represent a circuit member static constant. - pub fn parse_const_member_variable_declaration(&mut self) -> Result { - self.expect(Token::Static)?; - self.expect(Token::Const)?; - - // `IDENT: TYPE = EXPR`: - let (name, type_) = self.parse_typed_field_name()?; - self.expect(Token::Assign)?; - let expr = self.parse_expression()?; - - self.expect(Token::Semicolon)?; - - Ok(CircuitMember::CircuitConst(name, type_, expr)) - } - - /// - /// Returns a [`CircuitMember`] AST node if the next tokens represent a circuit member variable. - /// - pub fn parse_member_variable_declaration(&mut self) -> Result { - let (name, type_) = self.parse_typed_field_name()?; - - Ok(CircuitMember::CircuitVariable(name, type_)) - } - - /// Returns a [`CircuitMember`] AST node if the next tokens represent a circuit member function. - pub fn parse_member_function_declaration(&mut self) -> Result { - let peeked = self.peek()?.clone(); - if self.peek_is_function()? { - let function = self.parse_function_declaration()?; - Ok(CircuitMember::CircuitFunction(Box::new(function.1))) - } else { - return Err(ParserError::unexpected( - &peeked.token, - [Token::Function, Token::At, Token::Const] - .iter() - .map(|x| format!("'{}'", x)) - .collect::>() - .join(", "), - &peeked.span, - ) - .into()); - } - } - - /// - /// Returns an [`(Identifier, Circuit)`] tuple of AST nodes if the next tokens represent a - /// circuit name and definition statement. - /// - pub fn parse_circuit(&mut self) -> Result<(Identifier, Circuit)> { - let name = if let Some(ident) = self.eat_identifier() { - ident - } else { - let next = self.peek()?; - return Err(ParserError::unexpected_str(&next.token, "ident", &next.span).into()); - }; - - self.expect(Token::LeftCurly)?; - let members = self.parse_circuit_declaration()?; - - Ok(( - name.clone(), - Circuit { - circuit_name: name, - members, - }, - )) - } - /// /// Returns a [`FunctionInput`] AST node if the next tokens represent a function parameter. /// diff --git a/compiler/parser/src/tokenizer/lexer.rs b/compiler/parser/src/tokenizer/lexer.rs index 35656915b0..a59e6cd33f 100644 --- a/compiler/parser/src/tokenizer/lexer.rs +++ b/compiler/parser/src/tokenizer/lexer.rs @@ -416,7 +416,6 @@ impl Token { "as" => Token::As, "bool" => Token::Bool, "char" => Token::Char, - "circuit" => Token::Circuit, "console" => Token::Console, "const" => Token::Const, "else" => Token::Else, diff --git a/compiler/parser/src/tokenizer/token.rs b/compiler/parser/src/tokenizer/token.rs index 167fd04dff..3add1f3d06 100644 --- a/compiler/parser/src/tokenizer/token.rs +++ b/compiler/parser/src/tokenizer/token.rs @@ -127,7 +127,6 @@ pub enum Token { // Regular Keywords As, - Circuit, Console, /// Const variable and a const function. Const, @@ -155,7 +154,6 @@ pub const KEYWORD_TOKENS: &[Token] = &[ Token::As, Token::Bool, Token::Char, - Token::Circuit, Token::Console, Token::Const, Token::Else, @@ -203,7 +201,6 @@ impl Token { Token::At => sym::At, Token::Bool => sym::bool, Token::Char => sym::char, - Token::Circuit => sym::circuit, Token::Console => sym::console, Token::Const => sym::Const, Token::Else => sym::Else, @@ -323,7 +320,6 @@ impl fmt::Display for Token { Import => write!(f, "import"), As => write!(f, "as"), - Circuit => write!(f, "circuit"), Console => write!(f, "console"), Const => write!(f, "const"), Else => write!(f, "else"), diff --git a/tests/expectations/parser/parser/expression/circuit_init_fail.leo.out b/tests/expectations/parser/parser/expression/circuit_init_fail.leo.out index 9a08737239..4d5ba89431 100644 --- a/tests/expectations/parser/parser/expression/circuit_init_fail.leo.out +++ b/tests/expectations/parser/parser/expression/circuit_init_fail.leo.out @@ -2,15 +2,15 @@ namespace: ParseExpression expectation: Fail outputs: - - "Error [EPAR0370003]: unexpected EOF\n --> test:1:3\n |\n 1 | x {\n | ^" + - "did not consume all input: '{' @ 1:3-4\n" - "did not consume all input: '}' @ 1:3-4\n" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x {,}\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:5\n |\n 1 | x { , }\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x {,,,}\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:6\n |\n 1 | x {x,,}\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x {,,x}\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x {,x}\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:8\n |\n 1 | x {x:y,,}\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x {,,x:y}\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x {,x:y}\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '}'\n --> test:1:6\n |\n 1 | x {x:}\n | ^" + - "did not consume all input: '{' @ 1:3-4\n',' @ 1:4-5\n'}' @ 1:5-6\n" + - "did not consume all input: '{' @ 1:3-4\n',' @ 1:5-6\n'}' @ 1:7-8\n" + - "did not consume all input: '{' @ 1:3-4\n',' @ 1:4-5\n',' @ 1:5-6\n',' @ 1:6-7\n'}' @ 1:7-8\n" + - "did not consume all input: '{' @ 1:3-4\n'x' @ 1:4-5\n',' @ 1:5-6\n',' @ 1:6-7\n'}' @ 1:7-8\n" + - "did not consume all input: '{' @ 1:3-4\n',' @ 1:4-5\n',' @ 1:5-6\n'x' @ 1:6-7\n'}' @ 1:7-8\n" + - "did not consume all input: '{' @ 1:3-4\n',' @ 1:4-5\n'x' @ 1:5-6\n'}' @ 1:6-7\n" + - "did not consume all input: '{' @ 1:3-4\n'x' @ 1:4-5\n':' @ 1:5-6\n'y' @ 1:6-7\n',' @ 1:7-8\n',' @ 1:8-9\n'}' @ 1:9-10\n" + - "did not consume all input: '{' @ 1:3-4\n',' @ 1:4-5\n',' @ 1:5-6\n'x' @ 1:6-7\n':' @ 1:7-8\n'y' @ 1:8-9\n'}' @ 1:9-10\n" + - "did not consume all input: '{' @ 1:3-4\n',' @ 1:4-5\n'x' @ 1:5-6\n':' @ 1:6-7\n'y' @ 1:7-8\n'}' @ 1:8-9\n" + - "did not consume all input: '{' @ 1:3-4\n'x' @ 1:4-5\n':' @ 1:5-6\n'}' @ 1:6-7\n" diff --git a/tests/expectations/parser/parser/expression/literal/comment.leo.out b/tests/expectations/parser/parser/expression/literal/comment.leo.out index 0b21f6a280..86199de708 100644 --- a/tests/expectations/parser/parser/expression/literal/comment.leo.out +++ b/tests/expectations/parser/parser/expression/literal/comment.leo.out @@ -7,6 +7,5 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/expression/token_format.leo.out b/tests/expectations/parser/parser/expression/token_format.leo.out index abe50e978e..51c047f2d5 100644 --- a/tests/expectations/parser/parser/expression/token_format.leo.out +++ b/tests/expectations/parser/parser/expression/token_format.leo.out @@ -66,7 +66,6 @@ outputs: - "Error [EPAR0370030]: Could not lex the following content: `~`." - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'import'\n --> test:1:1\n |\n 1 | import\n | ^^^^^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'as'\n --> test:1:1\n |\n 1 | as\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'circuit'\n --> test:1:1\n |\n 1 | circuit\n | ^^^^^^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'console'\n --> test:1:1\n |\n 1 | console\n | ^^^^^^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'const'\n --> test:1:1\n |\n 1 | const\n | ^^^^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'else'\n --> test:1:1\n |\n 1 | else\n | ^^^^" diff --git a/tests/expectations/parser/parser/functions/annotated.leo.out b/tests/expectations/parser/parser/functions/annotated.leo.out index d9e264e6cf..7680179979 100644 --- a/tests/expectations/parser/parser/functions/annotated.leo.out +++ b/tests/expectations/parser/parser/functions/annotated.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function a() {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/annotated_param.leo.out b/tests/expectations/parser/parser/functions/annotated_param.leo.out index 5e5e8b0796..f5201f6956 100644 --- a/tests/expectations/parser/parser/functions/annotated_param.leo.out +++ b/tests/expectations/parser/parser/functions/annotated_param.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/annotated_twice.leo.out b/tests/expectations/parser/parser/functions/annotated_twice.leo.out index 7afe638d67..2ab2a1eff1 100644 --- a/tests/expectations/parser/parser/functions/annotated_twice.leo.out +++ b/tests/expectations/parser/parser/functions/annotated_twice.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/bounded_recursion.leo.out b/tests/expectations/parser/parser/functions/bounded_recursion.leo.out index 53e1ab419b..29e37d5e8b 100644 --- a/tests/expectations/parser/parser/functions/bounded_recursion.leo.out +++ b/tests/expectations/parser/parser/functions/bounded_recursion.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const y: u32) {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/const_function.leo.out b/tests/expectations/parser/parser/functions/const_function.leo.out index 142f12dfb9..a29203f1ff 100644 --- a/tests/expectations/parser/parser/functions/const_function.leo.out +++ b/tests/expectations/parser/parser/functions/const_function.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const function x() {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/const_param.leo.out b/tests/expectations/parser/parser/functions/const_param.leo.out index f1302d128d..06bde16c15 100644 --- a/tests/expectations/parser/parser/functions/const_param.leo.out +++ b/tests/expectations/parser/parser/functions/const_param.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/const_self_bad.leo.out b/tests/expectations/parser/parser/functions/const_self_bad.leo.out index 3b02d74ff3..bbf0acc44a 100644 --- a/tests/expectations/parser/parser/functions/const_self_bad.leo.out +++ b/tests/expectations/parser/parser/functions/const_self_bad.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const self) {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/empty.leo.out b/tests/expectations/parser/parser/functions/empty.leo.out index 4bd3bfbc1a..b1377721e3 100644 --- a/tests/expectations/parser/parser/functions/empty.leo.out +++ b/tests/expectations/parser/parser/functions/empty.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/empty2.leo.out b/tests/expectations/parser/parser/functions/empty2.leo.out index 60c3f10b1c..21fff75dc8 100644 --- a/tests/expectations/parser/parser/functions/empty2.leo.out +++ b/tests/expectations/parser/parser/functions/empty2.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {}\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/ident_token_fail.leo.out b/tests/expectations/parser/parser/functions/ident_token_fail.leo.out index 7cbea7ef17..852785e684 100644 --- a/tests/expectations/parser/parser/functions/ident_token_fail.leo.out +++ b/tests/expectations/parser/parser/functions/ident_token_fail.leo.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370005]: expected 'import', 'circuit', 'function', 'test', '@' -- got '1'\n --> test:3:1\n |\n 3 | 1 main() {}\n | ^" + - "Error [EPAR0370005]: expected 'import', 'function', 'test', '@' -- got '1'\n --> test:3:1\n |\n 3 | 1 main() {}\n | ^" diff --git a/tests/expectations/parser/parser/functions/infinite_recursion.leo.out b/tests/expectations/parser/parser/functions/infinite_recursion.leo.out index 93a823f907..06c062dbdf 100644 --- a/tests/expectations/parser/parser/functions/infinite_recursion.leo.out +++ b/tests/expectations/parser/parser/functions/infinite_recursion.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"inf\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function inf() {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/param_array.leo.out b/tests/expectations/parser/parser/functions/param_array.leo.out index b648d79414..6681aa1ab2 100644 --- a/tests/expectations/parser/parser/functions/param_array.leo.out +++ b/tests/expectations/parser/parser/functions/param_array.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: [u8; 12]) {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/param_circuit.leo.out b/tests/expectations/parser/parser/functions/param_circuit.leo.out index 2d18f67ce0..22f1bc1f29 100644 --- a/tests/expectations/parser/parser/functions/param_circuit.leo.out +++ b/tests/expectations/parser/parser/functions/param_circuit.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/param_tuple.leo.out b/tests/expectations/parser/parser/functions/param_tuple.leo.out index 17e104a53a..93311a128b 100644 --- a/tests/expectations/parser/parser/functions/param_tuple.leo.out +++ b/tests/expectations/parser/parser/functions/param_tuple.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: (u32, i32)) {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/params.leo.out b/tests/expectations/parser/parser/functions/params.leo.out index 26c4fe8b37..3eb05d0eac 100644 --- a/tests/expectations/parser/parser/functions/params.leo.out +++ b/tests/expectations/parser/parser/functions/params.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/params_return.leo.out b/tests/expectations/parser/parser/functions/params_return.leo.out index 681070bf9c..42aa28f386 100644 --- a/tests/expectations/parser/parser/functions/params_return.leo.out +++ b/tests/expectations/parser/parser/functions/params_return.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/return.leo.out b/tests/expectations/parser/parser/functions/return.leo.out index abaabd9585..3e0dff001d 100644 --- a/tests/expectations/parser/parser/functions/return.leo.out +++ b/tests/expectations/parser/parser/functions/return.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> u32 {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/return_tuple.leo.out b/tests/expectations/parser/parser/functions/return_tuple.leo.out index 0fa5721ff3..56a407e818 100644 --- a/tests/expectations/parser/parser/functions/return_tuple.leo.out +++ b/tests/expectations/parser/parser/functions/return_tuple.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> (u32, u32) {\\\"}\"}": diff --git a/tests/expectations/parser/parser/serialize/one_plus_one.leo.out b/tests/expectations/parser/parser/serialize/one_plus_one.leo.out index e417be3b50..8934f00294 100644 --- a/tests/expectations/parser/parser/serialize/one_plus_one.leo.out +++ b/tests/expectations/parser/parser/serialize/one_plus_one.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() -> u8 {\\\"}\"}": diff --git a/tests/expectations/parser/parser/serialize/palindrome.leo.out b/tests/expectations/parser/parser/serialize/palindrome.leo.out index 6ecc69d502..596c4a853d 100644 --- a/tests/expectations/parser/parser/serialize/palindrome.leo.out +++ b/tests/expectations/parser/parser/serialize/palindrome.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(str: [char; 20]) -> bool {\\\"}\"}": diff --git a/tests/expectations/parser/parser/serialize/parser_error.leo.out b/tests/expectations/parser/parser/serialize/parser_error.leo.out index 716c636e1b..b36aa774bc 100644 --- a/tests/expectations/parser/parser/serialize/parser_error.leo.out +++ b/tests/expectations/parser/parser/serialize/parser_error.leo.out @@ -2,4 +2,4 @@ namespace: Serialize expectation: Fail outputs: - - "Error [EPAR0370005]: expected 'import', 'circuit', 'function', 'test', '@' -- got 'invalid'\n --> test:3:1\n |\n 3 | invalid\n | ^^^^^^^" + - "Error [EPAR0370005]: expected 'import', 'function', 'test', '@' -- got 'invalid'\n --> test:3:1\n |\n 3 | invalid\n | ^^^^^^^" diff --git a/tests/expectations/parser/parser/statement/alias.leo.out b/tests/expectations/parser/parser/statement/alias.leo.out index 5ebe4c024e..a00927c45b 100644 --- a/tests/expectations/parser/parser/statement/alias.leo.out +++ b/tests/expectations/parser/parser/statement/alias.leo.out @@ -53,6 +53,5 @@ outputs: Array: - IntegerType: U8 - - value: "5" - circuits: {} global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/statement/assign_fail.leo.out b/tests/expectations/parser/parser/statement/assign_fail.leo.out index 9f5508847a..2378aa7e90 100644 --- a/tests/expectations/parser/parser/statement/assign_fail.leo.out +++ b/tests/expectations/parser/parser/statement/assign_fail.leo.out @@ -12,7 +12,7 @@ outputs: - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | [x, x, x] = y;\n | ^^^^^^^^^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | [x; 3] = y;\n | ^^^^^^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | (x, x, x) = y;\n | ^^^^^^^^^" - - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x {x: y, y: z} = y;\n | ^^^^^^^^^^^^^^" + - "Error [EPAR0370005]: expected ; -- got '{'\n --> test:1:3\n |\n 1 | x {x: y, y: z} = y;\n | ^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x() = y;\n | ^^^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x.y() = y;\n | ^^^^^" - "Error [EPAR0370030]: Could not lex the following content: `🦀 = y;`." diff --git a/tests/expectations/parser/parser/statement/global_const.leo.out b/tests/expectations/parser/parser/statement/global_const.leo.out index 23cf4aa605..a1a58cb282 100644 --- a/tests/expectations/parser/parser/statement/global_const.leo.out +++ b/tests/expectations/parser/parser/statement/global_const.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: x: declaration_type: Const diff --git a/tests/expectations/parser/parser/unreachable/eat_ident.leo.out b/tests/expectations/parser/parser/unreachable/eat_ident.leo.out index cb16998106..f82e145f71 100644 --- a/tests/expectations/parser/parser/unreachable/eat_ident.leo.out +++ b/tests/expectations/parser/parser/unreachable/eat_ident.leo.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ';'\n --> test:3:9\n |\n 3 | circuit ;\n | ^" + - "Error [EPAR0370005]: expected 'import', 'function', 'test', '@' -- got 'circuit'\n --> test:3:1\n |\n 3 | circuit ;\n | ^^^^^^^" diff --git a/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out b/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out index d3eb1fba62..1008530bed 100644 --- a/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out +++ b/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out @@ -7,7 +7,7 @@ outputs: - "Error [EPAR0370005]: expected ; -- got ','\n --> test:1:11\n |\n 1 | let x = a , b;\n | ^" - "Error [EPAR0370005]: expected ] -- got ';'\n --> test:1:14\n |\n 1 | let x = a [ b;\n | ^" - "Error [EPAR0370005]: expected ; -- got ']'\n --> test:1:11\n |\n 1 | let x = a ] b;\n | ^" - - "Error [EPAR0370005]: expected } -- got ';'\n --> test:1:14\n |\n 1 | let x = a { b;\n | ^" + - "Error [EPAR0370005]: expected ; -- got '{'\n --> test:1:11\n |\n 1 | let x = a { b;\n | ^" - "Error [EPAR0370005]: expected ; -- got '}'\n --> test:1:11\n |\n 1 | let x = a } b;\n | ^" - "Error [EPAR0370005]: expected ) -- got ';'\n --> test:1:14\n |\n 1 | let x = a ( b;\n | ^" - "Error [EPAR0370005]: expected ; -- got ')'\n --> test:1:11\n |\n 1 | let x = a ) b;\n | ^" @@ -45,7 +45,7 @@ outputs: - "Error [EPAR0370005]: expected ; -- got ','\n --> test:1:2\n |\n 1 | x,=b; // 43\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:3\n |\n 1 | x[=b;\n | ^" - "Error [EPAR0370005]: expected ; -- got ']'\n --> test:1:2\n |\n 1 | x]=b;\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '='\n --> test:1:3\n |\n 1 | x{=b;\n | ^" + - "Error [EPAR0370005]: expected ; -- got '{'\n --> test:1:2\n |\n 1 | x{=b;\n | ^" - "Error [EPAR0370005]: expected ; -- got '}'\n --> test:1:2\n |\n 1 | x}=b;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ';'\n --> test:1:4\n |\n 1 | x=(;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ')'\n --> test:1:3\n |\n 1 | x=);\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/postfix_fail.leo.out b/tests/expectations/parser/parser/unreachable/postfix_fail.leo.out index c65db37a9a..e5c6b15e5a 100644 --- a/tests/expectations/parser/parser/unreachable/postfix_fail.leo.out +++ b/tests/expectations/parser/parser/unreachable/postfix_fail.leo.out @@ -7,7 +7,7 @@ outputs: - "Error [EPAR0370005]: expected ; -- got ','\n --> test:1:10\n |\n 1 | let x = a,;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ';'\n --> test:1:11\n |\n 1 | let x = a[;\n | ^" - "Error [EPAR0370005]: expected ; -- got ']'\n --> test:1:10\n |\n 1 | let x = a];\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ';'\n --> test:1:11\n |\n 1 | let x = a{;\n | ^" + - "Error [EPAR0370005]: expected ; -- got '{'\n --> test:1:10\n |\n 1 | let x = a{;\n | ^" - "Error [EPAR0370005]: expected ; -- got '}'\n --> test:1:10\n |\n 1 | let x = a};\n | ^" - "Error [EPAR0370005]: expected ; -- got ')'\n --> test:1:10\n |\n 1 | let x = a);\n | ^" - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:10\n |\n 1 | let x = a:;\n | ^" diff --git a/tests/parser/circuits/big_self.leo b/tests/parser/circuits/big_self.leo deleted file mode 100644 index e6c5d08fbd..0000000000 --- a/tests/parser/circuits/big_self.leo +++ /dev/null @@ -1,10 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit X { - function x() -> Self { - return Self {}; - } -} \ No newline at end of file diff --git a/tests/parser/circuits/const_functions.leo b/tests/parser/circuits/const_functions.leo deleted file mode 100644 index 21fb9d5e12..0000000000 --- a/tests/parser/circuits/const_functions.leo +++ /dev/null @@ -1,23 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit X { - x: u32 - const function x() { - return (); - } - const function x(self) { - return (); - } - const function c(const self) { - return (); - } - const function b(const self, x: u32) { - return (); - } - const function b(const self, const x: u32) { - return (); - } -} diff --git a/tests/parser/circuits/consts.leo b/tests/parser/circuits/consts.leo deleted file mode 100644 index 0126f3e23c..0000000000 --- a/tests/parser/circuits/consts.leo +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit X { - static const x: u32 = 2; - static const y: u32 = 5; - static const G: u8 = G; - static const FOO: Foo = Foo {}; - static const INDEXED: Foo = A[0]; - static const TINDEXED: Foo = T.0; - static const TWO: i8 = 1i8 + 1i8; - static const mult: i8 = x * y; - static const mult: i8 = one(); -} \ No newline at end of file diff --git a/tests/parser/circuits/empty.leo b/tests/parser/circuits/empty.leo deleted file mode 100644 index c4fc98fc3e..0000000000 --- a/tests/parser/circuits/empty.leo +++ /dev/null @@ -1,8 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit X { - -} \ No newline at end of file diff --git a/tests/parser/circuits/field_and_functions.leo b/tests/parser/circuits/field_and_functions.leo deleted file mode 100644 index 99ce46e134..0000000000 --- a/tests/parser/circuits/field_and_functions.leo +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit X { - static const a: u8 = 10; - x: u32, - y: u32 - function x() { - return (); - } - function y() { - return (); - } -} \ No newline at end of file diff --git a/tests/parser/circuits/fields.leo b/tests/parser/circuits/fields.leo deleted file mode 100644 index 1369166472..0000000000 --- a/tests/parser/circuits/fields.leo +++ /dev/null @@ -1,9 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit X { - x: u32; - y: u32; -} \ No newline at end of file diff --git a/tests/parser/circuits/fields_fail.leo b/tests/parser/circuits/fields_fail.leo deleted file mode 100644 index 6ebc22b0b1..0000000000 --- a/tests/parser/circuits/fields_fail.leo +++ /dev/null @@ -1,15 +0,0 @@ -/* -namespace: Parse -expectation: Fail -*/ - -circuit X { - x: u32 - y: u32 -} - -circuit X { - x: u32, - y: u32; - , // recovery witness -} diff --git a/tests/parser/circuits/functions.leo b/tests/parser/circuits/functions.leo deleted file mode 100644 index 511bb48aa0..0000000000 --- a/tests/parser/circuits/functions.leo +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit X { - function x() { - return (); - } - function y() { - return (); - } - const function z() { - return (); - } -} diff --git a/tests/parser/circuits/mixed_order_fail.leo b/tests/parser/circuits/mixed_order_fail.leo deleted file mode 100644 index 7267cf0465..0000000000 --- a/tests/parser/circuits/mixed_order_fail.leo +++ /dev/null @@ -1,19 +0,0 @@ -/* -namespace: Parse -expectation: Fail -*/ - -circuit A { - function a() {} - const function z() {} - - foo: u8, - - static const BAR: u8 = 0u8; -} - -circuit B { - foo: u8, - - static const BAR: u8 = 0u8; -} diff --git a/tests/parser/circuits/mut_self_fail.leo b/tests/parser/circuits/mut_self_fail.leo deleted file mode 100644 index dff6af2db1..0000000000 --- a/tests/parser/circuits/mut_self_fail.leo +++ /dev/null @@ -1,10 +0,0 @@ -/* -namespace: Parse -expectation: Fail -*/ - -circuit X { - function x(mut self) { - return (); - } -} \ No newline at end of file diff --git a/tests/parser/circuits/ref_self.leo b/tests/parser/circuits/ref_self.leo deleted file mode 100644 index 8e5c19f820..0000000000 --- a/tests/parser/circuits/ref_self.leo +++ /dev/null @@ -1,10 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit X { - function x(&self) { - return (); - } -} \ No newline at end of file diff --git a/tests/parser/circuits/self.leo b/tests/parser/circuits/self.leo deleted file mode 100644 index c99c4bea1c..0000000000 --- a/tests/parser/circuits/self.leo +++ /dev/null @@ -1,10 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit X { - function x(self) { - return (); - } -} \ No newline at end of file diff --git a/tests/parser/circuits/self_not_first_fail.leo b/tests/parser/circuits/self_not_first_fail.leo deleted file mode 100644 index 51ea2fc20e..0000000000 --- a/tests/parser/circuits/self_not_first_fail.leo +++ /dev/null @@ -1,10 +0,0 @@ -/* -namespace: Parse -expectation: Fail -*/ - -circuit X { - function x(foo: u32, &self) { - return (); - } -} \ No newline at end of file diff --git a/tests/parser/circuits/struct_fail.leo b/tests/parser/circuits/struct_fail.leo deleted file mode 100644 index 582b508aab..0000000000 --- a/tests/parser/circuits/struct_fail.leo +++ /dev/null @@ -1,9 +0,0 @@ -/* -namespace: Parse -expectation: Fail -*/ - -struct A {} -circuit B {} -class C {} -circuit D {} diff --git a/tests/parser/circuits/token_circuit_name.leo b/tests/parser/circuits/token_circuit_name.leo deleted file mode 100644 index f0f997c474..0000000000 --- a/tests/parser/circuits/token_circuit_name.leo +++ /dev/null @@ -1,6 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit u32 {} \ No newline at end of file diff --git a/tests/parser/circuits/types_fail.leo b/tests/parser/circuits/types_fail.leo deleted file mode 100644 index 0e3151a6a5..0000000000 --- a/tests/parser/circuits/types_fail.leo +++ /dev/null @@ -1,17 +0,0 @@ -/* -namespace: Parse -expectation: Fail -*/ - -circuit address {} -circuit bool {} -circuit char {} -circuit group {} -circuit i8 {} -circuit i16 {} -circuit i32 {} -circuit i64 {} -circuit u8 {} -circuit u16 {} -circuit u32 {} -circuit u64 {} \ No newline at end of file diff --git a/tests/parser/expression/circuit_init.leo b/tests/parser/expression/circuit_init.leo deleted file mode 100644 index a6817977c2..0000000000 --- a/tests/parser/expression/circuit_init.leo +++ /dev/null @@ -1,22 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -x {} - -x {y} - -x{y} - -x{} - -x{y: y} - -x{y: x} - -x{y: x,} - -x{y:x, x:y,} - -Self {} diff --git a/tests/parser/expression/token_format.leo b/tests/parser/expression/token_format.leo index a3cd81218e..191641644c 100644 --- a/tests/parser/expression/token_format.leo +++ b/tests/parser/expression/token_format.leo @@ -131,8 +131,6 @@ import as -circuit - console const diff --git a/tests/parser/serialize/linear_regression.leo b/tests/parser/serialize/linear_regression.leo deleted file mode 100644 index b64dd2cbac..0000000000 --- a/tests/parser/serialize/linear_regression.leo +++ /dev/null @@ -1,70 +0,0 @@ -/* -namespace: Serialize -expectation: Pass -*/ - -circuit Point { - x: i32, - y: i32, - - function new(x: i32, y: i32) -> Self { - return Self { x, y }; - } -} - -circuit LinearRegression { - points: [Point; 5], - - // Instantiates a linear regression circuit. - function new(points: [Point; 5]) -> Self { - return Self { points }; - } - - // Return the slope of the linear regression. - function slope(self) -> i32 { - - let num_points = 5i32; - // Calculate the sums. - let x_sum = 0i32; - let y_sum = 0i32; - let xy_sum = 0i32; - let x2_sum = 0i32; - for i in 0..5 { - x_sum += self.points[i].x; - y_sum += self.points[i].y; - xy_sum += self.points[i].x * self.points[i].y; - x2_sum += self.points[i].x * self.points[i].x; - } - let numerator = (num_points * xy_sum) - (x_sum * y_sum); - let denominator = (num_points * x2_sum) - (x_sum * x_sum); - let slope = numerator / denominator; - return slope; - } - // Return the offset of the linear regression. - function offset(self, slope: i32) -> i32 { - let num_points = 5i32; - // Calculate the sum. - let x_sum = 0i32; - let y_sum = 0i32; - for i in 0..5 { - x_sum += self.points[i].x; - y_sum += self.points[i].y; - } - return (y_sum - slope * x_sum) / num_points; - } -} - - -function main (x: i32, y: i32) -> [i32; 2] { - let points: [Point; 5] = [ - Point{x: x + 1, y: y + 1}, - Point{x: x + 2, y: y + 2}, - Point{x: x + 3, y: y + 3}, - Point{x: x + 4, y: y + 4}, - Point{x: x + 5, y: y + 5} - ]; - let reg = LinearRegression::new(points); - let slope = reg.slope(); - let offset = reg.offset(slope); - return [slope, offset]; -} diff --git a/tests/parser/serialize/pedersen_hash.leo b/tests/parser/serialize/pedersen_hash.leo deleted file mode 100644 index b8520a9be4..0000000000 --- a/tests/parser/serialize/pedersen_hash.leo +++ /dev/null @@ -1,30 +0,0 @@ -/* -namespace: Serialize -expectation: Pass -*/ - -circuit PedersenHash { - parameters: [group; 256]; - - // Instantiates a Pedersen hash circuit - function new(parameters: [group; 256]) -> Self { - return Self { parameters: parameters }; - } - - function hash(self, bits: [bool; 256]) -> group { - let digest: group = 0group; - for i in 0..256 { - if bits[i] { - digest += self.parameters[i]; - } - } - return digest; - } -} - -// The 'pedersen-hash' main function. -function main(hash_input: [bool; 256], const parameters: [group; 256]) -> group { - const pedersen = PedersenHash::new(parameters); - return pedersen.hash(hash_input); -} - From 414e2887353ec7c625c9bb28fd0de08e6c5170fe Mon Sep 17 00:00:00 2001 From: gluax <16431709+gluax@users.noreply.github.com> Date: Mon, 28 Mar 2022 06:47:19 -0700 Subject: [PATCH 03/10] remove self and Self --- compiler/ast/src/common/const_self_keyword.rs | 46 ------------- compiler/ast/src/common/mod.rs | 9 --- compiler/ast/src/common/mut_self_keyword.rs | 45 ------------ compiler/ast/src/common/self_keyword.rs | 46 ------------- compiler/ast/src/functions/function.rs | 23 ------- .../ast/src/functions/input/input_variable.rs | 68 ++----------------- .../src/reducer/reconstructing_director.rs | 1 - compiler/ast/src/types/type_.rs | 12 ---- compiler/compiler/src/lib.rs | 2 +- compiler/parser/src/parser/expression.rs | 11 --- compiler/parser/src/parser/file.rs | 65 +++--------------- compiler/parser/src/parser/mod.rs | 2 +- compiler/parser/src/parser/type_.rs | 4 +- compiler/parser/src/tokenizer/lexer.rs | 2 - compiler/parser/src/tokenizer/token.rs | 8 --- leo/span/src/symbol.rs | 3 - 16 files changed, 16 insertions(+), 331 deletions(-) delete mode 100644 compiler/ast/src/common/const_self_keyword.rs delete mode 100644 compiler/ast/src/common/mut_self_keyword.rs delete mode 100644 compiler/ast/src/common/self_keyword.rs diff --git a/compiler/ast/src/common/const_self_keyword.rs b/compiler/ast/src/common/const_self_keyword.rs deleted file mode 100644 index 1adbfbcdc7..0000000000 --- a/compiler/ast/src/common/const_self_keyword.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{Identifier, Node}; -use leo_span::Span; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -/// The `self` keyword can view circuit values inside of a circuit function. -/// Circuit values cannot be modified. To modify values use the `mut self` [MutSelfKeyword]. -#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)] -#[serde(transparent)] -pub struct ConstSelfKeyword { - /// Always `const self`. - pub identifier: Identifier, -} - -impl fmt::Display for ConstSelfKeyword { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "const self") - } -} - -impl Node for ConstSelfKeyword { - fn span(&self) -> &Span { - &self.identifier.span - } - - fn set_span(&mut self, span: Span) { - self.identifier.span = span; - } -} diff --git a/compiler/ast/src/common/mod.rs b/compiler/ast/src/common/mod.rs index 48ff68ede8..a0fba04975 100644 --- a/compiler/ast/src/common/mod.rs +++ b/compiler/ast/src/common/mod.rs @@ -17,9 +17,6 @@ pub mod array_dimensions; pub use array_dimensions::*; -pub mod const_self_keyword; -pub use const_self_keyword::*; - pub mod global_consts_json; pub mod identifier; @@ -28,15 +25,9 @@ pub use identifier::*; pub mod imported_modules; pub use imported_modules::*; -pub mod mut_self_keyword; -pub use mut_self_keyword::*; - pub mod positive_number; pub use positive_number::*; -pub mod self_keyword; -pub use self_keyword::*; - pub mod spread_or_expression; pub use spread_or_expression::*; diff --git a/compiler/ast/src/common/mut_self_keyword.rs b/compiler/ast/src/common/mut_self_keyword.rs deleted file mode 100644 index 633482d89f..0000000000 --- a/compiler/ast/src/common/mut_self_keyword.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{Identifier, Node}; -use leo_span::Span; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -/// The `&self` keyword can view and modify circuit values inside of a circuit function. -#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)] -#[serde(transparent)] -pub struct RefSelfKeyword { - /// Always `&self`. - pub identifier: Identifier, -} - -impl fmt::Display for RefSelfKeyword { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "&self") - } -} - -impl Node for RefSelfKeyword { - fn span(&self) -> &Span { - &self.identifier.span - } - - fn set_span(&mut self, span: Span) { - self.identifier.span = span; - } -} diff --git a/compiler/ast/src/common/self_keyword.rs b/compiler/ast/src/common/self_keyword.rs deleted file mode 100644 index 17a41e45c6..0000000000 --- a/compiler/ast/src/common/self_keyword.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{Identifier, Node}; -use leo_span::Span; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -/// The `self` keyword can view circuit values inside of a circuit function. -/// Circuit values cannot be modified. To modify values use the `mut self` [MutSelfKeyword]. -#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)] -#[serde(transparent)] -pub struct SelfKeyword { - /// Always just `self`. - pub identifier: Identifier, -} - -impl fmt::Display for SelfKeyword { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "self") - } -} - -impl Node for SelfKeyword { - fn span(&self) -> &Span { - &self.identifier.span - } - - fn set_span(&mut self, span: Span) { - self.identifier.span = span; - } -} diff --git a/compiler/ast/src/functions/function.rs b/compiler/ast/src/functions/function.rs index 11b5686367..0e943376a3 100644 --- a/compiler/ast/src/functions/function.rs +++ b/compiler/ast/src/functions/function.rs @@ -63,29 +63,6 @@ impl Function { self.name() == sym::main } - /// - /// Returns `true` if the function has input `self` or `mut self`. - /// Returns `false` otherwise. - /// - pub fn contains_self(&self) -> bool { - self.input.iter().any(|param| param.is_self()) - } - - /// - /// Returns `true` if the function has input `mut self`. - /// Returns `false` otherwise. - /// - pub fn contains_mut_self(&self) -> bool { - self.input.iter().any(|param| param.is_mut_self()) - } - - /// - /// Returns an iterator of [&FunctionInput] removing `self` and `mut self` inputs. - /// - pub fn filter_self_inputs(&self) -> impl Iterator { - self.input.iter().filter(|input| !input.is_self()) - } - /// /// Private formatting method used for optimizing [fmt::Debug] and [fmt::Display] implementations. /// diff --git a/compiler/ast/src/functions/input/input_variable.rs b/compiler/ast/src/functions/input/input_variable.rs index 0d92c41240..9317cb7b23 100644 --- a/compiler/ast/src/functions/input/input_variable.rs +++ b/compiler/ast/src/functions/input/input_variable.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ConstSelfKeyword, FunctionInputVariable, Node, RefSelfKeyword, SelfKeyword}; +use crate::{FunctionInputVariable, Node}; use leo_span::Span; use serde::{Deserialize, Serialize}; @@ -23,74 +23,24 @@ use std::fmt; /// Enumerates the possible inputs to a function. #[derive(Clone, Serialize, Deserialize)] pub enum FunctionInput { - /// A `self` parameter. - SelfKeyword(SelfKeyword), - /// A `const self` parameter. - ConstSelfKeyword(ConstSelfKeyword), - /// A `&self` parameter. - RefSelfKeyword(RefSelfKeyword), /// A normal function parameter. Variable(FunctionInputVariable), } impl FunctionInput { - /// - /// Returns `true` if the function input is the `self` or `mut self` keyword. - /// Returns `false` otherwise. - /// - pub fn is_self(&self) -> bool { - match self { - FunctionInput::SelfKeyword(_) => true, - FunctionInput::ConstSelfKeyword(_) => true, - FunctionInput::RefSelfKeyword(_) => true, - FunctionInput::Variable(_) => false, - } - } - - /// - /// Returns `true` if the function input is the `const self` keyword. - /// Returns `false` otherwise. - /// - pub fn is_const_self(&self) -> bool { - match self { - FunctionInput::SelfKeyword(_) => false, - FunctionInput::ConstSelfKeyword(_) => true, - FunctionInput::RefSelfKeyword(_) => false, - FunctionInput::Variable(_) => false, - } - } - - /// - /// Returns `true` if the function input is the `mut self` keyword. - /// Returns `false` otherwise. - /// - pub fn is_mut_self(&self) -> bool { - match self { - FunctionInput::SelfKeyword(_) => false, - FunctionInput::ConstSelfKeyword(_) => false, - FunctionInput::RefSelfKeyword(_) => true, - FunctionInput::Variable(_) => false, - } - } - /// /// Returns Option with FunctionInputVariable if the input is a variable. /// Returns None otherwise. /// - pub fn get_variable(&self) -> Option<&FunctionInputVariable> { - if let FunctionInput::Variable(var) = self { - Some(var) - } else { - None + pub fn get_variable(&self) -> &FunctionInputVariable { + match self { + Self::Variable(var) => var, } } /// Formats the parameter to `f`. fn format(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - FunctionInput::SelfKeyword(keyword) => write!(f, "{}", keyword), - FunctionInput::ConstSelfKeyword(keyword) => write!(f, "{}", keyword), - FunctionInput::RefSelfKeyword(keyword) => write!(f, "{}", keyword), FunctionInput::Variable(function_input) => write!(f, "{}", function_input), } } @@ -112,11 +62,7 @@ impl PartialEq for FunctionInput { /// Returns true if `self == other`. Does not compare spans. fn eq(&self, other: &Self) -> bool { match (self, other) { - (FunctionInput::SelfKeyword(_), FunctionInput::SelfKeyword(_)) => true, - (FunctionInput::ConstSelfKeyword(_), FunctionInput::ConstSelfKeyword(_)) => true, - (FunctionInput::RefSelfKeyword(_), FunctionInput::RefSelfKeyword(_)) => true, (FunctionInput::Variable(left), FunctionInput::Variable(right)) => left.eq(right), - _ => false, } } } @@ -127,9 +73,6 @@ impl Node for FunctionInput { fn span(&self) -> &Span { use FunctionInput::*; match self { - SelfKeyword(keyword) => &keyword.identifier.span, - ConstSelfKeyword(keyword) => &keyword.identifier.span, - RefSelfKeyword(keyword) => &keyword.identifier.span, Variable(variable) => &variable.span, } } @@ -137,9 +80,6 @@ impl Node for FunctionInput { fn set_span(&mut self, span: Span) { use FunctionInput::*; match self { - SelfKeyword(keyword) => keyword.identifier.span = span, - ConstSelfKeyword(keyword) => keyword.identifier.span = span, - RefSelfKeyword(keyword) => keyword.identifier.span = span, Variable(variable) => variable.span = span, } } diff --git a/compiler/ast/src/reducer/reconstructing_director.rs b/compiler/ast/src/reducer/reconstructing_director.rs index 15f80da3e7..4fb86cbeb4 100644 --- a/compiler/ast/src/reducer/reconstructing_director.rs +++ b/compiler/ast/src/reducer/reconstructing_director.rs @@ -454,7 +454,6 @@ impl ReconstructingDirector { FunctionInput::Variable(function_input_variable) => { FunctionInput::Variable(self.reduce_function_input_variable(function_input_variable)?) } - _ => input.clone(), }; self.reducer.reduce_function_input(input, new) diff --git a/compiler/ast/src/types/type_.rs b/compiler/ast/src/types/type_.rs index 2a24921690..35fb44967d 100644 --- a/compiler/ast/src/types/type_.rs +++ b/compiler/ast/src/types/type_.rs @@ -46,22 +46,12 @@ pub enum Type { /// A reference to either a nominal type (e.g., a `circuit`) or a type alias. Identifier(Identifier), - /// The `Self` type, allowed within `circuit` definitions. - SelfType, - /// Placeholder for a type that could not be resolved or was not well-formed. /// Will eventually lead to a compile error. Err, } impl Type { - /// - /// Returns `true` if the self `Type` is the `SelfType`. - /// - pub fn is_self(&self) -> bool { - matches!(self, Type::SelfType) - } - /// /// Returns `true` if the self `Type` is a `Circuit`. /// @@ -83,7 +73,6 @@ impl Type { (Type::Group, Type::Group) => true, (Type::IntegerType(left), Type::IntegerType(right)) => left.eq(right), (Type::Identifier(left), Type::Identifier(right)) => left.eq(right), - (Type::SelfType, Type::SelfType) => true, (Type::Array(left_type, left_dims), Type::Array(right_type, right_dims)) => { // Convert array dimensions to owned. let mut left_dims = left_dims.to_owned(); @@ -124,7 +113,6 @@ impl fmt::Display for Type { Type::Group => write!(f, "group"), Type::IntegerType(ref integer_type) => write!(f, "{}", integer_type), Type::Identifier(ref variable) => write!(f, "circuit {}", variable), - Type::SelfType => write!(f, "SelfType"), Type::Array(ref array, ref dimensions) => write!(f, "[{}; {}]", *array, dimensions), Type::Tuple(ref tuple) => { let types = tuple.iter().map(|x| x.to_string()).collect::>().join(", "); diff --git a/compiler/compiler/src/lib.rs b/compiler/compiler/src/lib.rs index c8c6de2e36..1402f11c0a 100644 --- a/compiler/compiler/src/lib.rs +++ b/compiler/compiler/src/lib.rs @@ -81,7 +81,7 @@ impl<'a> Compiler<'a> { program_string, )?; // Write the AST snapshot post parsing. - ast.to_json_file_without_keys(self.output_directory.clone(), "initial_ast.json", &["span"])?; + ast.to_json_file_without_keys(self.output_directory, "initial_ast.json", &["span"])?; // Canonicalize the AST. // ast = leo_ast_passes::Canonicalizer::do_pass(Default::default(), ast.into_repr())?; diff --git a/compiler/parser/src/parser/expression.rs b/compiler/parser/src/parser/expression.rs index b22c703f7d..39d48316dd 100644 --- a/compiler/parser/src/parser/expression.rs +++ b/compiler/parser/src/parser/expression.rs @@ -533,17 +533,6 @@ impl ParserContext<'_> { let ident = Identifier { name, span }; Expression::Identifier(ident) } - Token::BigSelf => { - let ident = Identifier { - name: sym::SelfUpper, - span, - }; - Expression::Identifier(ident) - } - Token::LittleSelf => Expression::Identifier(Identifier { - name: sym::SelfLower, - span, - }), Token::Input => Expression::Identifier(Identifier { name: sym::input, span }), t if crate::type_::TYPE_TOKENS.contains(&t) => Expression::Identifier(Identifier { name: t.keyword_to_symbol().unwrap(), diff --git a/compiler/parser/src/parser/file.rs b/compiler/parser/src/parser/file.rs index 4a4d2fd45d..e1052db80e 100644 --- a/compiler/parser/src/parser/file.rs +++ b/compiler/parser/src/parser/file.rs @@ -36,10 +36,7 @@ impl ParserContext<'_> { Token::Import => { import_statements.push(self.parse_import_statement()?); } - Token::Ident(ident) => match *ident { - sym::test => return Err(ParserError::test_function(&token.span).into()), - _ => return Err(Self::unexpected_item(token).into()), - }, + Token::Ident(sym::test) => return Err(ParserError::test_function(&token.span).into()), // Const functions share the first token with the global Const. Token::Const if self.peek_is_function()? => { let (id, function) = self.parse_function_declaration()?; @@ -74,16 +71,11 @@ impl ParserContext<'_> { fn unexpected_item(token: &SpannedToken) -> ParserError { ParserError::unexpected( &token.token, - [ - Token::Import, - Token::Function, - Token::Ident(sym::test), - Token::At, - ] - .iter() - .map(|x| format!("'{}'", x)) - .collect::>() - .join(", "), + [Token::Import, Token::Function, Token::Ident(sym::test), Token::At] + .iter() + .map(|x| format!("'{}'", x)) + .collect::>() + .join(", "), &token.span, ) } @@ -201,36 +193,10 @@ impl ParserContext<'_> { /// /// Returns a [`FunctionInput`] AST node if the next tokens represent a function parameter. /// - pub fn parse_function_parameters(&mut self, first: bool) -> Result { + pub fn parse_function_parameters(&mut self) -> Result { let const_ = self.eat(Token::Const); let mutable = self.eat(Token::Mut); - let reference = self.eat(Token::Ampersand); - let mut name = if let Some(token) = self.eat(Token::LittleSelf) { - Identifier { - name: sym::SelfLower, - span: token.span, - } - } else { - self.expect_ident()? - }; - if name.name == sym::SelfLower { - if !first { - return Err(ParserError::parser_self_outside_first_argument().into()); - } else if let Some(mutable) = &mutable { - self.emit_err(ParserError::mut_self_parameter(&(&mutable.span + &name.span))); - return Ok(Self::build_ref_self(name, mutable)); - } else if let Some(reference) = &reference { - // Handle `&self`. - return Ok(Self::build_ref_self(name, reference)); - } else if let Some(const_) = &const_ { - // Handle `const self`. - name.span = &const_.span + &name.span; - name.name = Symbol::intern("const self"); - return Ok(FunctionInput::ConstSelfKeyword(ConstSelfKeyword { identifier: name })); - } - // Handle `self`. - return Ok(FunctionInput::SelfKeyword(SelfKeyword { identifier: name })); - } + let name = self.expect_ident()?; if let Some(mutable) = &mutable { self.emit_err(ParserError::mut_function_input(&(&mutable.span + &name.span))); @@ -247,14 +213,6 @@ impl ParserContext<'_> { })) } - /// Builds a function parameter `&self`. - fn build_ref_self(mut name: Identifier, reference: &SpannedToken) -> FunctionInput { - name.span = &reference.span + &name.span; - // FIXME(Centril): This should be *two* tokens, NOT one! - name.name = Symbol::intern("&self"); - FunctionInput::RefSelfKeyword(RefSelfKeyword { identifier: name }) - } - /// Returns an [`(Identifier, Function)`] AST node if the next tokens represent a function name /// and function definition. pub fn parse_function_declaration(&mut self) -> Result<(Identifier, Function)> { @@ -273,12 +231,7 @@ impl ParserContext<'_> { let name = self.expect_ident()?; // Parse parameters. - let mut first = true; - let (inputs, ..) = self.parse_paren_comma_list(|p| { - let param = p.parse_function_parameters(first).map(Some); - first = false; - param - })?; + let (inputs, ..) = self.parse_paren_comma_list(|p| p.parse_function_parameters().map(Some))?; // Parse return type. let output = if self.eat(Token::Arrow).is_some() { diff --git a/compiler/parser/src/parser/mod.rs b/compiler/parser/src/parser/mod.rs index 89020f61b6..60f041cbdf 100644 --- a/compiler/parser/src/parser/mod.rs +++ b/compiler/parser/src/parser/mod.rs @@ -24,7 +24,7 @@ use crate::{tokenizer::*, Token}; use leo_ast::*; use leo_errors::emitter::Handler; use leo_errors::{ParserError, Result}; -use leo_span::{Span, Symbol}; +use leo_span::Span; use indexmap::IndexMap; use std::unreachable; diff --git a/compiler/parser/src/parser/type_.rs b/compiler/parser/src/parser/type_.rs index 1d4f100581..93f7c3bce3 100644 --- a/compiler/parser/src/parser/type_.rs +++ b/compiler/parser/src/parser/type_.rs @@ -85,9 +85,7 @@ impl ParserContext<'_> { /// Returns a [`(Type, Span)`] tuple of AST nodes if the next token represents a type. /// Also returns the span of the parsed token. pub fn parse_type(&mut self) -> Result<(Type, Span)> { - Ok(if let Some(token) = self.eat(Token::BigSelf) { - (Type::SelfType, token.span) - } else if let Some(ident) = self.eat_identifier() { + Ok(if let Some(ident) = self.eat_identifier() { let span = ident.span.clone(); (Type::Identifier(ident), span) } else if self.peek_is_left_par() { diff --git a/compiler/parser/src/tokenizer/lexer.rs b/compiler/parser/src/tokenizer/lexer.rs index a59e6cd33f..7fab42e014 100644 --- a/compiler/parser/src/tokenizer/lexer.rs +++ b/compiler/parser/src/tokenizer/lexer.rs @@ -436,8 +436,6 @@ impl Token { "let" => Token::Let, "mut" => Token::Mut, "return" => Token::Return, - "Self" => Token::BigSelf, - "self" => Token::LittleSelf, "static" => Token::Static, "true" => Token::True, "type" => Token::Type, diff --git a/compiler/parser/src/tokenizer/token.rs b/compiler/parser/src/tokenizer/token.rs index 3add1f3d06..fc58597520 100644 --- a/compiler/parser/src/tokenizer/token.rs +++ b/compiler/parser/src/tokenizer/token.rs @@ -116,11 +116,9 @@ pub enum Token { Bool, Address, Char, - BigSelf, // primary expresion Input, - LittleSelf, // Import Import, @@ -175,8 +173,6 @@ pub const KEYWORD_TOKENS: &[Token] = &[ Token::Mut, Token::Ampersand, Token::Return, - Token::BigSelf, - Token::LittleSelf, Token::Static, Token::True, Token::Type, @@ -222,8 +218,6 @@ impl Token { Token::Mut => sym::Mut, Token::Ampersand => sym::Ampersand, Token::Return => sym::Return, - Token::BigSelf => sym::SelfUpper, - Token::LittleSelf => sym::SelfLower, Token::Static => sym::Static, Token::True => sym::True, Token::Type => sym::Type, @@ -312,10 +306,8 @@ impl fmt::Display for Token { Bool => write!(f, "bool"), Address => write!(f, "address"), Char => write!(f, "char"), - BigSelf => write!(f, "Self"), Input => write!(f, "input"), - LittleSelf => write!(f, "self"), Import => write!(f, "import"), diff --git a/leo/span/src/symbol.rs b/leo/span/src/symbol.rs index 0c7f0068e1..214df3f3a1 100644 --- a/leo/span/src/symbol.rs +++ b/leo/span/src/symbol.rs @@ -108,7 +108,6 @@ symbols! { At: "@", bool, char, - circuit, Class: "class", context, constants, @@ -137,8 +136,6 @@ symbols! { Mut: "mut", prelude, Return: "return", - SelfLower: "self", - SelfUpper: "Self", Star: "*", std, Static: "static", From 7ad500b3443c6497609ae1c8c003ef49fac1c1e1 Mon Sep 17 00:00:00 2001 From: gluax <16431709+gluax@users.noreply.github.com> Date: Mon, 28 Mar 2022 06:53:22 -0700 Subject: [PATCH 04/10] remove uneeded circuit syms --- compiler/parser/src/tokenizer/lexer.rs | 3 +-- compiler/parser/src/tokenizer/mod.rs | 6 +----- compiler/parser/src/tokenizer/token.rs | 10 ---------- leo/span/src/symbol.rs | 2 -- .../parser/parser/expression/token_format.leo.out | 5 +---- .../parser/parser/unreachable/define.leo.out | 2 +- .../parser/parser/unreachable/eat_ident.leo.out | 2 +- .../parser/parser/unreachable/eat_int.leo.out | 2 +- .../unreachable/equality_and_order_expression.leo.out | 2 +- .../parser/parser/unreachable/expect_ident.leo.out | 6 +++--- .../parser/parser/unreachable/math_op_fail.leo.out | 4 ++-- tests/parser/expression/token_format.leo | 6 ------ tests/parser/functions/const_self_bad.leo | 8 -------- 13 files changed, 12 insertions(+), 46 deletions(-) delete mode 100644 tests/parser/functions/const_self_bad.leo diff --git a/compiler/parser/src/tokenizer/lexer.rs b/compiler/parser/src/tokenizer/lexer.rs index 7fab42e014..bfb58cb931 100644 --- a/compiler/parser/src/tokenizer/lexer.rs +++ b/compiler/parser/src/tokenizer/lexer.rs @@ -244,7 +244,7 @@ impl Token { if input.next_if_eq(&'&').is_some() { return Ok((2, Token::And)); } - return Ok((1, Token::Ampersand)); + return Err(ParserError::lexer_empty_input_tendril().into()); } Some('(') => { input.next(); @@ -436,7 +436,6 @@ impl Token { "let" => Token::Let, "mut" => Token::Mut, "return" => Token::Return, - "static" => Token::Static, "true" => Token::True, "type" => Token::Type, "u8" => Token::U8, diff --git a/compiler/parser/src/tokenizer/mod.rs b/compiler/parser/src/tokenizer/mod.rs index 7b6d8fd23d..f8d2ba8fd2 100644 --- a/compiler/parser/src/tokenizer/mod.rs +++ b/compiler/parser/src/tokenizer/mod.rs @@ -145,9 +145,7 @@ mod tests { input let mut - & return - static string test true @@ -156,8 +154,6 @@ mod tests { u32 u16 u8 - self - Self console ! != @@ -209,7 +205,7 @@ mod tests { assert_eq!( output, - r#"'a' '😭' "test" "test{}test" "test{}" "{}test" "test{" "test}" "test{test" "test}test" "te{{}}" aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 test_ident 12345 address as bool circuit const else false field for function group i128 i64 i32 i16 i8 if import in input let mut & return static string test true u128 u64 u32 u16 u8 self Self console ! != && ( ) * ** **= *= + += , - -= -> _ . .. ... / /= : :: ; < <= = == > >= @ [ ] { { } } || ? // test + r#"'a' '😭' "test" "test{}test" "test{}" "{}test" "test{" "test}" "test{test" "test}test" "te{{}}" aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 test_ident 12345 address as bool circuit const else false field for function group i128 i64 i32 i16 i8 if import in input let mut return string test true u128 u64 u32 u16 u8 console ! != && ( ) * ** **= *= + += , - -= -> _ . .. ... / /= : :: ; < <= = == > >= @ [ ] { { } } || ? // test /* test */ // "# ); }); diff --git a/compiler/parser/src/tokenizer/token.rs b/compiler/parser/src/tokenizer/token.rs index fc58597520..2a55f45b32 100644 --- a/compiler/parser/src/tokenizer/token.rs +++ b/compiler/parser/src/tokenizer/token.rs @@ -135,11 +135,7 @@ pub enum Token { In, Let, Mut, - /// Represents `&`. - /// Used for `Reference` and `BitAnd`. - Ampersand, Return, - Static, Type, // Meta Tokens @@ -171,9 +167,7 @@ pub const KEYWORD_TOKENS: &[Token] = &[ Token::Input, Token::Let, Token::Mut, - Token::Ampersand, Token::Return, - Token::Static, Token::True, Token::Type, Token::U8, @@ -216,9 +210,7 @@ impl Token { Token::Input => sym::input, Token::Let => sym::Let, Token::Mut => sym::Mut, - Token::Ampersand => sym::Ampersand, Token::Return => sym::Return, - Token::Static => sym::Static, Token::True => sym::True, Token::Type => sym::Type, Token::U8 => sym::u8, @@ -321,9 +313,7 @@ impl fmt::Display for Token { In => write!(f, "in"), Let => write!(f, "let"), Mut => write!(f, "mut"), - Ampersand => write!(f, "&"), // Used for `Reference` and `BitAnd` Return => write!(f, "return"), - Static => write!(f, "static"), Type => write!(f, "type"), Eof => write!(f, ""), } diff --git a/leo/span/src/symbol.rs b/leo/span/src/symbol.rs index 214df3f3a1..95aa7f36bd 100644 --- a/leo/span/src/symbol.rs +++ b/leo/span/src/symbol.rs @@ -101,7 +101,6 @@ macro_rules! symbols { symbols! { address, AlwaysConst, - Ampersand: "&", array, As: "as", assert, @@ -138,7 +137,6 @@ symbols! { Return: "return", Star: "*", std, - Static: "static", Struct: "struct", test, True: "true", diff --git a/tests/expectations/parser/parser/expression/token_format.leo.out b/tests/expectations/parser/parser/expression/token_format.leo.out index 51c047f2d5..6d98d2ca3a 100644 --- a/tests/expectations/parser/parser/expression/token_format.leo.out +++ b/tests/expectations/parser/parser/expression/token_format.leo.out @@ -62,8 +62,6 @@ outputs: - "Error [EPAR0370030]: Could not lex the following content: `~`." - "Error [EPAR0370030]: Could not lex the following content: `~`." - "Error [EPAR0370030]: Could not lex the following content: `~`." - - "Error [EPAR0370030]: Could not lex the following content: `~`." - - "Error [EPAR0370030]: Could not lex the following content: `~`." - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'import'\n --> test:1:1\n |\n 1 | import\n | ^^^^^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'as'\n --> test:1:1\n |\n 1 | as\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'console'\n --> test:1:1\n |\n 1 | console\n | ^^^^^^^" @@ -75,7 +73,6 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'in'\n --> test:1:1\n |\n 1 | in\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'let'\n --> test:1:1\n |\n 1 | let\n | ^^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'mut'\n --> test:1:1\n |\n 1 | mut\n | ^^^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '&'\n --> test:1:1\n |\n 1 | &\n | ^" + - "Error [EPAR0370023]: Expected more characters to lex but found none." - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'return'\n --> test:1:1\n |\n 1 | return\n | ^^^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'static'\n --> test:1:1\n |\n 1 | static\n | ^^^^^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'type'\n --> test:1:1\n |\n 1 | type\n | ^^^^" diff --git a/tests/expectations/parser/parser/unreachable/define.leo.out b/tests/expectations/parser/parser/unreachable/define.leo.out index 375ae97a14..d7699d0ea4 100644 --- a/tests/expectations/parser/parser/unreachable/define.leo.out +++ b/tests/expectations/parser/parser/unreachable/define.leo.out @@ -41,7 +41,7 @@ outputs: - "Error [EPAR0370005]: expected ; -- got 'x'\n --> test:1:5\n |\n 1 | u32 x = 10u8;\n | ^" - "Error [EPAR0370005]: expected ; -- got 'x'\n --> test:1:5\n |\n 1 | u64 x = 10u8;\n | ^" - "Error [EPAR0370005]: expected ; -- got 'x'\n --> test:1:6\n |\n 1 | u128 x = 10u8;\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '&'\n --> test:1:1\n |\n 1 | & x = 10u8;\n | ^" + - "Error [EPAR0370023]: Expected more characters to lex but found none." - "Error [EPAR0370005]: expected ; -- got '='\n --> test:1:10\n |\n 1 | return x = 10u8;\n | ^" - "Error [EPAR0370005]: expected ; -- got 'x'\n --> test:1:6\n |\n 1 | self x = 10u8;\n | ^" - "Error [EPAR0370005]: expected ; -- got 'x'\n --> test:1:6\n |\n 1 | Self x = 10u8;\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/eat_ident.leo.out b/tests/expectations/parser/parser/unreachable/eat_ident.leo.out index f82e145f71..5c1018440c 100644 --- a/tests/expectations/parser/parser/unreachable/eat_ident.leo.out +++ b/tests/expectations/parser/parser/unreachable/eat_ident.leo.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370005]: expected 'import', 'function', 'test', '@' -- got 'circuit'\n --> test:3:1\n |\n 3 | circuit ;\n | ^^^^^^^" + - "Error [EPAR0370023]: Expected more characters to lex but found none." diff --git a/tests/expectations/parser/parser/unreachable/eat_int.leo.out b/tests/expectations/parser/parser/unreachable/eat_int.leo.out index f2f5151fe2..e3393e9411 100644 --- a/tests/expectations/parser/parser/unreachable/eat_int.leo.out +++ b/tests/expectations/parser/parser/unreachable/eat_int.leo.out @@ -48,7 +48,7 @@ outputs: - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_u32\n | ^" - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_u64\n | ^" - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_u128\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_&\n | ^" + - "Error [EPAR0370023]: Expected more characters to lex but found none." - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_return\n | ^" - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_self\n | ^" - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_Self\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/equality_and_order_expression.leo.out b/tests/expectations/parser/parser/unreachable/equality_and_order_expression.leo.out index 23a140dc16..2fb078335f 100644 --- a/tests/expectations/parser/parser/unreachable/equality_and_order_expression.leo.out +++ b/tests/expectations/parser/parser/unreachable/equality_and_order_expression.leo.out @@ -47,7 +47,7 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'if'\n --> test:1:1\n |\n 1 | if 10 u32 {}\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'if'\n --> test:1:1\n |\n 1 | if 10 u64 {}\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'if'\n --> test:1:1\n |\n 1 | if 10 u128 {}\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'if'\n --> test:1:1\n |\n 1 | if 10 & {}\n | ^^" + - "Error [EPAR0370023]: Expected more characters to lex but found none." - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'if'\n --> test:1:1\n |\n 1 | if 10 return {}\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'if'\n --> test:1:1\n |\n 1 | if 10 self {}\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'if'\n --> test:1:1\n |\n 1 | if 10 Self {}\n | ^^" diff --git a/tests/expectations/parser/parser/unreachable/expect_ident.leo.out b/tests/expectations/parser/parser/unreachable/expect_ident.leo.out index 5d356e51f1..e98fc9fdc4 100644 --- a/tests/expectations/parser/parser/unreachable/expect_ident.leo.out +++ b/tests/expectations/parser/parser/unreachable/expect_ident.leo.out @@ -47,10 +47,10 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'u32'\n --> test:1:4\n |\n 1 | x::u32\n | ^^^" - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'u64'\n --> test:1:4\n |\n 1 | x::u64\n | ^^^" - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'u128'\n --> test:1:4\n |\n 1 | x::u128\n | ^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '&'\n --> test:1:4\n |\n 1 | x::&\n | ^" + - "Error [EPAR0370023]: Expected more characters to lex but found none." - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'return'\n --> test:1:4\n |\n 1 | x::return\n | ^^^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'self'\n --> test:1:4\n |\n 1 | x::self\n | ^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'Self'\n --> test:1:4\n |\n 1 | x::Self\n | ^^^^" + - "Error [EPAR0370003]: unexpected EOF\n --> test:1:4\n |\n 1 | x::self\n | ^^^^" + - "Error [EPAR0370003]: unexpected EOF\n --> test:1:4\n |\n 1 | x::Self\n | ^^^^" - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'true'\n --> test:1:4\n |\n 1 | x::true\n | ^^^^" - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'false'\n --> test:1:4\n |\n 1 | x::false\n | ^^^^^" - "Error [EPAR0370009]: unexpected string: expected 'ident', got '0'\n --> test:1:4\n |\n 1 | x::0\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out b/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out index 1008530bed..a8bcac1e72 100644 --- a/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out +++ b/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out @@ -33,7 +33,7 @@ outputs: - "Error [EPAR0370005]: expected ; -- got 'u32'\n --> test:1:11\n |\n 1 | let x = a u32 b;\n | ^^^" - "Error [EPAR0370005]: expected ; -- got 'u64'\n --> test:1:11\n |\n 1 | let x = a u64 b;\n | ^^^" - "Error [EPAR0370005]: expected ; -- got 'u128'\n --> test:1:11\n |\n 1 | let x = a u128 b;\n | ^^^^" - - "Error [EPAR0370005]: expected ; -- got '&'\n --> test:1:11\n |\n 1 | let x = a & b;\n | ^" + - "Error [EPAR0370023]: Expected more characters to lex but found none." - "Error [EPAR0370005]: expected ; -- got 'return'\n --> test:1:11\n |\n 1 | let x = a return b;\n | ^^^^^^" - "Error [EPAR0370005]: expected ; -- got 'self'\n --> test:1:11\n |\n 1 | let x = a self b;\n | ^^^^" - "Error [EPAR0370005]: expected ; -- got 'Self'\n --> test:1:11\n |\n 1 | let x = a Self b;\n | ^^^^" @@ -56,4 +56,4 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:4\n |\n 1 | x>==b;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:4\n |\n 1 | x<==b;\n | ^" - "Error [EPAR0370005]: expected ; -- got '..'\n --> test:1:2\n |\n 1 | x..=b;\n | ^^" - - "Error [EPAR0370005]: expected ; -- got '&'\n --> test:1:2\n |\n 1 | x&=b;\n | ^" + - "Error [EPAR0370023]: Expected more characters to lex but found none." diff --git a/tests/parser/expression/token_format.leo b/tests/parser/expression/token_format.leo index 191641644c..0445fe5ce5 100644 --- a/tests/parser/expression/token_format.leo +++ b/tests/parser/expression/token_format.leo @@ -121,12 +121,8 @@ address ~ char ~ -Self ~ - input ~ -self ~ - import as @@ -153,6 +149,4 @@ mut return -static - type \ No newline at end of file diff --git a/tests/parser/functions/const_self_bad.leo b/tests/parser/functions/const_self_bad.leo deleted file mode 100644 index 281dbab043..0000000000 --- a/tests/parser/functions/const_self_bad.leo +++ /dev/null @@ -1,8 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -function x(const self) { - return (); -} \ No newline at end of file From 401c6a6d4d626f923ccb3a96259bd693a7d13b4b Mon Sep 17 00:00:00 2001 From: gluax <16431709+gluax@users.noreply.github.com> Date: Mon, 28 Mar 2022 07:04:29 -0700 Subject: [PATCH 05/10] remove annotation and static access --- compiler/ast/src/accesses/mod.rs | 3 - compiler/ast/src/accesses/static_access.rs | 54 --- compiler/ast/src/annotation.rs | 52 --- compiler/ast/src/expression/accesses.rs | 5 - compiler/ast/src/functions/function.rs | 5 +- compiler/ast/src/lib.rs | 3 - .../src/reducer/reconstructing_director.rs | 35 +- .../ast/src/reducer/reconstructing_reducer.rs | 25 -- compiler/parser/src/parser/context.rs | 2 +- compiler/parser/src/parser/expression.rs | 11 +- compiler/parser/src/parser/file.rs | 53 +-- compiler/parser/src/parser/statement.rs | 1 - compiler/parser/src/tokenizer/lexer.rs | 10 +- compiler/parser/src/tokenizer/mod.rs | 4 +- compiler/parser/src/tokenizer/token.rs | 6 - leo/span/src/symbol.rs | 1 - .../expression/access/array_access.leo.out | 35 -- .../parser/expression/access/call.leo.out | 47 --- .../parser/expression/literal/access.leo.out | 345 ------------------ .../parser/expression/token_format.leo.out | 4 +- .../parser/expression/unary/negate.leo.out | 23 -- .../parser/expression/unary/not.leo.out | 23 -- .../functions/annotated_arg_not_ident.leo.out | 2 +- .../functions/annotated_context_fail.leo.out | 2 +- .../functions/bounded_recursion.leo.out | 2 - .../parser/functions/const_function.leo.out | 1 - .../parser/functions/const_param.leo.out | 2 - .../parser/parser/functions/empty.leo.out | 1 - .../parser/parser/functions/empty2.leo.out | 1 - .../parser/functions/ident_token_fail.leo.out | 2 +- .../functions/infinite_recursion.leo.out | 2 - .../parser/functions/param_array.leo.out | 1 - .../parser/functions/param_circuit.leo.out | 1 - .../parser/functions/param_tuple.leo.out | 1 - .../parser/parser/functions/params.leo.out | 1 - .../parser/functions/params_return.leo.out | 1 - .../parser/parser/functions/return.leo.out | 1 - .../parser/functions/return_tuple.leo.out | 1 - .../parser/serialize/one_plus_one.leo.out | 1 - .../parser/serialize/palindrome.leo.out | 22 +- .../parser/serialize/parser_error.leo.out | 2 +- .../parser/statement/assign_fail.leo.out | 2 +- .../parser/parser/unreachable/define.leo.out | 2 +- .../parser/unreachable/expect_ident.leo.out | 102 +++--- .../parser/unreachable/math_op_fail.leo.out | 2 +- .../parser/unreachable/math_op_pass.leo.out | 34 -- .../parser/expression/access/array_access.leo | 1 - tests/parser/expression/access/call.leo | 2 - .../expression/access/circuit_static.leo | 11 - tests/parser/expression/literal/access.leo | 19 +- tests/parser/expression/unary/negate.leo | 1 - tests/parser/expression/unary/not.leo | 1 - tests/parser/functions/annotated.leo | 24 -- tests/parser/functions/annotated_param.leo | 9 - tests/parser/functions/annotated_twice.leo | 9 - tests/parser/serialize/palindrome.leo | 1 - tests/parser/unreachable/math_op_pass.leo | 2 - 57 files changed, 78 insertions(+), 938 deletions(-) delete mode 100644 compiler/ast/src/accesses/static_access.rs delete mode 100644 compiler/ast/src/annotation.rs delete mode 100644 tests/parser/expression/access/circuit_static.leo delete mode 100644 tests/parser/functions/annotated.leo delete mode 100644 tests/parser/functions/annotated_param.leo delete mode 100644 tests/parser/functions/annotated_twice.leo diff --git a/compiler/ast/src/accesses/mod.rs b/compiler/ast/src/accesses/mod.rs index 70126db92c..7a929de55f 100644 --- a/compiler/ast/src/accesses/mod.rs +++ b/compiler/ast/src/accesses/mod.rs @@ -25,6 +25,3 @@ pub use member_access::*; mod tuple_access; pub use tuple_access::*; - -mod static_access; -pub use static_access::*; diff --git a/compiler/ast/src/accesses/static_access.rs b/compiler/ast/src/accesses/static_access.rs deleted file mode 100644 index c61d4976f1..0000000000 --- a/compiler/ast/src/accesses/static_access.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{Expression, Identifier, Node, Type}; - -use leo_span::Span; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -/// An access expression to a static member, e.g., a constant in a circuit. -/// An example would be `Foo::Const` or `Foo::function` in `Foo::function()`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct StaticAccess { - /// Represents the container for the static member to access. - /// Usually this is a circuit. - pub inner: Box, - /// The static member in `inner` that is being accessed. - pub name: Identifier, - /// An optional type initially None, it is later assigned during type inference snapshot if necessary. - // FIXME(Centril): Shouldn't be in an AST. Remove it as part of an architectural revamp. - pub type_: Option, - /// The span for the entire expression `inner::name`. - pub span: Span, -} - -impl fmt::Display for StaticAccess { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}::{}", self.inner, self.name) - } -} - -impl Node for StaticAccess { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/annotation.rs b/compiler/ast/src/annotation.rs deleted file mode 100644 index 572c1191d3..0000000000 --- a/compiler/ast/src/annotation.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::Identifier; -use leo_span::{sym, Span, Symbol}; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -/// An annotation `@name (arguments)?`. -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] -pub struct Annotation { - /// The span including `name ( arguments )`. - pub span: Span, - /// The name of the annotation. - pub name: Identifier, - /// Arguments for the annotation, if any. - pub arguments: Vec, -} - -/// The set of allowed annotations. -const ALLOWED_ANNOTATIONS: &[Symbol] = &[sym::test]; - -impl Annotation { - /// Is the annotation valid? - pub fn is_valid_annotation(&self) -> bool { - ALLOWED_ANNOTATIONS.iter().any(|name| self.name.name == *name) - } -} - -impl fmt::Display for Annotation { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "@{:}(", self.name)?; - for arg in &self.arguments { - write!(f, "{:},", arg)?; - } - write!(f, ")") - } -} diff --git a/compiler/ast/src/expression/accesses.rs b/compiler/ast/src/expression/accesses.rs index 2bef95ce46..8d96545bd7 100644 --- a/compiler/ast/src/expression/accesses.rs +++ b/compiler/ast/src/expression/accesses.rs @@ -28,8 +28,6 @@ pub enum AccessExpression { Member(MemberAccess), /// Access to a tuple field using its position, e.g., `tuple.1`. Tuple(TupleAccess), - /// Access to a member constant or a static function of a circuit. - Static(StaticAccess), } impl fmt::Display for AccessExpression { @@ -41,7 +39,6 @@ impl fmt::Display for AccessExpression { ArrayRange(access) => access.fmt(f), Member(access) => access.fmt(f), Tuple(access) => access.fmt(f), - Static(access) => access.fmt(f), } } } @@ -55,7 +52,6 @@ impl Node for AccessExpression { ArrayRange(access) => access.span(), Member(access) => access.span(), Tuple(access) => access.span(), - Static(access) => access.span(), } } @@ -67,7 +63,6 @@ impl Node for AccessExpression { ArrayRange(access) => access.set_span(span), Member(access) => access.set_span(span), Tuple(access) => access.set_span(span), - Static(access) => access.set_span(span), } } } diff --git a/compiler/ast/src/functions/function.rs b/compiler/ast/src/functions/function.rs index 0e943376a3..7ea381c72a 100644 --- a/compiler/ast/src/functions/function.rs +++ b/compiler/ast/src/functions/function.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Annotation, Block, FunctionInput, Identifier, Node, Type}; +use crate::{Block, FunctionInput, Identifier, Node, Type}; use leo_span::{sym, Span, Symbol}; -use indexmap::IndexMap; use serde::{Deserialize, Serialize}; use std::cell::Cell; use std::fmt; @@ -25,8 +24,6 @@ use std::fmt; /// A function definition. #[derive(Clone, Serialize, Deserialize)] pub struct Function { - /// A map of all the annotations from their base names to the whole. - pub annotations: IndexMap, /// The function identifier, e.g., `foo` in `function foo(...) { ... }`. pub identifier: Identifier, /// The function's parameters. diff --git a/compiler/ast/src/lib.rs b/compiler/ast/src/lib.rs index cefb6c3e2d..4ff6b92a54 100644 --- a/compiler/ast/src/lib.rs +++ b/compiler/ast/src/lib.rs @@ -28,9 +28,6 @@ pub use self::accesses::*; pub mod aliases; pub use self::aliases::*; -pub mod annotation; -pub use self::annotation::*; - pub mod chars; pub use self::chars::*; diff --git a/compiler/ast/src/reducer/reconstructing_director.rs b/compiler/ast/src/reducer/reconstructing_director.rs index 4fb86cbeb4..c9d34514d3 100644 --- a/compiler/ast/src/reducer/reconstructing_director.rs +++ b/compiler/ast/src/reducer/reconstructing_director.rs @@ -177,18 +177,6 @@ impl ReconstructingDirector { self.reducer.reduce_tuple_access(tuple_access, tuple) } - pub fn reduce_static_access(&mut self, static_access: &StaticAccess) -> Result { - let value = self.reduce_expression(&static_access.inner)?; - let name = self.reduce_identifier(&static_access.name)?; - let type_ = static_access - .type_ - .as_ref() - .map(|type_| self.reduce_type(type_, &static_access.span)) - .transpose()?; - - self.reducer.reduce_static_access(static_access, value, type_, name) - } - pub fn reduce_access(&mut self, access: &AccessExpression) -> Result { use AccessExpression::*; @@ -197,7 +185,6 @@ impl ReconstructingDirector { ArrayRange(access) => ArrayRange(self.reduce_array_range_access(access)?), Member(access) => Member(self.reduce_member_access(access)?), Tuple(access) => Tuple(self.reduce_tuple_access(access)?), - Static(access) => Static(self.reduce_static_access(access)?), }; Ok(new) @@ -494,20 +481,9 @@ impl ReconstructingDirector { self.reducer.reduce_import(new_identifer, new_import) } - fn reduce_annotation(&mut self, annotation: &Annotation) -> Result { - let name = self.reduce_identifier(&annotation.name)?; - - self.reducer.reduce_annotation(annotation, name) - } - pub fn reduce_function(&mut self, function: &Function) -> Result { let identifier = self.reduce_identifier(&function.identifier)?; - let mut annotations = IndexMap::new(); - for (name, annotation) in function.annotations.iter() { - annotations.insert(*name, self.reduce_annotation(annotation)?); - } - let mut inputs = vec![]; for input in function.input.iter() { inputs.push(self.reduce_function_input(input)?); @@ -521,14 +497,7 @@ impl ReconstructingDirector { let block = self.reduce_block(&function.block)?; - self.reducer.reduce_function( - function, - identifier, - annotations, - inputs, - function.const_, - output, - block, - ) + self.reducer + .reduce_function(function, identifier, inputs, function.const_, output, block) } } diff --git a/compiler/ast/src/reducer/reconstructing_reducer.rs b/compiler/ast/src/reducer/reconstructing_reducer.rs index 3fdeaa2912..99ffc87f5e 100644 --- a/compiler/ast/src/reducer/reconstructing_reducer.rs +++ b/compiler/ast/src/reducer/reconstructing_reducer.rs @@ -172,21 +172,6 @@ pub trait ReconstructingReducer { }) } - fn reduce_static_access( - &mut self, - static_access: &StaticAccess, - value: Expression, - type_: Option, - name: Identifier, - ) -> Result { - Ok(StaticAccess { - inner: Box::new(value), - name, - type_, - span: static_access.span.clone(), - }) - } - fn reduce_array_inline( &mut self, array_inline: &ArrayInlineExpression, @@ -416,20 +401,11 @@ pub trait ReconstructingReducer { Ok((identifier, import)) } - fn reduce_annotation(&mut self, annotation: &Annotation, name: Identifier) -> Result { - Ok(Annotation { - span: annotation.span.clone(), - name, - arguments: annotation.arguments.clone(), - }) - } - #[allow(clippy::too_many_arguments)] fn reduce_function( &mut self, function: &Function, identifier: Identifier, - annotations: IndexMap, input: Vec, const_: bool, output: Option, @@ -437,7 +413,6 @@ pub trait ReconstructingReducer { ) -> Result { Ok(Function { identifier, - annotations, input, const_, output, diff --git a/compiler/parser/src/parser/context.rs b/compiler/parser/src/parser/context.rs index 565a36adbb..7a0fe064d8 100644 --- a/compiler/parser/src/parser/context.rs +++ b/compiler/parser/src/parser/context.rs @@ -196,7 +196,7 @@ impl<'a> ParserContext<'a> { }; Ok(matches!( (first, next), - (Token::Function | Token::At, _) | (Token::Const, Token::Function) + (Token::Function, _) | (Token::Const, Token::Function) )) } diff --git a/compiler/parser/src/parser/expression.rs b/compiler/parser/src/parser/expression.rs index 39d48316dd..d95c98b35a 100644 --- a/compiler/parser/src/parser/expression.rs +++ b/compiler/parser/src/parser/expression.rs @@ -268,7 +268,7 @@ impl ParserContext<'_> { // the ABNF states. Rather the primary expression already // handle those. The ABNF is more specific for language reasons. let mut expr = self.parse_primary_expression()?; - while let Some(token) = self.eat_any(&[Token::LeftSquare, Token::Dot, Token::LeftParen, Token::DoubleColon]) { + while let Some(token) = self.eat_any(&[Token::LeftSquare, Token::Dot, Token::LeftParen]) { match token.token { Token::LeftSquare => { if self.eat(Token::DotDot).is_some() { @@ -351,15 +351,6 @@ impl ParserContext<'_> { arguments, }); } - Token::DoubleColon => { - let ident = self.expect_ident()?; - expr = Expression::Access(AccessExpression::Static(StaticAccess { - span: expr.span() + &ident.span, - inner: Box::new(expr), - type_: None, - name: ident, - })); - } _ => unreachable!("parse_postfix_expression_ shouldn't produce this"), } } diff --git a/compiler/parser/src/parser/file.rs b/compiler/parser/src/parser/file.rs index e1052db80e..3d8e9a5290 100644 --- a/compiler/parser/src/parser/file.rs +++ b/compiler/parser/src/parser/file.rs @@ -46,7 +46,7 @@ impl ParserContext<'_> { let (name, global_const) = self.parse_global_const_declaration()?; global_consts.insert(name, global_const); } - Token::Function | Token::At => { + Token::Function => { let (id, function) = self.parse_function_declaration()?; functions.insert(id, function); } @@ -71,7 +71,7 @@ impl ParserContext<'_> { fn unexpected_item(token: &SpannedToken) -> ParserError { ParserError::unexpected( &token.token, - [Token::Import, Token::Function, Token::Ident(sym::test), Token::At] + [Token::Import, Token::Function, Token::Ident(sym::test)] .iter() .map(|x| format!("'{}'", x)) .collect::>() @@ -80,47 +80,6 @@ impl ParserContext<'_> { ) } - /// Returns an [`Annotation`] AST node if the next tokens represent a supported annotation. - pub fn parse_annotation(&mut self) -> Result { - let start = self.expect(Token::At)?; - let name = self.parse_annotation_name()?; - - assert_no_whitespace(&start, &name.span, &name.name.as_str(), "@")?; - - let (end_span, arguments) = if self.peek_is_left_par() { - let (args, _, span) = self.parse_paren_comma_list(|p| { - Ok(if let Some(ident) = p.eat_identifier() { - Some(ident.name) - } else { - let token = p.expect_any()?; - p.emit_err(ParserError::unexpected_str(&token.token, "ident", &token.span)); - None - }) - })?; - (span, args) - } else { - (name.span.clone(), Vec::new()) - }; - Ok(Annotation { - name, - arguments, - span: start + end_span, - }) - } - - /// Parses `foo` in an annotation `@foo . That is, the name of the annotation. - fn parse_annotation_name(&mut self) -> Result { - let mut name = self.expect_ident()?; - - // Recover `context` instead of `test`. - if name.name == sym::context { - self.emit_err(ParserError::context_annotation(&name.span)); - name.name = sym::test; - } - - Ok(name) - } - /// Returns an [`Identifier`] AST node if the next tokens represent a valid package name. pub fn parse_package_name(&mut self) -> Result { // Build the package name, starting with valid characters up to a dash `-` (Token::Minus). @@ -216,13 +175,6 @@ impl ParserContext<'_> { /// Returns an [`(Identifier, Function)`] AST node if the next tokens represent a function name /// and function definition. pub fn parse_function_declaration(&mut self) -> Result<(Identifier, Function)> { - // Parse any annotations. - let mut annotations = IndexMap::new(); - while self.peek_token().as_ref() == &Token::At { - let annotation = self.parse_annotation()?; - annotations.insert(annotation.name.name, annotation); - } - // Parse optional const modifier. let const_ = self.eat(Token::Const).is_some(); @@ -246,7 +198,6 @@ impl ParserContext<'_> { Ok(( name.clone(), Function { - annotations, identifier: name, input: inputs, const_, diff --git a/compiler/parser/src/parser/statement.rs b/compiler/parser/src/parser/statement.rs index 2482f4a44c..a50c12f079 100644 --- a/compiler/parser/src/parser/statement.rs +++ b/compiler/parser/src/parser/statement.rs @@ -56,7 +56,6 @@ impl ParserContext<'_> { identifier = Self::construct_assignee_access(*expr.array, accesses)?; accesses.push(AssigneeAccess::ArrayIndex(*expr.index)); } - _ => return Err(ParserError::invalid_assignment_target(access.span()).into()), }, Expression::Identifier(id) => identifier = id, diff --git a/compiler/parser/src/tokenizer/lexer.rs b/compiler/parser/src/tokenizer/lexer.rs index bfb58cb931..ecbe41e23c 100644 --- a/compiler/parser/src/tokenizer/lexer.rs +++ b/compiler/parser/src/tokenizer/lexer.rs @@ -344,11 +344,7 @@ impl Token { } Some(':') => { input.next(); - if input.next_if_eq(&':').is_some() { - return Ok((2, Token::DoubleColon)); - } else { - return Ok((1, Token::Colon)); - } + return Ok((1, Token::Colon)); } Some(';') => { input.next(); @@ -375,10 +371,6 @@ impl Token { } return Ok((1, Token::Assign)); } - Some('@') => { - input.next(); - return Ok((1, Token::At)); - } Some('[') => { input.next(); return Ok((1, Token::LeftSquare)); diff --git a/compiler/parser/src/tokenizer/mod.rs b/compiler/parser/src/tokenizer/mod.rs index f8d2ba8fd2..db54fe5189 100644 --- a/compiler/parser/src/tokenizer/mod.rs +++ b/compiler/parser/src/tokenizer/mod.rs @@ -177,7 +177,6 @@ mod tests { / /= : - :: ; < <= @@ -185,7 +184,6 @@ mod tests { == > >= - @ [ ] {{ @@ -205,7 +203,7 @@ mod tests { assert_eq!( output, - r#"'a' '😭' "test" "test{}test" "test{}" "{}test" "test{" "test}" "test{test" "test}test" "te{{}}" aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 test_ident 12345 address as bool circuit const else false field for function group i128 i64 i32 i16 i8 if import in input let mut return string test true u128 u64 u32 u16 u8 console ! != && ( ) * ** **= *= + += , - -= -> _ . .. ... / /= : :: ; < <= = == > >= @ [ ] { { } } || ? // test + r#"'a' '😭' "test" "test{}test" "test{}" "{}test" "test{" "test}" "test{test" "test}test" "te{{}}" aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 test_ident 12345 address as bool circuit const else false field for function group i128 i64 i32 i16 i8 if import in input let mut return string test true u128 u64 u32 u16 u8 console ! != && ( ) * ** **= *= + += , - -= -> _ . .. ... / /= : ; < <= = == > >= [ ] { { } } || ? // test /* test */ // "# ); }); diff --git a/compiler/parser/src/tokenizer/token.rs b/compiler/parser/src/tokenizer/token.rs index 2a55f45b32..379d25ba83 100644 --- a/compiler/parser/src/tokenizer/token.rs +++ b/compiler/parser/src/tokenizer/token.rs @@ -61,7 +61,6 @@ pub enum Token { WhiteSpace, // Symbols - At, Not, And, Or, @@ -94,7 +93,6 @@ pub enum Token { DotDotDot, Semicolon, Colon, - DoubleColon, Question, Arrow, Underscore, @@ -188,7 +186,6 @@ impl Token { Some(match self { Token::Address => sym::address, Token::As => sym::As, - Token::At => sym::At, Token::Bool => sym::bool, Token::Char => sym::char, Token::Console => sym::console, @@ -244,8 +241,6 @@ impl fmt::Display for Token { CharLit(s) => write!(f, "'{}'", s), WhiteSpace => write!(f, "whitespace"), - At => write!(f, "@"), - Not => write!(f, "!"), And => write!(f, "&&"), Or => write!(f, "||"), @@ -278,7 +273,6 @@ impl fmt::Display for Token { DotDotDot => write!(f, "..."), Semicolon => write!(f, ";"), Colon => write!(f, ":"), - DoubleColon => write!(f, "::"), Question => write!(f, "?"), Arrow => write!(f, "->"), Underscore => write!(f, "_"), diff --git a/leo/span/src/symbol.rs b/leo/span/src/symbol.rs index 95aa7f36bd..327a40abff 100644 --- a/leo/span/src/symbol.rs +++ b/leo/span/src/symbol.rs @@ -104,7 +104,6 @@ symbols! { array, As: "as", assert, - At: "@", bool, char, Class: "class", diff --git a/tests/expectations/parser/parser/expression/access/array_access.leo.out b/tests/expectations/parser/parser/expression/access/array_access.leo.out index 045d403df6..5d9ff7c8fc 100644 --- a/tests/expectations/parser/parser/expression/access/array_access.leo.out +++ b/tests/expectations/parser/parser/expression/access/array_access.leo.out @@ -215,41 +215,6 @@ outputs: col_stop: 7 path: "" content: "x()[0]" - - Call: - function: - Access: - Static: - inner: - Call: - function: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" - arguments: - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x(y)::y(x)" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x(y)::y(x)" - arguments: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x(y)::y(x)" - Access: Array: array: diff --git a/tests/expectations/parser/parser/expression/access/call.leo.out b/tests/expectations/parser/parser/expression/access/call.leo.out index eb541b94a7..2d5c63438a 100644 --- a/tests/expectations/parser/parser/expression/access/call.leo.out +++ b/tests/expectations/parser/parser/expression/access/call.leo.out @@ -63,53 +63,6 @@ outputs: col_stop: 11 path: "" content: "x(x, y, z)" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x::y()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: "x::y()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x::y(x)" - arguments: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x::y(x)" - Call: function: Access: diff --git a/tests/expectations/parser/parser/expression/literal/access.leo.out b/tests/expectations/parser/parser/expression/literal/access.leo.out index e2dbf60e24..7dcf1796a5 100644 --- a/tests/expectations/parser/parser/expression/literal/access.leo.out +++ b/tests/expectations/parser/parser/expression/literal/access.leo.out @@ -44,29 +44,6 @@ outputs: col_stop: 71 path: "" content: aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8.call() - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"address\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"address::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"address::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "address::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "address::call()" - Value: Implicit: - "" @@ -109,29 +86,6 @@ outputs: col_stop: 12 path: "" content: true.call() - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"bool\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"bool::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"bool::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "bool::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "bool::call()" - Value: Implicit: - "" @@ -175,29 +129,6 @@ outputs: col_stop: 11 path: "" content: "'a'.call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"char\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"char::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"char::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "char::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "char::call()" - Value: Implicit: - "" @@ -240,29 +171,6 @@ outputs: col_stop: 14 path: "" content: 1field.call() - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"field\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"field::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"field::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "field::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "field::call()" - Value: Implicit: - "" @@ -358,29 +266,6 @@ outputs: col_stop: 19 path: "" content: "(0, 1)group.call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"group\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"group::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"group::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "group::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "group::call()" - Value: Implicit: - "" @@ -556,121 +441,6 @@ outputs: col_stop: 13 path: "" content: 1i128.call() - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"i8\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i8::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i8::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "i8::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "i8::call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"i16\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i16::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i16::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "i16::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "i16::call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"i32\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i32::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i32::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "i32::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "i32::call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"i64\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i64::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i64::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "i64::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "i64::call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"i128\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i128::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i128::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "i128::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "i128::call()" - Value: Implicit: - "" @@ -846,118 +616,3 @@ outputs: col_stop: 13 path: "" content: 1u128.call() - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"u8\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u8::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u8::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "u8::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "u8::call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"u16\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u16::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u16::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "u16::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "u16::call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"u32\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u32::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u32::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "u32::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "u32::call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"u64\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u64::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u64::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "u64::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "u64::call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"u128\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u128::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u128::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "u128::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "u128::call()" diff --git a/tests/expectations/parser/parser/expression/token_format.leo.out b/tests/expectations/parser/parser/expression/token_format.leo.out index 6d98d2ca3a..0e8834d1ea 100644 --- a/tests/expectations/parser/parser/expression/token_format.leo.out +++ b/tests/expectations/parser/parser/expression/token_format.leo.out @@ -9,7 +9,7 @@ outputs: - "Error [EPAR0370030]: Could not lex the following content: `~`." - "Error [EPAR0370030]: Could not lex the following content: `~`." - "Error [EPAR0370030]: Could not lex the following content: `~`." - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '@'\n --> test:1:1\n |\n 1 | @test\n | ^" + - "Error [EPAR0370030]: Could not lex the following content: `@test`." - "Error [EPAR0370030]: Could not lex the following content: `~`." - "Error [EPAR0370009]: unexpected string: expected 'expression', got '&&'\n --> test:1:1\n |\n 1 | &&\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '||'\n --> test:1:1\n |\n 1 | ||\n | ^^" @@ -42,7 +42,7 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', got '...'\n --> test:1:1\n |\n 1 | ...\n | ^^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ';'\n --> test:1:1\n |\n 1 | ;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ':'\n --> test:1:1\n |\n 1 | :\n | ^" - - "Error [EPAR0370003]: unexpected EOF\n --> test:1:2\n |\n 1 | h::\n | ^^" + - "did not consume all input: ':' @ 1:2-3\n':' @ 1:3-4\n" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '?'\n --> test:1:1\n |\n 1 | ?\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '->'\n --> test:1:1\n |\n 1 | ->\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '_'\n --> test:1:1\n |\n 1 | _\n | ^" diff --git a/tests/expectations/parser/parser/expression/unary/negate.leo.out b/tests/expectations/parser/parser/expression/unary/negate.leo.out index 7982d0b8f4..c6df1f7d1f 100644 --- a/tests/expectations/parser/parser/expression/unary/negate.leo.out +++ b/tests/expectations/parser/parser/expression/unary/negate.leo.out @@ -36,29 +36,6 @@ outputs: col_stop: 5 path: "" content: "-x.y" - - Unary: - inner: - Access: - Static: - inner: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"-x::y\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"-x::y\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 2 - col_stop: 6 - path: "" - content: "-x::y" - op: Negate - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: "-x::y" - Unary: inner: Call: diff --git a/tests/expectations/parser/parser/expression/unary/not.leo.out b/tests/expectations/parser/parser/expression/unary/not.leo.out index 71716da156..931535a3ff 100644 --- a/tests/expectations/parser/parser/expression/unary/not.leo.out +++ b/tests/expectations/parser/parser/expression/unary/not.leo.out @@ -36,29 +36,6 @@ outputs: col_stop: 5 path: "" content: "!x.y" - - Unary: - inner: - Access: - Static: - inner: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"!x::y\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"!x::y\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 2 - col_stop: 6 - path: "" - content: "!x::y" - op: Not - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: "!x::y" - Unary: inner: Call: diff --git a/tests/expectations/parser/parser/functions/annotated_arg_not_ident.leo.out b/tests/expectations/parser/parser/functions/annotated_arg_not_ident.leo.out index cffae59c8f..090eba8942 100644 --- a/tests/expectations/parser/parser/functions/annotated_arg_not_ident.leo.out +++ b/tests/expectations/parser/parser/functions/annotated_arg_not_ident.leo.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '?'\n --> test:3:6\n |\n 3 | @foo(?, bar, ?)\n | ^\nError [EPAR0370009]: unexpected string: expected 'ident', got '?'\n --> test:3:14\n |\n 3 | @foo(?, bar, ?)\n | ^\nError [EPAR0370009]: unexpected string: expected 'ident', got '123'\n --> test:8:6\n |\n 8 | @bar(123) // ints not vali\n | ^^^\nError [EPAR0370016]: \"@context(...)\" is deprecated. Did you mean @test annotation?\n --> test:14:2\n |\n 14 | @context // recovery witness\n | ^^^^^^^" + - "Error [EPAR0370030]: Could not lex the following content: `@foo(?, bar, ?)\nfunction x() {\n return ();\n}\n\n@bar(123) // ints not vali\nfunction x() {\n return ();\n}\n\n\n@context // recovery witness\nfunction x() {\n return ();\n}\n`." diff --git a/tests/expectations/parser/parser/functions/annotated_context_fail.leo.out b/tests/expectations/parser/parser/functions/annotated_context_fail.leo.out index 6366839d98..96ece07b38 100644 --- a/tests/expectations/parser/parser/functions/annotated_context_fail.leo.out +++ b/tests/expectations/parser/parser/functions/annotated_context_fail.leo.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370016]: \"@context(...)\" is deprecated. Did you mean @test annotation?\n --> test:3:2\n |\n 3 | @context\n | ^^^^^^^\nError [EPAR0370016]: \"@context(...)\" is deprecated. Did you mean @test annotation?\n --> test:8:2\n |\n 8 | @context // recovery witness\n | ^^^^^^^" + - "Error [EPAR0370030]: Could not lex the following content: `@context\nfunction f() {\n return ();\n}\n\n@context // recovery witness\nfunction g() {\n return ();\n}\n`." diff --git a/tests/expectations/parser/parser/functions/bounded_recursion.leo.out b/tests/expectations/parser/parser/functions/bounded_recursion.leo.out index 29e37d5e8b..c89bd4c82f 100644 --- a/tests/expectations/parser/parser/functions/bounded_recursion.leo.out +++ b/tests/expectations/parser/parser/functions/bounded_recursion.leo.out @@ -10,7 +10,6 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const y: u32) {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const y: u32) {\\\"}\"}" input: - Variable: @@ -130,7 +129,6 @@ outputs: path: "" content: "function x(const y: u32) {\n ...\n ...\n ...\n}" "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}" input: - Variable: diff --git a/tests/expectations/parser/parser/functions/const_function.leo.out b/tests/expectations/parser/parser/functions/const_function.leo.out index a29203f1ff..1adcf337ab 100644 --- a/tests/expectations/parser/parser/functions/const_function.leo.out +++ b/tests/expectations/parser/parser/functions/const_function.leo.out @@ -10,7 +10,6 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const function x() {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const function x() {\\\"}\"}" input: [] const_: true diff --git a/tests/expectations/parser/parser/functions/const_param.leo.out b/tests/expectations/parser/parser/functions/const_param.leo.out index 06bde16c15..3e5a911c61 100644 --- a/tests/expectations/parser/parser/functions/const_param.leo.out +++ b/tests/expectations/parser/parser/functions/const_param.leo.out @@ -10,7 +10,6 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}" input: - Variable: @@ -77,7 +76,6 @@ outputs: path: "" content: "function x(x: u32, const y: i32) {\n ...\n}" "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}" input: - Variable: diff --git a/tests/expectations/parser/parser/functions/empty.leo.out b/tests/expectations/parser/parser/functions/empty.leo.out index b1377721e3..cc19481847 100644 --- a/tests/expectations/parser/parser/functions/empty.leo.out +++ b/tests/expectations/parser/parser/functions/empty.leo.out @@ -10,7 +10,6 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}" input: [] const_: false diff --git a/tests/expectations/parser/parser/functions/empty2.leo.out b/tests/expectations/parser/parser/functions/empty2.leo.out index 21fff75dc8..318fadee3c 100644 --- a/tests/expectations/parser/parser/functions/empty2.leo.out +++ b/tests/expectations/parser/parser/functions/empty2.leo.out @@ -10,7 +10,6 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {}\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {}\\\"}\"}" input: [] const_: false diff --git a/tests/expectations/parser/parser/functions/ident_token_fail.leo.out b/tests/expectations/parser/parser/functions/ident_token_fail.leo.out index 852785e684..3649ecdf35 100644 --- a/tests/expectations/parser/parser/functions/ident_token_fail.leo.out +++ b/tests/expectations/parser/parser/functions/ident_token_fail.leo.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370005]: expected 'import', 'function', 'test', '@' -- got '1'\n --> test:3:1\n |\n 3 | 1 main() {}\n | ^" + - "Error [EPAR0370005]: expected 'import', 'function', 'test' -- got '1'\n --> test:3:1\n |\n 3 | 1 main() {}\n | ^" diff --git a/tests/expectations/parser/parser/functions/infinite_recursion.leo.out b/tests/expectations/parser/parser/functions/infinite_recursion.leo.out index 06c062dbdf..ef2916405a 100644 --- a/tests/expectations/parser/parser/functions/infinite_recursion.leo.out +++ b/tests/expectations/parser/parser/functions/infinite_recursion.leo.out @@ -10,7 +10,6 @@ outputs: global_consts: {} functions: "{\"name\":\"inf\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function inf() {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"inf\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function inf() {\\\"}\"}" input: [] const_: false @@ -53,7 +52,6 @@ outputs: path: "" content: "function inf() {\n ...\n}" "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}" input: - Variable: diff --git a/tests/expectations/parser/parser/functions/param_array.leo.out b/tests/expectations/parser/parser/functions/param_array.leo.out index 6681aa1ab2..e0b27ae7a2 100644 --- a/tests/expectations/parser/parser/functions/param_array.leo.out +++ b/tests/expectations/parser/parser/functions/param_array.leo.out @@ -10,7 +10,6 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: [u8; 12]) {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: [u8; 12]) {\\\"}\"}" input: - Variable: diff --git a/tests/expectations/parser/parser/functions/param_circuit.leo.out b/tests/expectations/parser/parser/functions/param_circuit.leo.out index 22f1bc1f29..d05ebf1548 100644 --- a/tests/expectations/parser/parser/functions/param_circuit.leo.out +++ b/tests/expectations/parser/parser/functions/param_circuit.leo.out @@ -10,7 +10,6 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}" input: - Variable: diff --git a/tests/expectations/parser/parser/functions/param_tuple.leo.out b/tests/expectations/parser/parser/functions/param_tuple.leo.out index 93311a128b..8ec5af6d18 100644 --- a/tests/expectations/parser/parser/functions/param_tuple.leo.out +++ b/tests/expectations/parser/parser/functions/param_tuple.leo.out @@ -10,7 +10,6 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: (u32, i32)) {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: (u32, i32)) {\\\"}\"}" input: - Variable: diff --git a/tests/expectations/parser/parser/functions/params.leo.out b/tests/expectations/parser/parser/functions/params.leo.out index 3eb05d0eac..9ffdb9ba90 100644 --- a/tests/expectations/parser/parser/functions/params.leo.out +++ b/tests/expectations/parser/parser/functions/params.leo.out @@ -10,7 +10,6 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}" input: - Variable: diff --git a/tests/expectations/parser/parser/functions/params_return.leo.out b/tests/expectations/parser/parser/functions/params_return.leo.out index 42aa28f386..086a92234d 100644 --- a/tests/expectations/parser/parser/functions/params_return.leo.out +++ b/tests/expectations/parser/parser/functions/params_return.leo.out @@ -10,7 +10,6 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}" input: - Variable: diff --git a/tests/expectations/parser/parser/functions/return.leo.out b/tests/expectations/parser/parser/functions/return.leo.out index 3e0dff001d..237123e0d1 100644 --- a/tests/expectations/parser/parser/functions/return.leo.out +++ b/tests/expectations/parser/parser/functions/return.leo.out @@ -10,7 +10,6 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> u32 {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> u32 {\\\"}\"}" input: [] const_: false diff --git a/tests/expectations/parser/parser/functions/return_tuple.leo.out b/tests/expectations/parser/parser/functions/return_tuple.leo.out index 56a407e818..665104825a 100644 --- a/tests/expectations/parser/parser/functions/return_tuple.leo.out +++ b/tests/expectations/parser/parser/functions/return_tuple.leo.out @@ -10,7 +10,6 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> (u32, u32) {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> (u32, u32) {\\\"}\"}" input: [] const_: false diff --git a/tests/expectations/parser/parser/serialize/one_plus_one.leo.out b/tests/expectations/parser/parser/serialize/one_plus_one.leo.out index 8934f00294..a820cd1997 100644 --- a/tests/expectations/parser/parser/serialize/one_plus_one.leo.out +++ b/tests/expectations/parser/parser/serialize/one_plus_one.leo.out @@ -10,7 +10,6 @@ outputs: global_consts: {} functions: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() -> u8 {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() -> u8 {\\\"}\"}" input: [] const_: false diff --git a/tests/expectations/parser/parser/serialize/palindrome.leo.out b/tests/expectations/parser/parser/serialize/palindrome.leo.out index 596c4a853d..2d21cc251e 100644 --- a/tests/expectations/parser/parser/serialize/palindrome.leo.out +++ b/tests/expectations/parser/parser/serialize/palindrome.leo.out @@ -10,7 +10,6 @@ outputs: global_consts: {} functions: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(str: [char; 20]) -> bool {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(str: [char; 20]) -> bool {\\\"}\"}" input: - Variable: @@ -34,7 +33,6 @@ outputs: arguments: - Identifier: "{\"name\":\"str\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":26,\\\"col_stop\\\":29,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return is_palindrome(str);\\\"}\"}" "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":10,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function is_palindrome(str: [char; 20]) -> bool {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":10,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function is_palindrome(str: [char; 20]) -> bool {\\\"}\"}" input: - Variable: @@ -365,12 +363,8 @@ outputs: - Return: expression: Identifier: "{\"name\":\"result\",\"span\":\"{\\\"line_start\\\":50,\\\"line_stop\\\":50,\\\"col_start\\\":12,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return result;\\\"}\"}" - "{\"name\":\"test_is_palindrome\",\"span\":\"{\\\"line_start\\\":54,\\\"line_stop\\\":54,\\\"col_start\\\":10,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function test_is_palindrome() {\\\"}\"}": - annotations: - test: - arguments: [] - name: "{\"name\":\"test\",\"span\":\"{\\\"line_start\\\":53,\\\"line_stop\\\":53,\\\"col_start\\\":2,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"@test\\\"}\"}" - identifier: "{\"name\":\"test_is_palindrome\",\"span\":\"{\\\"line_start\\\":54,\\\"line_stop\\\":54,\\\"col_start\\\":10,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function test_is_palindrome() {\\\"}\"}" + "{\"name\":\"test_is_palindrome\",\"span\":\"{\\\"line_start\\\":53,\\\"line_stop\\\":53,\\\"col_start\\\":10,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function test_is_palindrome() {\\\"}\"}": + identifier: "{\"name\":\"test_is_palindrome\",\"span\":\"{\\\"line_start\\\":53,\\\"line_stop\\\":53,\\\"col_start\\\":10,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function test_is_palindrome() {\\\"}\"}" input: [] const_: false output: ~ @@ -382,7 +376,7 @@ outputs: Assert: Call: function: - Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":55,\\\"line_stop\\\":55,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"a b a \\\\\\\"));\\\"}\"}" + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":54,\\\"line_stop\\\":54,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"a b a \\\\\\\"));\\\"}\"}" arguments: - Value: String: @@ -411,7 +405,7 @@ outputs: Assert: Call: function: - Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":56,\\\"line_stop\\\":56,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"😀😀😀😀😀 😀😀😀😀😀\\\\\\\"));\\\"}\"}" + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":55,\\\"line_stop\\\":55,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"😀😀😀😀😀 😀😀😀😀😀\\\\\\\"));\\\"}\"}" arguments: - Value: String: @@ -440,7 +434,7 @@ outputs: Assert: Call: function: - Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":57,\\\"line_stop\\\":57,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"borrow or rob \\\\\\\"));\\\"}\"}" + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":56,\\\"line_stop\\\":56,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"borrow or rob \\\\\\\"));\\\"}\"}" arguments: - Value: String: @@ -469,7 +463,7 @@ outputs: Assert: Call: function: - Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":58,\\\"line_stop\\\":58,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"bbbb aaaa aaaa bbbb\\\\\\\"));\\\"}\"}" + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":57,\\\"line_stop\\\":57,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"bbbb aaaa aaaa bbbb\\\\\\\"));\\\"}\"}" arguments: - Value: String: @@ -498,7 +492,7 @@ outputs: Assert: Call: function: - Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":59,\\\"line_stop\\\":59,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"aaaaaaaaaaaaaaaaaaaa\\\\\\\"));\\\"}\"}" + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":58,\\\"line_stop\\\":58,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"aaaaaaaaaaaaaaaaaaaa\\\\\\\"));\\\"}\"}" arguments: - Value: String: @@ -527,7 +521,7 @@ outputs: Assert: Call: function: - Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":60,\\\"line_stop\\\":60,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"taco cat \\\\\\\"));\\\"}\"}" + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":59,\\\"line_stop\\\":59,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"taco cat \\\\\\\"));\\\"}\"}" arguments: - Value: String: diff --git a/tests/expectations/parser/parser/serialize/parser_error.leo.out b/tests/expectations/parser/parser/serialize/parser_error.leo.out index b36aa774bc..6dcccb2d2f 100644 --- a/tests/expectations/parser/parser/serialize/parser_error.leo.out +++ b/tests/expectations/parser/parser/serialize/parser_error.leo.out @@ -2,4 +2,4 @@ namespace: Serialize expectation: Fail outputs: - - "Error [EPAR0370005]: expected 'import', 'function', 'test', '@' -- got 'invalid'\n --> test:3:1\n |\n 3 | invalid\n | ^^^^^^^" + - "Error [EPAR0370005]: expected 'import', 'function', 'test' -- got 'invalid'\n --> test:3:1\n |\n 3 | invalid\n | ^^^^^^^" diff --git a/tests/expectations/parser/parser/statement/assign_fail.leo.out b/tests/expectations/parser/parser/statement/assign_fail.leo.out index 2378aa7e90..040454f134 100644 --- a/tests/expectations/parser/parser/statement/assign_fail.leo.out +++ b/tests/expectations/parser/parser/statement/assign_fail.leo.out @@ -2,7 +2,7 @@ namespace: ParseStatement expectation: Fail outputs: - - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x::y = y;\n | ^^^^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::y = y;\n | ^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | 5 = y;\n | ^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x + x = y;\n | ^^^^^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | -x = y;\n | ^^" diff --git a/tests/expectations/parser/parser/unreachable/define.leo.out b/tests/expectations/parser/parser/unreachable/define.leo.out index d7699d0ea4..28c899302b 100644 --- a/tests/expectations/parser/parser/unreachable/define.leo.out +++ b/tests/expectations/parser/parser/unreachable/define.leo.out @@ -13,7 +13,7 @@ outputs: - "Error [EPAR0370005]: expected ) -- got '='\n --> test:1:5\n |\n 1 | ( x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ')'\n --> test:1:1\n |\n 1 | ) x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ':'\n --> test:1:1\n |\n 1 | : x = 10u8;\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '::'\n --> test:1:1\n |\n 1 | :: x = 10u8;\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got ':'\n --> test:1:1\n |\n 1 | :: x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '?'\n --> test:1:1\n |\n 1 | ? x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '_'\n --> test:1:1\n |\n 1 | _ x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:1\n |\n 1 | = x = 10u8;\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/expect_ident.leo.out b/tests/expectations/parser/parser/unreachable/expect_ident.leo.out index e98fc9fdc4..8041c9b1fd 100644 --- a/tests/expectations/parser/parser/unreachable/expect_ident.leo.out +++ b/tests/expectations/parser/parser/unreachable/expect_ident.leo.out @@ -2,55 +2,55 @@ namespace: ParseStatement expectation: Fail outputs: - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ';'\n --> test:1:4\n |\n 1 | x::;\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '.'\n --> test:1:4\n |\n 1 | x::.\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'import'\n --> test:1:4\n |\n 1 | x::import\n | ^^^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x::,\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '*'\n --> test:1:4\n |\n 1 | x::*\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '+'\n --> test:1:4\n |\n 1 | x::+\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '-'\n --> test:1:4\n |\n 1 | x::-\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '/'\n --> test:1:4\n |\n 1 | x::/\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '['\n --> test:1:4\n |\n 1 | x::[\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ']'\n --> test:1:4\n |\n 1 | x::]\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '{'\n --> test:1:4\n |\n 1 | x::{\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '}'\n --> test:1:4\n |\n 1 | x::}\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '('\n --> test:1:4\n |\n 1 | x::(\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ')'\n --> test:1:4\n |\n 1 | x::)\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ':'\n --> test:1:4\n |\n 1 | x:::\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '::'\n --> test:1:4\n |\n 1 | x::::\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '?'\n --> test:1:4\n |\n 1 | x::?\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '_'\n --> test:1:4\n |\n 1 | x::_\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '='\n --> test:1:4\n |\n 1 | x::=\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '=='\n --> test:1:4\n |\n 1 | x::==\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '!'\n --> test:1:4\n |\n 1 | x::!\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '!='\n --> test:1:4\n |\n 1 | x::!=\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '>'\n --> test:1:4\n |\n 1 | x::>\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '>='\n --> test:1:4\n |\n 1 | x::>=\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '<'\n --> test:1:4\n |\n 1 | x::<\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '<='\n --> test:1:4\n |\n 1 | x::<=\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '>'\n --> test:1:4\n |\n 1 | x::>\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '..'\n --> test:1:4\n |\n 1 | x::..\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'as'\n --> test:1:4\n |\n 1 | x::as\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'console'\n --> test:1:4\n |\n 1 | x::console\n | ^^^^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'const'\n --> test:1:4\n |\n 1 | x::const\n | ^^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'let'\n --> test:1:4\n |\n 1 | x::let\n | ^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'for'\n --> test:1:4\n |\n 1 | x::for\n | ^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'if'\n --> test:1:4\n |\n 1 | x::if\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'else'\n --> test:1:4\n |\n 1 | x::else\n | ^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'i8'\n --> test:1:4\n |\n 1 | x::i8\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'i16'\n --> test:1:4\n |\n 1 | x::i16\n | ^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'i32'\n --> test:1:4\n |\n 1 | x::i32\n | ^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'i64'\n --> test:1:4\n |\n 1 | x::i64\n | ^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'i128'\n --> test:1:4\n |\n 1 | x::i128\n | ^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'u8'\n --> test:1:4\n |\n 1 | x::u8\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'u16'\n --> test:1:4\n |\n 1 | x::u16\n | ^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'u32'\n --> test:1:4\n |\n 1 | x::u32\n | ^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'u64'\n --> test:1:4\n |\n 1 | x::u64\n | ^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'u128'\n --> test:1:4\n |\n 1 | x::u128\n | ^^^^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::;\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::.\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::import\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::,\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::*\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::+\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::-\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::/\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::[\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::]\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::{\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::}\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::(\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::)\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x:::\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::::\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::?\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::_\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::=\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::==\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::!\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::!=\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::>\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::>=\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::<\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::<=\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::>\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::..\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::as\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::console\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::const\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::let\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::for\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::if\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::else\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::i8\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::i16\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::i32\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::i64\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::i128\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::u8\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::u16\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::u32\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::u64\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::u128\n | ^" - "Error [EPAR0370023]: Expected more characters to lex but found none." - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'return'\n --> test:1:4\n |\n 1 | x::return\n | ^^^^^^" - - "Error [EPAR0370003]: unexpected EOF\n --> test:1:4\n |\n 1 | x::self\n | ^^^^" - - "Error [EPAR0370003]: unexpected EOF\n --> test:1:4\n |\n 1 | x::Self\n | ^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'true'\n --> test:1:4\n |\n 1 | x::true\n | ^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'false'\n --> test:1:4\n |\n 1 | x::false\n | ^^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '0'\n --> test:1:4\n |\n 1 | x::0\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::return\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::self\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::Self\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::true\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::false\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::0\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out b/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out index a8bcac1e72..a08b9f50ff 100644 --- a/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out +++ b/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out @@ -50,7 +50,7 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', got ';'\n --> test:1:4\n |\n 1 | x=(;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ')'\n --> test:1:3\n |\n 1 | x=);\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ':'\n --> test:1:3\n |\n 1 | x=:;\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '::'\n --> test:1:3\n |\n 1 | x=::;\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got ':'\n --> test:1:3\n |\n 1 | x=::;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:3\n |\n 1 | x?=b;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:4\n |\n 1 | x!==b;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:4\n |\n 1 | x>==b;\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out b/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out index 051886207a..85543d14e1 100644 --- a/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out +++ b/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out @@ -36,40 +36,6 @@ outputs: col_stop: 14 path: "" content: let x = a . b; - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = a :: b;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "let x = a :: b;" - type_: ~ - value: - Access: - Static: - inner: - Identifier: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = a :: b;\\\"}\"}" - name: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = a :: b;\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 15 - path: "" - content: "let x = a :: b;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "let x = a :: b;" - Definition: declaration_type: Let variable_names: diff --git a/tests/parser/expression/access/array_access.leo b/tests/parser/expression/access/array_access.leo index 14d2393afd..85b00b31dd 100644 --- a/tests/parser/expression/access/array_access.leo +++ b/tests/parser/expression/access/array_access.leo @@ -10,5 +10,4 @@ x[1u8][2u8] x[x][y][z] x[0]() x()[0] -x(y)::y(x) x[x].0[x] \ No newline at end of file diff --git a/tests/parser/expression/access/call.leo b/tests/parser/expression/access/call.leo index 3a59b7585b..b800b3842b 100644 --- a/tests/parser/expression/access/call.leo +++ b/tests/parser/expression/access/call.leo @@ -8,7 +8,5 @@ X() x(y) x(y, z) x(x, y, z) -x::y() -x::y(x) x.0(x) x[0](x) diff --git a/tests/parser/expression/access/circuit_static.leo b/tests/parser/expression/access/circuit_static.leo deleted file mode 100644 index cc9793c510..0000000000 --- a/tests/parser/expression/access/circuit_static.leo +++ /dev/null @@ -1,11 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -x::y -X::Y -x::y::z -x::y() -x::y.0 -x::y[1] \ No newline at end of file diff --git a/tests/parser/expression/literal/access.leo b/tests/parser/expression/literal/access.leo index bb30728808..905661ff3c 100644 --- a/tests/parser/expression/literal/access.leo +++ b/tests/parser/expression/literal/access.leo @@ -5,24 +5,19 @@ expectation: Pass // address aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8.call() -address::call() // bool true.call() -bool::call() // char 'a'.call() -char::call() // field 1field.call() -field::call() //group 0group.call() (0, 1)group.call() -group::call() // ints 1i8.call() @@ -31,21 +26,9 @@ group::call() 1i64.call() 1i128.call() -i8::call() -i16::call() -i32::call() -i64::call() -i128::call() - // uints 1u8.call() 1u16.call() 1u32.call() 1u64.call() -1u128.call() - -u8::call() -u16::call() -u32::call() -u64::call() -u128::call() \ No newline at end of file +1u128.call() \ No newline at end of file diff --git a/tests/parser/expression/unary/negate.leo b/tests/parser/expression/unary/negate.leo index 035a0c3c26..1dc70ba2ed 100644 --- a/tests/parser/expression/unary/negate.leo +++ b/tests/parser/expression/unary/negate.leo @@ -5,7 +5,6 @@ expectation: Pass -x -x.y --x::y -x() --x -!x diff --git a/tests/parser/expression/unary/not.leo b/tests/parser/expression/unary/not.leo index 5ad9c3b5d3..998459f4e2 100644 --- a/tests/parser/expression/unary/not.leo +++ b/tests/parser/expression/unary/not.leo @@ -5,7 +5,6 @@ expectation: Pass !x !x.y -!x::y !x() !!x !-x \ No newline at end of file diff --git a/tests/parser/functions/annotated.leo b/tests/parser/functions/annotated.leo deleted file mode 100644 index 56568b959a..0000000000 --- a/tests/parser/functions/annotated.leo +++ /dev/null @@ -1,24 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -@test -function a() { - return (); -} - -@test(test) -function b() { - return (); -} - -@test(test,) -function c() { - return (); -} - -@test() -function d() { - return (); -} diff --git a/tests/parser/functions/annotated_param.leo b/tests/parser/functions/annotated_param.leo deleted file mode 100644 index 65a16b3894..0000000000 --- a/tests/parser/functions/annotated_param.leo +++ /dev/null @@ -1,9 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -@test(test) -function x() { - return (); -} \ No newline at end of file diff --git a/tests/parser/functions/annotated_twice.leo b/tests/parser/functions/annotated_twice.leo deleted file mode 100644 index b969c4df35..0000000000 --- a/tests/parser/functions/annotated_twice.leo +++ /dev/null @@ -1,9 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -@test @test2 -function x() { - return (); -} \ No newline at end of file diff --git a/tests/parser/serialize/palindrome.leo b/tests/parser/serialize/palindrome.leo index ebc9bb7e11..6825d668c5 100644 --- a/tests/parser/serialize/palindrome.leo +++ b/tests/parser/serialize/palindrome.leo @@ -53,7 +53,6 @@ function is_palindrome(str: [char; 20]) -> bool { return result; } -@test function test_is_palindrome() { console.assert(is_palindrome("a b a ")); console.assert(is_palindrome("😀😀😀😀😀 😀😀😀😀😀")); diff --git a/tests/parser/unreachable/math_op_pass.leo b/tests/parser/unreachable/math_op_pass.leo index e1cc3051c8..85e876788e 100644 --- a/tests/parser/unreachable/math_op_pass.leo +++ b/tests/parser/unreachable/math_op_pass.leo @@ -5,8 +5,6 @@ expectation: Pass let x = a . b; -let x = a :: b; - let x = a == b; let x = a != b; From ef4b3787a999dbc38814b9bb870f68c1d066db76 Mon Sep 17 00:00:00 2001 From: gluax <16431709+gluax@users.noreply.github.com> Date: Mon, 28 Mar 2022 07:31:53 -0700 Subject: [PATCH 06/10] remove arrays --- compiler/ast/src/accesses/array_access.rs | 49 - .../ast/src/accesses/array_range_access.rs | 59 - compiler/ast/src/accesses/mod.rs | 6 - compiler/ast/src/common/array_dimensions.rs | 86 - compiler/ast/src/common/mod.rs | 6 - .../ast/src/common/spread_or_expression.rs | 55 - compiler/ast/src/expression/accesses.rs | 10 - compiler/ast/src/expression/array_init.rs | 48 - compiler/ast/src/expression/array_inline.rs | 51 - compiler/ast/src/expression/mod.rs | 17 +- compiler/ast/src/input/input_value.rs | 71 +- .../src/reducer/reconstructing_director.rs | 54 - .../ast/src/reducer/reconstructing_reducer.rs | 51 - compiler/ast/src/types/type_.rs | 46 +- compiler/parser/src/parser/expression.rs | 116 +- compiler/parser/src/parser/statement.rs | 11 - compiler/parser/src/parser/type_.rs | 35 +- compiler/parser/src/tokenizer/lexer.rs | 6 +- compiler/parser/src/tokenizer/mod.rs | 3 +- compiler/parser/src/tokenizer/token.rs | 2 - .../parser/expression/access/call.leo.out | 33 - .../parser/expression/access/circuit.leo.out | 34 - .../parser/expression/array_init_fail.leo.out | 8 +- .../expression/array_inline_fail.leo.out | 10 +- .../parser/expression/token_format.leo.out | 4 +- .../parser/inputs/input_success.leo.out | 421 +-- .../parser/parser/statement/alias.leo.out | 13 - .../parser/parser/statement/assign.leo.out | 2484 ----------------- .../parser/statement/assign_fail.leo.out | 4 +- .../parser/statement/definition.leo.out | 197 -- .../parser/statement/definition_fail.leo.out | 12 +- .../parser/statement/expression_fail.leo.out | 4 +- .../parser/parser/unreachable/define.leo.out | 2 +- .../parser/unreachable/math_op_fail.leo.out | 4 +- .../parser/unreachable/postfix_fail.leo.out | 2 +- .../parser/expression/access/array_access.leo | 13 - .../expression/access/array_range_access.leo | 22 - tests/parser/expression/access/call.leo | 1 - tests/parser/expression/access/circuit.leo | 3 +- tests/parser/expression/array_init.leo | 16 - tests/parser/expression/array_inline.leo | 24 - tests/parser/expression/array_len.leo | 14 - tests/parser/functions/param_array.leo | 8 - tests/parser/functions/param_circuit.leo | 8 - tests/parser/inputs/input_success.leo | 6 - tests/parser/serialize/palindrome.leo | 63 - tests/parser/statement/alias.leo | 2 - tests/parser/statement/assign.leo | 112 - tests/parser/statement/definition.leo | 5 - 49 files changed, 122 insertions(+), 4189 deletions(-) delete mode 100644 compiler/ast/src/accesses/array_access.rs delete mode 100644 compiler/ast/src/accesses/array_range_access.rs delete mode 100644 compiler/ast/src/common/array_dimensions.rs delete mode 100644 compiler/ast/src/common/spread_or_expression.rs delete mode 100644 compiler/ast/src/expression/array_init.rs delete mode 100644 compiler/ast/src/expression/array_inline.rs delete mode 100644 tests/parser/expression/access/array_access.leo delete mode 100644 tests/parser/expression/access/array_range_access.leo delete mode 100644 tests/parser/expression/array_init.leo delete mode 100644 tests/parser/expression/array_inline.leo delete mode 100644 tests/parser/expression/array_len.leo delete mode 100644 tests/parser/functions/param_array.leo delete mode 100644 tests/parser/functions/param_circuit.leo delete mode 100644 tests/parser/serialize/palindrome.leo diff --git a/compiler/ast/src/accesses/array_access.rs b/compiler/ast/src/accesses/array_access.rs deleted file mode 100644 index d457a9d4c4..0000000000 --- a/compiler/ast/src/accesses/array_access.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{Expression, Node}; -use leo_span::Span; - -use std::fmt; - -use serde::{Deserialize, Serialize}; - -/// An array element access expression `array[index]`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct ArrayAccess { - /// The expression, evaluating to an array, that is being indexed. - pub array: Box, - /// The index in `array` that is being accessed. - pub index: Box, - /// The span of the entire expression `array[index]`. - pub span: Span, -} - -impl fmt::Display for ArrayAccess { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}[{}]", self.array, self.index) - } -} - -impl Node for ArrayAccess { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/accesses/array_range_access.rs b/compiler/ast/src/accesses/array_range_access.rs deleted file mode 100644 index 57ce79798d..0000000000 --- a/compiler/ast/src/accesses/array_range_access.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{Expression, Node}; -use leo_span::Span; - -use std::fmt; - -use serde::{Deserialize, Serialize}; - -/// An access to a certain range of elements in an `array`. -/// -/// Examples include `array[0..3]`, `array[3..]`, `array[..3]`, and `array[..]`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct ArrayRangeAccess { - /// The array to extract a range of elements from. - pub array: Box, - /// The lower bound of the index-range, or the start of the array when `None`. - pub left: Option>, - /// The higher bound of the index-range, or the end of the array when `None`. - pub right: Option>, - /// A span for the entire expression `array[]`. - pub span: Span, -} - -impl fmt::Display for ArrayRangeAccess { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!( - f, - "{}[{}..{}]", - self.array, - self.left.as_ref().map(|e| e.to_string()).unwrap_or_default(), - self.right.as_ref().map(|e| e.to_string()).unwrap_or_default() - ) - } -} - -impl Node for ArrayRangeAccess { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/accesses/mod.rs b/compiler/ast/src/accesses/mod.rs index 7a929de55f..e77b30956f 100644 --- a/compiler/ast/src/accesses/mod.rs +++ b/compiler/ast/src/accesses/mod.rs @@ -14,12 +14,6 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -mod array_access; -pub use array_access::*; - -mod array_range_access; -pub use array_range_access::*; - mod member_access; pub use member_access::*; diff --git a/compiler/ast/src/common/array_dimensions.rs b/compiler/ast/src/common/array_dimensions.rs deleted file mode 100644 index af5f879930..0000000000 --- a/compiler/ast/src/common/array_dimensions.rs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::PositiveNumber; - -use serde::{ser::SerializeSeq, Deserialize, Serialize, Serializer}; -use smallvec::{smallvec, SmallVec}; -use std::{fmt, ops::Deref}; - -/// Specifies array dimensions for array [`Type`]s or in array initializer [`Expression`]s. -#[derive(Clone, Deserialize, Debug, PartialEq, Eq, Hash)] -pub struct ArrayDimensions(pub SmallVec<[PositiveNumber; 1]>); - -impl Deref for ArrayDimensions { - type Target = [PositiveNumber]; - - fn deref(&self) -> &Self::Target { - &*self.0 - } -} - -impl ArrayDimensions { - /// Returns a single-dimensional array dimension. - pub fn single(dim: PositiveNumber) -> Self { - Self(smallvec![dim]) - } - - /// Returns `true` if there is an array dimension equal to zero. - pub fn is_zero(&self) -> bool { - self.iter().any(|d| d.is_zero()) - } - - /// Attempts to remove the first dimension from the array, or returns `None` if it doesn't. - pub fn remove_first(&mut self) -> Option { - if self.is_empty() { - None - } else { - Some(self.0.remove(0)) - } - } - - /// Attempts to remove the last dimension from the array, or returns `None` if it doesn't. - pub fn remove_last(&mut self) -> Option { - self.0.pop() - } -} - -/// Custom Serializer for ArrayDimensions is required to ignore internal ArrayDimension nodes in the AST. -impl Serialize for ArrayDimensions { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - let mut seq = serializer.serialize_seq(Some(self.0.len()))?; - for dim in self.0.iter() { - seq.serialize_element(&dim)?; - } - seq.end() - } -} - -impl fmt::Display for ArrayDimensions { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match &*self.0 { - [dim] => write!(f, "{}", dim), - dimensions => write!( - f, - "({})", - dimensions.iter().map(|x| x.to_string()).collect::>().join(", ") - ), - } - } -} diff --git a/compiler/ast/src/common/mod.rs b/compiler/ast/src/common/mod.rs index a0fba04975..e53ff1a1af 100644 --- a/compiler/ast/src/common/mod.rs +++ b/compiler/ast/src/common/mod.rs @@ -14,9 +14,6 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -pub mod array_dimensions; -pub use array_dimensions::*; - pub mod global_consts_json; pub mod identifier; @@ -28,7 +25,4 @@ pub use imported_modules::*; pub mod positive_number; pub use positive_number::*; -pub mod spread_or_expression; -pub use spread_or_expression::*; - pub mod vec_tendril_json; diff --git a/compiler/ast/src/common/spread_or_expression.rs b/compiler/ast/src/common/spread_or_expression.rs deleted file mode 100644 index fa6d6d9c1b..0000000000 --- a/compiler/ast/src/common/spread_or_expression.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{Expression, Node}; -use leo_span::Span; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -/// Either a spread expression or a normal expression. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum SpreadOrExpression { - /// A spread expression, i.e., `...other_array`. - Spread(Expression), - /// A normal element expression. - Expression(Expression), -} - -impl fmt::Display for SpreadOrExpression { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - SpreadOrExpression::Spread(ref spread) => write!(f, "...{}", spread), - SpreadOrExpression::Expression(ref expression) => write!(f, "{}", expression), - } - } -} - -impl Node for SpreadOrExpression { - fn span(&self) -> &Span { - use SpreadOrExpression::*; - match self { - Spread(expression) | Expression(expression) => expression.span(), - } - } - - fn set_span(&mut self, span: Span) { - use SpreadOrExpression::*; - match self { - Spread(expression) | Expression(expression) => expression.set_span(span), - } - } -} diff --git a/compiler/ast/src/expression/accesses.rs b/compiler/ast/src/expression/accesses.rs index 8d96545bd7..974421b256 100644 --- a/compiler/ast/src/expression/accesses.rs +++ b/compiler/ast/src/expression/accesses.rs @@ -20,10 +20,6 @@ use crate::accesses::*; /// An access expressions, extracting a smaller part out of a whole. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub enum AccessExpression { - /// An `array[index]` expression. - Array(ArrayAccess), - /// An expression accessing a range of an array. - ArrayRange(ArrayRangeAccess), /// An expression accessing a field in a structure, e.g., `circuit_var.field`. Member(MemberAccess), /// Access to a tuple field using its position, e.g., `tuple.1`. @@ -35,8 +31,6 @@ impl fmt::Display for AccessExpression { use AccessExpression::*; match self { - Array(access) => access.fmt(f), - ArrayRange(access) => access.fmt(f), Member(access) => access.fmt(f), Tuple(access) => access.fmt(f), } @@ -48,8 +42,6 @@ impl Node for AccessExpression { use AccessExpression::*; match &self { - Array(access) => access.span(), - ArrayRange(access) => access.span(), Member(access) => access.span(), Tuple(access) => access.span(), } @@ -59,8 +51,6 @@ impl Node for AccessExpression { use AccessExpression::*; match self { - Array(access) => access.set_span(span), - ArrayRange(access) => access.set_span(span), Member(access) => access.set_span(span), Tuple(access) => access.set_span(span), } diff --git a/compiler/ast/src/expression/array_init.rs b/compiler/ast/src/expression/array_init.rs deleted file mode 100644 index 357559ff8b..0000000000 --- a/compiler/ast/src/expression/array_init.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use super::*; - -/// An array initializer expression, e.g., `[42; 5]`. -/// constructing an array of `element` repeated according to `dimensions`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct ArrayInitExpression { - /// The expression that all elements in the array will evaluate to. - pub element: Box, - /// The dimensions of the array. - /// - /// This could be a multi-dimensional array, - /// e.g., `[42; (2, 2)]`, giving you a matrix `[[42, 42], [42, 42]]`. - pub dimensions: ArrayDimensions, - /// The span of the entire expression from `[` to `]`. - pub span: Span, -} - -impl fmt::Display for ArrayInitExpression { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "[{}; {}]", self.element, self.dimensions) - } -} - -impl Node for ArrayInitExpression { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/expression/array_inline.rs b/compiler/ast/src/expression/array_inline.rs deleted file mode 100644 index 4e03912a4f..0000000000 --- a/compiler/ast/src/expression/array_inline.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use super::*; - -/// An expression constructing an array by listing the individual elements inline, -/// for example `[4, 6, 5, 2]`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct ArrayInlineExpression { - /// A list, where a part can be either an element, - /// or list of elements to construct the array with. - pub elements: Vec, - /// The span of the entire expression from `[` to `]`. - pub span: Span, -} - -impl fmt::Display for ArrayInlineExpression { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "[")?; - for (i, e) in self.elements.iter().enumerate() { - write!(f, "{}", e)?; - if i < self.elements.len() - 1 { - write!(f, ", ")?; - } - } - write!(f, "]") - } -} - -impl Node for ArrayInlineExpression { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/expression/mod.rs b/compiler/ast/src/expression/mod.rs index 0e9ea36b9c..c72a546945 100644 --- a/compiler/ast/src/expression/mod.rs +++ b/compiler/ast/src/expression/mod.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ArrayDimensions, GroupValue, Identifier, IntegerType, Node, SpreadOrExpression}; +use crate::{GroupValue, Identifier, IntegerType, Node}; use leo_span::Span; @@ -29,10 +29,6 @@ mod unary; pub use unary::*; mod ternary; pub use ternary::*; -mod array_inline; -pub use array_inline::*; -mod array_init; -pub use array_init::*; mod tuple_init; pub use tuple_init::*; mod value; @@ -61,11 +57,6 @@ pub enum Expression { Cast(CastExpression), /// An access expression of some sort, e.g., `array[idx]` or `foo.bar`. Access(AccessExpression), - /// An array expression where individual elements are listed inline, - /// for example `[4, 6, ...[5, 7], 2]`. - ArrayInline(ArrayInlineExpression), - /// An array-repeat expression, e.g., `[42; 3]` yielding `[42, 42, 42]`. - ArrayInit(ArrayInitExpression), /// A tuple expression e.g., `(foo, 42, true)`. TupleInit(TupleInitExpression), /// A call expression like `my_fun(args)`. @@ -84,8 +75,6 @@ impl Node for Expression { Binary(n) => n.span(), Unary(n) => n.span(), Ternary(n) => n.span(), - ArrayInline(n) => n.span(), - ArrayInit(n) => n.span(), TupleInit(n) => n.span(), Call(n) => n.span(), Cast(n) => n.span(), @@ -102,8 +91,6 @@ impl Node for Expression { Binary(n) => n.set_span(span), Unary(n) => n.set_span(span), Ternary(n) => n.set_span(span), - ArrayInline(n) => n.set_span(span), - ArrayInit(n) => n.set_span(span), TupleInit(n) => n.set_span(span), Call(n) => n.set_span(span), Cast(n) => n.set_span(span), @@ -122,8 +109,6 @@ impl fmt::Display for Expression { Binary(n) => n.fmt(f), Unary(n) => n.fmt(f), Ternary(n) => n.fmt(f), - ArrayInline(n) => n.fmt(f), - ArrayInit(n) => n.fmt(f), TupleInit(n) => n.fmt(f), Call(n) => n.fmt(f), Cast(n) => n.fmt(f), diff --git a/compiler/ast/src/input/input_value.rs b/compiler/ast/src/input/input_value.rs index 782b6dec25..b041b3d4d1 100644 --- a/compiler/ast/src/input/input_value.rs +++ b/compiler/ast/src/input/input_value.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{CharValue, Expression, GroupValue, IntegerType, Node, SpreadOrExpression, Type, ValueExpression}; +use crate::{CharValue, Expression, GroupValue, IntegerType, Node, Type, ValueExpression}; use leo_errors::{InputError, LeoError, ParserError, Result}; use serde::{Deserialize, Serialize}; @@ -28,7 +28,6 @@ pub enum InputValue { Field(String), Group(GroupValue), Integer(IntegerType, String), - Array(Vec), Tuple(Vec), } @@ -56,62 +55,11 @@ impl TryFrom<(Type, Expression)> for InputValue { return Err(InputError::unexpected_type(expected.to_string(), actual, &span).into()); } } - (Type::Array(type_, _), ValueExpression::String(string, span)) => { - if !matches!(*type_, Type::Char) { - return Err(InputError::string_is_array_of_chars(type_, &span).into()); - } - - Self::Array( - string - .into_iter() - .map(|c| { - Self::Char(CharValue { - character: c, - span: span.clone(), - }) - }) - .collect(), - ) - } (x, y) => { return Err(InputError::unexpected_type(x, &y, y.span()).into()); } } } - (Type::Array(type_, type_dimensions), Expression::ArrayInit(mut array_init)) => { - let span = array_init.span.clone(); - - if type_dimensions != array_init.dimensions || array_init.dimensions.is_zero() { - return Err(InputError::invalid_array_dimension_size(&span).into()); - } - - if let Some(dimension) = array_init.dimensions.remove_first() { - let size = dimension.value.parse::().unwrap(); - let mut values = Vec::with_capacity(size); - - // For when Dimensions are specified in a canonical way: [[u8; 3], 2]; - // Else treat as math notation: [u8; (2, 3)]; - if array_init.dimensions.len() == 0 { - for _ in 0..size { - values.push(InputValue::try_from((*type_.clone(), *array_init.element.clone()))?); - } - // Faking canonical array init is relatively easy: instead of using a straightforward - // recursion, with each iteration we manually modify ArrayInitExpression cutting off - // dimension by dimension. - } else { - for _ in 0..size { - values.push(InputValue::try_from(( - Type::Array(type_.clone(), array_init.dimensions.clone()), - Expression::ArrayInit(array_init.clone()), - ))?); - } - }; - - Self::Array(values) - } else { - unreachable!("dimensions are checked for zero"); - } - } (Type::Tuple(types), Expression::TupleInit(tuple_init)) => { let size = tuple_init.elements.len(); let mut elements = Vec::with_capacity(size); @@ -126,19 +74,6 @@ impl TryFrom<(Type, Expression)> for InputValue { Self::Tuple(elements) } - (Type::Array(element_type, _dimensions), Expression::ArrayInline(array_inline)) => { - let mut elements = Vec::with_capacity(array_inline.elements.len()); - let span = array_inline.span().clone(); - - for element in array_inline.elements.into_iter() { - if let SpreadOrExpression::Expression(value_expression) = element { - elements.push(Self::try_from((*element_type.clone(), value_expression))?); - } else { - return Err(InputError::array_spread_is_not_allowed(&span).into()); - } - } - Self::Array(elements) - } (_type_, expr) => return Err(InputError::illegal_expression(&expr, expr.span()).into()), }) } @@ -153,10 +88,6 @@ impl fmt::Display for InputValue { InputValue::Group(ref group) => write!(f, "{}", group), InputValue::Field(ref field) => write!(f, "{}", field), InputValue::Integer(ref type_, ref number) => write!(f, "{}{:?}", number, type_), - InputValue::Array(ref array) => { - let values = array.iter().map(|x| x.to_string()).collect::>().join(", "); - write!(f, "array [{}]", values) - } InputValue::Tuple(ref tuple) => { let values = tuple.iter().map(|x| x.to_string()).collect::>().join(", "); write!(f, "({})", values) diff --git a/compiler/ast/src/reducer/reconstructing_director.rs b/compiler/ast/src/reducer/reconstructing_director.rs index c9d34514d3..b56c9df0e0 100644 --- a/compiler/ast/src/reducer/reconstructing_director.rs +++ b/compiler/ast/src/reducer/reconstructing_director.rs @@ -35,7 +35,6 @@ impl ReconstructingDirector { pub fn reduce_type(&mut self, type_: &Type, span: &Span) -> Result { let new = match type_ { - Type::Array(type_, dimensions) => Type::Array(Box::new(self.reduce_type(type_, span)?), dimensions.clone()), Type::Tuple(types) => { let mut reduced_types = vec![]; for type_ in types.iter() { @@ -62,9 +61,6 @@ impl ReconstructingDirector { Expression::Cast(cast) => Expression::Cast(self.reduce_cast(cast)?), Expression::Access(access) => Expression::Access(self.reduce_access(access)?), - Expression::ArrayInline(array_inline) => Expression::ArrayInline(self.reduce_array_inline(array_inline)?), - Expression::ArrayInit(array_init) => Expression::ArrayInit(self.reduce_array_init(array_init)?), - Expression::TupleInit(tuple_init) => Expression::TupleInit(self.reduce_tuple_init(tuple_init)?), Expression::Call(call) => Expression::Call(self.reduce_call(call)?), @@ -135,30 +131,6 @@ impl ReconstructingDirector { self.reducer.reduce_cast(cast, inner, target_type) } - pub fn reduce_array_access(&mut self, array_access: &ArrayAccess) -> Result { - let array = self.reduce_expression(&array_access.array)?; - let index = self.reduce_expression(&array_access.index)?; - - self.reducer.reduce_array_access(array_access, array, index) - } - - pub fn reduce_array_range_access(&mut self, array_range_access: &ArrayRangeAccess) -> Result { - let array = self.reduce_expression(&array_range_access.array)?; - let left = array_range_access - .left - .as_ref() - .map(|left| self.reduce_expression(left)) - .transpose()?; - let right = array_range_access - .right - .as_ref() - .map(|right| self.reduce_expression(right)) - .transpose()?; - - self.reducer - .reduce_array_range_access(array_range_access, array, left, right) - } - pub fn reduce_member_access(&mut self, member_access: &MemberAccess) -> Result { let inner = self.reduce_expression(&member_access.inner)?; let name = self.reduce_identifier(&member_access.name)?; @@ -181,8 +153,6 @@ impl ReconstructingDirector { use AccessExpression::*; let new = match access { - Array(access) => Array(self.reduce_array_access(access)?), - ArrayRange(access) => ArrayRange(self.reduce_array_range_access(access)?), Member(access) => Member(self.reduce_member_access(access)?), Tuple(access) => Tuple(self.reduce_tuple_access(access)?), }; @@ -190,30 +160,6 @@ impl ReconstructingDirector { Ok(new) } - pub fn reduce_array_inline(&mut self, array_inline: &ArrayInlineExpression) -> Result { - let mut elements = vec![]; - for element in array_inline.elements.iter() { - let reduced_element = match element { - SpreadOrExpression::Expression(expression) => { - SpreadOrExpression::Expression(self.reduce_expression(expression)?) - } - SpreadOrExpression::Spread(expression) => { - SpreadOrExpression::Spread(self.reduce_expression(expression)?) - } - }; - - elements.push(reduced_element); - } - - self.reducer.reduce_array_inline(array_inline, elements) - } - - pub fn reduce_array_init(&mut self, array_init: &ArrayInitExpression) -> Result { - let element = self.reduce_expression(&array_init.element)?; - - self.reducer.reduce_array_init(array_init, element) - } - pub fn reduce_tuple_init(&mut self, tuple_init: &TupleInitExpression) -> Result { let mut elements = vec![]; for element in tuple_init.elements.iter() { diff --git a/compiler/ast/src/reducer/reconstructing_reducer.rs b/compiler/ast/src/reducer/reconstructing_reducer.rs index 99ffc87f5e..4560efc63b 100644 --- a/compiler/ast/src/reducer/reconstructing_reducer.rs +++ b/compiler/ast/src/reducer/reconstructing_reducer.rs @@ -121,34 +121,6 @@ pub trait ReconstructingReducer { }) } - fn reduce_array_access( - &mut self, - array_access: &ArrayAccess, - array: Expression, - index: Expression, - ) -> Result { - Ok(ArrayAccess { - array: Box::new(array), - index: Box::new(index), - span: array_access.span.clone(), - }) - } - - fn reduce_array_range_access( - &mut self, - array_rage_access: &ArrayRangeAccess, - array: Expression, - left: Option, - right: Option, - ) -> Result { - Ok(ArrayRangeAccess { - array: Box::new(array), - left: left.map(|expr| Box::new(expr)), - right: right.map(|expr| Box::new(expr)), - span: array_rage_access.span.clone(), - }) - } - fn reduce_member_access( &mut self, member_access: &MemberAccess, @@ -172,29 +144,6 @@ pub trait ReconstructingReducer { }) } - fn reduce_array_inline( - &mut self, - array_inline: &ArrayInlineExpression, - elements: Vec, - ) -> Result { - Ok(ArrayInlineExpression { - elements, - span: array_inline.span.clone(), - }) - } - - fn reduce_array_init( - &mut self, - array_init: &ArrayInitExpression, - element: Expression, - ) -> Result { - Ok(ArrayInitExpression { - element: Box::new(element), - dimensions: array_init.dimensions.clone(), - span: array_init.span.clone(), - }) - } - fn reduce_tuple_init( &mut self, tuple_init: &TupleInitExpression, diff --git a/compiler/ast/src/types/type_.rs b/compiler/ast/src/types/type_.rs index 35fb44967d..07700ec31e 100644 --- a/compiler/ast/src/types/type_.rs +++ b/compiler/ast/src/types/type_.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ArrayDimensions, Identifier, IntegerType}; +use crate::{Identifier, IntegerType}; use serde::{Deserialize, Serialize}; use std::fmt; @@ -36,10 +36,6 @@ pub enum Type { /// An integer type. IntegerType(IntegerType), - // Data type wrappers - /// An array type `[element; dimensions]`. - Array(Box, ArrayDimensions), - /// A tuple type `(T_0, T_1, ...)` made up of a list of types. Tuple(Vec), @@ -73,27 +69,6 @@ impl Type { (Type::Group, Type::Group) => true, (Type::IntegerType(left), Type::IntegerType(right)) => left.eq(right), (Type::Identifier(left), Type::Identifier(right)) => left.eq(right), - (Type::Array(left_type, left_dims), Type::Array(right_type, right_dims)) => { - // Convert array dimensions to owned. - let mut left_dims = left_dims.to_owned(); - let mut right_dims = right_dims.to_owned(); - - // Remove the first element from both dimensions. - let left_first = left_dims.remove_first(); - let right_first = right_dims.remove_first(); - - // Compare the first dimensions. - if left_first.ne(&right_first) { - return false; - } - - // Create a new array type from the remaining array dimensions. - let left_new_type = inner_array_type(*left_type.to_owned(), left_dims); - let right_new_type = inner_array_type(*right_type.to_owned(), right_dims); - - // Call eq_flat() on the new left and right types. - left_new_type.eq_flat(&right_new_type) - } (Type::Tuple(left), Type::Tuple(right)) => left .iter() .zip(right) @@ -113,7 +88,6 @@ impl fmt::Display for Type { Type::Group => write!(f, "group"), Type::IntegerType(ref integer_type) => write!(f, "{}", integer_type), Type::Identifier(ref variable) => write!(f, "circuit {}", variable), - Type::Array(ref array, ref dimensions) => write!(f, "[{}; {}]", *array, dimensions), Type::Tuple(ref tuple) => { let types = tuple.iter().map(|x| x.to_string()).collect::>().join(", "); @@ -123,21 +97,3 @@ impl fmt::Display for Type { } } } - -/// Returns the type of the inner array given an array element and array dimensions. -/// -/// If the array has no dimensions, then an inner array does not exist. Simply return the given -/// element type. -/// -/// If the array has dimensions, then an inner array exists. Create a new type for the -/// inner array. The element type of the new array should be the same as the old array. The -/// dimensions of the new array should be the old array dimensions with the first dimension removed. -pub fn inner_array_type(element_type: Type, dimensions: ArrayDimensions) -> Type { - if dimensions.is_empty() { - // The array has one dimension. - element_type - } else { - // The array has multiple dimensions. - Type::Array(Box::new(element_type), dimensions) - } -} diff --git a/compiler/parser/src/parser/expression.rs b/compiler/parser/src/parser/expression.rs index d95c98b35a..06ce05300f 100644 --- a/compiler/parser/src/parser/expression.rs +++ b/compiler/parser/src/parser/expression.rs @@ -268,50 +268,8 @@ impl ParserContext<'_> { // the ABNF states. Rather the primary expression already // handle those. The ABNF is more specific for language reasons. let mut expr = self.parse_primary_expression()?; - while let Some(token) = self.eat_any(&[Token::LeftSquare, Token::Dot, Token::LeftParen]) { + while let Some(token) = self.eat_any(&[Token::Dot, Token::LeftParen]) { match token.token { - Token::LeftSquare => { - if self.eat(Token::DotDot).is_some() { - let right = if self.peek_token().as_ref() != &Token::RightSquare { - Some(Box::new(self.parse_expression()?)) - } else { - None - }; - - let end = self.expect(Token::RightSquare)?; - expr = Expression::Access(AccessExpression::ArrayRange(ArrayRangeAccess { - span: expr.span() + &end, - array: Box::new(expr), - left: None, - right, - })); - continue; - } - - let left = self.parse_expression()?; - if self.eat(Token::DotDot).is_some() { - let right = if self.peek_token().as_ref() != &Token::RightSquare { - Some(Box::new(self.parse_expression()?)) - } else { - None - }; - - let end = self.expect(Token::RightSquare)?; - expr = Expression::Access(AccessExpression::ArrayRange(ArrayRangeAccess { - span: expr.span() + &end, - array: Box::new(expr), - left: Some(Box::new(left)), - right, - })); - } else { - let end = self.expect(Token::RightSquare)?; - expr = Expression::Access(AccessExpression::Array(ArrayAccess { - span: expr.span() + &end, - array: Box::new(expr), - index: Box::new(left), - })); - } - } Token::Dot => { if let Some(ident) = self.eat_identifier() { expr = Expression::Access(AccessExpression::Member(MemberAccess { @@ -357,20 +315,6 @@ impl ParserContext<'_> { Ok(expr) } - /// - /// Returns a [`SpreadOrExpression`] AST node if the next tokens represent a - /// spread or expression. - /// - /// This method should only be called in the context of an array construction expression. - /// - pub fn parse_spread_or_expression(&mut self) -> Result { - Ok(if self.eat(Token::DotDotDot).is_some() { - SpreadOrExpression::Spread(self.parse_expression()?) - } else { - SpreadOrExpression::Expression(self.parse_expression()?) - }) - } - /// /// Returns an [`Expression`] AST node if the next tokens represent a /// tuple initialization expression or an affine group literal. @@ -410,63 +354,6 @@ impl ParserContext<'_> { } } - /// - /// Returns an [`Expression`] AST node if the next tokens represent an - /// array initialization expression. - /// - pub fn parse_array_expression(&mut self, span: &Span) -> Result { - if let Some(end) = self.eat(Token::RightSquare) { - return Ok(Expression::ArrayInline(ArrayInlineExpression { - elements: Vec::new(), - span: span + &end.span, - })); - } - let first = self.parse_spread_or_expression()?; - if self.eat(Token::Semicolon).is_some() { - let dimensions = self - .parse_array_dimensions() - .map_err(|_| ParserError::unable_to_parse_array_dimensions(span))?; - let end = self.expect(Token::RightSquare)?; - let first = match first { - SpreadOrExpression::Spread(first) => { - let span = span + first.span(); - return Err(ParserError::spread_in_array_init(&span).into()); - } - SpreadOrExpression::Expression(x) => x, - }; - Ok(Expression::ArrayInit(ArrayInitExpression { - span: span + &end, - element: Box::new(first), - dimensions, - })) - } else { - let end_span; - let mut elements = vec![first]; - loop { - if let Some(token) = self.eat(Token::RightSquare) { - end_span = token.span; - break; - } - if elements.len() == 1 { - self.expect(Token::Comma)?; - if let Some(token) = self.eat(Token::RightSquare) { - end_span = token.span; - break; - } - } - elements.push(self.parse_spread_or_expression()?); - if self.eat(Token::Comma).is_none() { - end_span = self.expect(Token::RightSquare)?; - break; - } - } - Ok(Expression::ArrayInline(ArrayInlineExpression { - elements, - span: span + &end_span, - })) - } - } - /// /// Returns an [`Expression`] AST node if the next token is a primary expression: /// - Literals: field, group, unsigned integer, signed integer, boolean, address @@ -519,7 +406,6 @@ impl ParserContext<'_> { })), Token::StringLit(value) => Expression::Value(ValueExpression::String(value, span)), Token::LeftParen => self.parse_tuple_expression(&span)?, - Token::LeftSquare => self.parse_array_expression(&span)?, Token::Ident(name) => { let ident = Identifier { name, span }; Expression::Identifier(ident) diff --git a/compiler/parser/src/parser/statement.rs b/compiler/parser/src/parser/statement.rs index a50c12f079..38ac00e747 100644 --- a/compiler/parser/src/parser/statement.rs +++ b/compiler/parser/src/parser/statement.rs @@ -45,17 +45,6 @@ impl ParserContext<'_> { identifier = Self::construct_assignee_access(*expr.tuple, accesses)?; accesses.push(AssigneeAccess::Tuple(expr.index, expr.span)); } - AccessExpression::ArrayRange(expr) => { - identifier = Self::construct_assignee_access(*expr.array, accesses)?; - accesses.push(AssigneeAccess::ArrayRange( - expr.left.map(|x| *x), - expr.right.map(|x| *x), - )); - } - AccessExpression::Array(expr) => { - identifier = Self::construct_assignee_access(*expr.array, accesses)?; - accesses.push(AssigneeAccess::ArrayIndex(*expr.index)); - } }, Expression::Identifier(id) => identifier = id, diff --git a/compiler/parser/src/parser/type_.rs b/compiler/parser/src/parser/type_.rs index 93f7c3bce3..e1376b2b64 100644 --- a/compiler/parser/src/parser/type_.rs +++ b/compiler/parser/src/parser/type_.rs @@ -15,9 +15,7 @@ // along with the Leo library. If not, see . use super::*; -use leo_errors::{ParserError, Result}; - -use smallvec::smallvec; +use leo_errors::Result; pub(crate) const TYPE_TOKENS: &[Token] = &[ Token::I8, @@ -57,31 +55,6 @@ impl ParserContext<'_> { }) } - /// Returns an [`ArrayDimensions`] AST node if the next tokens represent dimensions for an array type. - pub fn parse_array_dimensions(&mut self) -> Result { - Ok(if let Some((dim, _)) = self.eat_int() { - ArrayDimensions(smallvec![dim]) - } else { - let mut had_item_err = false; - let (dims, _, span) = self.parse_paren_comma_list(|p| { - Ok(if let Some((dim, _)) = p.eat_int() { - Some(dim) - } else { - let token = p.expect_any()?; - p.emit_err(ParserError::unexpected_str(&token.token, "int", &token.span)); - had_item_err = true; - None - }) - })?; - if dims.is_empty() && !had_item_err { - self.emit_err(ParserError::array_tuple_dimensions_empty(&span)); - } else if dims.len() == 1 { - self.emit_err(ParserError::invalid_parens_around_single_array_dimension_size(&span)); - } - ArrayDimensions(dims.into()) - }) - } - /// Returns a [`(Type, Span)`] tuple of AST nodes if the next token represents a type. /// Also returns the span of the parsed token. pub fn parse_type(&mut self) -> Result<(Type, Span)> { @@ -91,12 +64,6 @@ impl ParserContext<'_> { } else if self.peek_is_left_par() { let (types, _, span) = self.parse_paren_comma_list(|p| p.parse_type().map(|t| Some(t.0)))?; (Type::Tuple(types), span) - } else if let Some(token) = self.eat(Token::LeftSquare) { - let (inner, _) = self.parse_type()?; - self.expect(Token::Semicolon)?; - let dimensions = self.parse_array_dimensions()?; - let end_span = self.expect(Token::RightSquare)?; - (Type::Array(Box::new(inner), dimensions), token.span + end_span) } else { let token = self.expect_oneof(TYPE_TOKENS)?; ( diff --git a/compiler/parser/src/tokenizer/lexer.rs b/compiler/parser/src/tokenizer/lexer.rs index ecbe41e23c..9a0bbe78ab 100644 --- a/compiler/parser/src/tokenizer/lexer.rs +++ b/compiler/parser/src/tokenizer/lexer.rs @@ -293,11 +293,7 @@ impl Token { Some('.') => { input.next(); if input.next_if_eq(&'.').is_some() { - if input.next_if_eq(&'.').is_some() { - return Ok((3, Token::DotDotDot)); - } else { - return Ok((2, Token::DotDot)); - } + return Ok((2, Token::DotDot)); } return Ok((1, Token::Dot)); } diff --git a/compiler/parser/src/tokenizer/mod.rs b/compiler/parser/src/tokenizer/mod.rs index db54fe5189..6b9d8f171c 100644 --- a/compiler/parser/src/tokenizer/mod.rs +++ b/compiler/parser/src/tokenizer/mod.rs @@ -173,7 +173,6 @@ mod tests { _ . .. - ... / /= : @@ -203,7 +202,7 @@ mod tests { assert_eq!( output, - r#"'a' '😭' "test" "test{}test" "test{}" "{}test" "test{" "test}" "test{test" "test}test" "te{{}}" aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 test_ident 12345 address as bool circuit const else false field for function group i128 i64 i32 i16 i8 if import in input let mut return string test true u128 u64 u32 u16 u8 console ! != && ( ) * ** **= *= + += , - -= -> _ . .. ... / /= : ; < <= = == > >= [ ] { { } } || ? // test + r#"'a' '😭' "test" "test{}test" "test{}" "{}test" "test{" "test}" "test{test" "test}test" "te{{}}" aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 test_ident 12345 address as bool circuit const else false field for function group i128 i64 i32 i16 i8 if import in input let mut return string test true u128 u64 u32 u16 u8 console ! != && ( ) * ** **= *= + += , - -= -> _ . .. / /= : ; < <= = == > >= [ ] { { } } || ? // test /* test */ // "# ); }); diff --git a/compiler/parser/src/tokenizer/token.rs b/compiler/parser/src/tokenizer/token.rs index 379d25ba83..b52a436750 100644 --- a/compiler/parser/src/tokenizer/token.rs +++ b/compiler/parser/src/tokenizer/token.rs @@ -90,7 +90,6 @@ pub enum Token { Comma, Dot, DotDot, - DotDotDot, Semicolon, Colon, Question, @@ -270,7 +269,6 @@ impl fmt::Display for Token { Comma => write!(f, ","), Dot => write!(f, "."), DotDot => write!(f, ".."), - DotDotDot => write!(f, "..."), Semicolon => write!(f, ";"), Colon => write!(f, ":"), Question => write!(f, "?"), diff --git a/tests/expectations/parser/parser/expression/access/call.leo.out b/tests/expectations/parser/parser/expression/access/call.leo.out index 2d5c63438a..2472f55b58 100644 --- a/tests/expectations/parser/parser/expression/access/call.leo.out +++ b/tests/expectations/parser/parser/expression/access/call.leo.out @@ -87,36 +87,3 @@ outputs: col_stop: 7 path: "" content: x.0(x) - - Call: - function: - Access: - Array: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0](x)\\\"}\"}" - index: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[0](x)" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x[0](x)" - arguments: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0](x)\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x[0](x)" diff --git a/tests/expectations/parser/parser/expression/access/circuit.leo.out b/tests/expectations/parser/parser/expression/access/circuit.leo.out index 19b5bb9c4a..0314c4ef11 100644 --- a/tests/expectations/parser/parser/expression/access/circuit.leo.out +++ b/tests/expectations/parser/parser/expression/access/circuit.leo.out @@ -101,37 +101,3 @@ outputs: col_stop: 6 path: "" content: x.y.0 - - Access: - Array: - array: - Access: - Member: - inner: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y[1]\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y[1]\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.y[1]" - type_: ~ - index: - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x.y[1]" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: "x.y[1]" diff --git a/tests/expectations/parser/parser/expression/array_init_fail.leo.out b/tests/expectations/parser/parser/expression/array_init_fail.leo.out index 17ad75389c..80ea97fbc2 100644 --- a/tests/expectations/parser/parser/expression/array_init_fail.leo.out +++ b/tests/expectations/parser/parser/expression/array_init_fail.leo.out @@ -2,7 +2,7 @@ namespace: ParseExpression expectation: Fail outputs: - - "Error [EPAR0370010]: illegal spread in array initializer\n --> test:1:1\n |\n 1 | [...0u8; 1]\n | ^^^^^^^" - - "Error [EPAR0370010]: illegal spread in array initializer\n --> test:1:1\n |\n 1 | [...0; 1]\n | ^^^^^" - - "Error [EPAR0370022]: Array dimensions specified as a tuple cannot be empty.\n --> test:1:5\n |\n 1 | [0; ()]\n | ^^" - - "Error [EPAR0370039]: do not put parens around single dimension array size\n --> test:1:5\n |\n 1 | [0; (1)]\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [...0u8; 1]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [...0; 1]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [0; ()]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [0; (1)]\n | ^" diff --git a/tests/expectations/parser/parser/expression/array_inline_fail.leo.out b/tests/expectations/parser/parser/expression/array_inline_fail.leo.out index dd15703185..ddff3711a8 100644 --- a/tests/expectations/parser/parser/expression/array_inline_fail.leo.out +++ b/tests/expectations/parser/parser/expression/array_inline_fail.leo.out @@ -2,8 +2,8 @@ namespace: ParseExpression expectation: Fail outputs: - - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:2\n |\n 1 | [,]\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:2\n |\n 1 | [,,]\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:4\n |\n 1 | [0,,]\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:2\n |\n 1 | [,0]\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:2\n |\n 1 | [,0,]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [,]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [,,]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [0,,]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [,0]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [,0,]\n | ^" diff --git a/tests/expectations/parser/parser/expression/token_format.leo.out b/tests/expectations/parser/parser/expression/token_format.leo.out index 0e8834d1ea..b6a43b68ab 100644 --- a/tests/expectations/parser/parser/expression/token_format.leo.out +++ b/tests/expectations/parser/parser/expression/token_format.leo.out @@ -32,14 +32,14 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', got '**='\n --> test:1:1\n |\n 1 | **=\n | ^^^" - "Error [EPAR0370003]: unexpected EOF\n --> test:1:1\n |\n 1 | (\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ')'\n --> test:1:1\n |\n 1 | )\n | ^" - - "Error [EPAR0370003]: unexpected EOF\n --> test:1:1\n |\n 1 | [\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ']'\n --> test:1:1\n |\n 1 | ]\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '{'\n --> test:1:1\n |\n 1 | {\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '}'\n --> test:1:1\n |\n 1 | }\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:1\n |\n 1 | ,\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '.'\n --> test:1:1\n |\n 1 | .\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '..'\n --> test:1:1\n |\n 1 | ..\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '...'\n --> test:1:1\n |\n 1 | ...\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '..'\n --> test:1:1\n |\n 1 | ...\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ';'\n --> test:1:1\n |\n 1 | ;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ':'\n --> test:1:1\n |\n 1 | :\n | ^" - "did not consume all input: ':' @ 1:2-3\n':' @ 1:3-4\n" diff --git a/tests/expectations/parser/parser/inputs/input_success.leo.out b/tests/expectations/parser/parser/inputs/input_success.leo.out index 6fde85fcfe..e5b57a942f 100644 --- a/tests/expectations/parser/parser/inputs/input_success.leo.out +++ b/tests/expectations/parser/parser/inputs/input_success.leo.out @@ -126,92 +126,11 @@ outputs: col_stop: 11 path: "" content: "e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;" - - type_: - Array: - - IntegerType: U8 - - - value: "32" - name: "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"f: [u8; 32] = [0; 32]; \\\"}\"}" - value: - ArrayInit: - element: - Value: - Implicit: - - "0" - - span: - line_start: 9 - line_stop: 9 - col_start: 16 - col_stop: 17 - path: "" - content: "f: [u8; 32] = [0; 32]; " - dimensions: - - value: "32" - span: - line_start: 9 - line_stop: 9 - col_start: 15 - col_stop: 22 - path: "" - content: "f: [u8; 32] = [0; 32]; " - span: - line_start: 9 - line_stop: 9 - col_start: 4 - col_stop: 12 - path: "" - content: "f: [u8; 32] = [0; 32]; " - - type_: - Array: - - Array: - - IntegerType: U8 - - - value: "2" - - - value: "3" - name: "{\"name\":\"g\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"g: [[u8; 2]; 3] = [[0; 2]; 3]; \\\"}\"}" - value: - ArrayInit: - element: - ArrayInit: - element: - Value: - Implicit: - - "0" - - span: - line_start: 10 - line_stop: 10 - col_start: 21 - col_stop: 22 - path: "" - content: "g: [[u8; 2]; 3] = [[0; 2]; 3]; " - dimensions: - - value: "2" - span: - line_start: 10 - line_stop: 10 - col_start: 20 - col_stop: 26 - path: "" - content: "g: [[u8; 2]; 3] = [[0; 2]; 3]; " - dimensions: - - value: "3" - span: - line_start: 10 - line_stop: 10 - col_start: 19 - col_stop: 30 - path: "" - content: "g: [[u8; 2]; 3] = [[0; 2]; 3]; " - span: - line_start: 10 - line_stop: 10 - col_start: 4 - col_stop: 16 - path: "" - content: "g: [[u8; 2]; 3] = [[0; 2]; 3]; " - type_: Tuple: - Boolean - Boolean - name: "{\"name\":\"h\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"h: (bool, bool) = (true, false); \\\"}\"}" + name: "{\"name\":\"h\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"h: (bool, bool) = (true, false); \\\"}\"}" value: TupleInit: elements: @@ -219,8 +138,8 @@ outputs: Boolean: - "true" - span: - line_start: 11 - line_stop: 11 + line_start: 9 + line_stop: 9 col_start: 20 col_stop: 24 path: "" @@ -229,22 +148,22 @@ outputs: Boolean: - "false" - span: - line_start: 11 - line_stop: 11 + line_start: 9 + line_stop: 9 col_start: 26 col_stop: 31 path: "" content: "h: (bool, bool) = (true, false); " span: - line_start: 11 - line_stop: 11 + line_start: 9 + line_stop: 9 col_start: 19 col_stop: 32 path: "" content: "h: (bool, bool) = (true, false); " span: - line_start: 11 - line_stop: 11 + line_start: 9 + line_stop: 9 col_start: 4 col_stop: 16 path: "" @@ -259,68 +178,68 @@ outputs: - name: registers definitions: - type_: Boolean - name: "{\"name\":\"r0\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r0: bool = true; \\\"}\"}" + name: "{\"name\":\"r0\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r0: bool = true; \\\"}\"}" value: Value: Boolean: - "true" - span: - line_start: 14 - line_stop: 14 + line_start: 12 + line_stop: 12 col_start: 13 col_stop: 17 path: "" content: "r0: bool = true; " span: - line_start: 14 - line_stop: 14 + line_start: 12 + line_stop: 12 col_start: 5 col_stop: 9 path: "" content: "r0: bool = true; " - type_: IntegerType: U8 - name: "{\"name\":\"r1\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r1: u8 = 2; \\\"}\"}" + name: "{\"name\":\"r1\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r1: u8 = 2; \\\"}\"}" value: Value: Implicit: - "2" - span: - line_start: 15 - line_stop: 15 + line_start: 13 + line_stop: 13 col_start: 13 col_stop: 14 path: "" content: "r1: u8 = 2; " span: - line_start: 15 - line_stop: 15 + line_start: 13 + line_stop: 13 col_start: 5 col_stop: 7 path: "" content: "r1: u8 = 2; " - type_: Field - name: "{\"name\":\"r2\",\"span\":\"{\\\"line_start\\\":16,\\\"line_stop\\\":16,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r2: field = 0; \\\"}\"}" + name: "{\"name\":\"r2\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r2: field = 0; \\\"}\"}" value: Value: Implicit: - "0" - span: - line_start: 16 - line_stop: 16 + line_start: 14 + line_stop: 14 col_start: 13 col_stop: 14 path: "" content: "r2: field = 0; " span: - line_start: 16 - line_stop: 16 + line_start: 14 + line_stop: 14 col_start: 5 col_stop: 10 path: "" content: "r2: field = 0; " - type_: Group - name: "{\"name\":\"r3\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r3: group = (0, 1)group; \\\"}\"}" + name: "{\"name\":\"r3\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r3: group = (0, 1)group; \\\"}\"}" value: Value: Group: @@ -329,8 +248,8 @@ outputs: Number: - "0" - span: - line_start: 17 - line_stop: 17 + line_start: 15 + line_stop: 15 col_start: 14 col_stop: 15 path: "" @@ -339,132 +258,51 @@ outputs: Number: - "1" - span: - line_start: 17 - line_stop: 17 + line_start: 15 + line_stop: 15 col_start: 17 col_stop: 18 path: "" content: "r3: group = (0, 1)group; " span: - line_start: 17 - line_stop: 17 + line_start: 15 + line_stop: 15 col_start: 14 col_stop: 24 path: "" content: "r3: group = (0, 1)group; " span: - line_start: 17 - line_stop: 17 + line_start: 15 + line_stop: 15 col_start: 5 col_stop: 10 path: "" content: "r3: group = (0, 1)group; " - type_: Address - name: "{\"name\":\"r4\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}" + name: "{\"name\":\"r4\",\"span\":\"{\\\"line_start\\\":16,\\\"line_stop\\\":16,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}" value: Value: Address: - aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 - span: - line_start: 18 - line_stop: 18 + line_start: 16 + line_stop: 16 col_start: 15 col_stop: 78 path: "" content: "r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;" span: - line_start: 18 - line_stop: 18 + line_start: 16 + line_stop: 16 col_start: 5 col_stop: 12 path: "" content: "r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;" - - type_: - Array: - - IntegerType: U8 - - - value: "32" - name: "{\"name\":\"r5\",\"span\":\"{\\\"line_start\\\":19,\\\"line_stop\\\":19,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r5: [u8; 32] = [0; 32]; \\\"}\"}" - value: - ArrayInit: - element: - Value: - Implicit: - - "0" - - span: - line_start: 19 - line_stop: 19 - col_start: 17 - col_stop: 18 - path: "" - content: "r5: [u8; 32] = [0; 32]; " - dimensions: - - value: "32" - span: - line_start: 19 - line_stop: 19 - col_start: 16 - col_stop: 23 - path: "" - content: "r5: [u8; 32] = [0; 32]; " - span: - line_start: 19 - line_stop: 19 - col_start: 5 - col_stop: 13 - path: "" - content: "r5: [u8; 32] = [0; 32]; " - - type_: - Array: - - Array: - - IntegerType: U8 - - - value: "2" - - - value: "3" - name: "{\"name\":\"r6\",\"span\":\"{\\\"line_start\\\":20,\\\"line_stop\\\":20,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r6: [[u8; 2]; 3] = [[0; 2]; 3]; \\\"}\"}" - value: - ArrayInit: - element: - ArrayInit: - element: - Value: - Implicit: - - "0" - - span: - line_start: 20 - line_stop: 20 - col_start: 22 - col_stop: 23 - path: "" - content: "r6: [[u8; 2]; 3] = [[0; 2]; 3]; " - dimensions: - - value: "2" - span: - line_start: 20 - line_stop: 20 - col_start: 21 - col_stop: 27 - path: "" - content: "r6: [[u8; 2]; 3] = [[0; 2]; 3]; " - dimensions: - - value: "3" - span: - line_start: 20 - line_stop: 20 - col_start: 20 - col_stop: 31 - path: "" - content: "r6: [[u8; 2]; 3] = [[0; 2]; 3]; " - span: - line_start: 20 - line_stop: 20 - col_start: 5 - col_stop: 17 - path: "" - content: "r6: [[u8; 2]; 3] = [[0; 2]; 3]; " - type_: Tuple: - Boolean - Boolean - name: "{\"name\":\"r7\",\"span\":\"{\\\"line_start\\\":21,\\\"line_stop\\\":21,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r7: (bool, bool) = (true, false); \\\"}\"}" + name: "{\"name\":\"r7\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r7: (bool, bool) = (true, false); \\\"}\"}" value: TupleInit: elements: @@ -472,8 +310,8 @@ outputs: Boolean: - "true" - span: - line_start: 21 - line_stop: 21 + line_start: 17 + line_stop: 17 col_start: 21 col_stop: 25 path: "" @@ -482,29 +320,29 @@ outputs: Boolean: - "false" - span: - line_start: 21 - line_stop: 21 + line_start: 17 + line_stop: 17 col_start: 27 col_stop: 32 path: "" content: "r7: (bool, bool) = (true, false); " span: - line_start: 21 - line_stop: 21 + line_start: 17 + line_stop: 17 col_start: 20 col_stop: 33 path: "" content: "r7: (bool, bool) = (true, false); " span: - line_start: 21 - line_stop: 21 + line_start: 17 + line_stop: 17 col_start: 5 col_stop: 17 path: "" content: "r7: (bool, bool) = (true, false); " span: - line_start: 13 - line_stop: 13 + line_start: 11 + line_stop: 11 col_start: 2 col_stop: 11 path: "" @@ -512,68 +350,68 @@ outputs: - name: constants definitions: - type_: Boolean - name: "{\"name\":\"c0\",\"span\":\"{\\\"line_start\\\":24,\\\"line_stop\\\":24,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c0: bool = true; \\\"}\"}" + name: "{\"name\":\"c0\",\"span\":\"{\\\"line_start\\\":20,\\\"line_stop\\\":20,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c0: bool = true; \\\"}\"}" value: Value: Boolean: - "true" - span: - line_start: 24 - line_stop: 24 + line_start: 20 + line_stop: 20 col_start: 13 col_stop: 17 path: "" content: "c0: bool = true; " span: - line_start: 24 - line_stop: 24 + line_start: 20 + line_stop: 20 col_start: 5 col_stop: 9 path: "" content: "c0: bool = true; " - type_: IntegerType: U8 - name: "{\"name\":\"c1\",\"span\":\"{\\\"line_start\\\":25,\\\"line_stop\\\":25,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c1: u8 = 2; \\\"}\"}" + name: "{\"name\":\"c1\",\"span\":\"{\\\"line_start\\\":21,\\\"line_stop\\\":21,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c1: u8 = 2; \\\"}\"}" value: Value: Implicit: - "2" - span: - line_start: 25 - line_stop: 25 + line_start: 21 + line_stop: 21 col_start: 13 col_stop: 14 path: "" content: "c1: u8 = 2; " span: - line_start: 25 - line_stop: 25 + line_start: 21 + line_stop: 21 col_start: 5 col_stop: 7 path: "" content: "c1: u8 = 2; " - type_: Field - name: "{\"name\":\"c2\",\"span\":\"{\\\"line_start\\\":26,\\\"line_stop\\\":26,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c2: field = 0; \\\"}\"}" + name: "{\"name\":\"c2\",\"span\":\"{\\\"line_start\\\":22,\\\"line_stop\\\":22,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c2: field = 0; \\\"}\"}" value: Value: Implicit: - "0" - span: - line_start: 26 - line_stop: 26 + line_start: 22 + line_stop: 22 col_start: 13 col_stop: 14 path: "" content: "c2: field = 0; " span: - line_start: 26 - line_stop: 26 + line_start: 22 + line_stop: 22 col_start: 5 col_stop: 10 path: "" content: "c2: field = 0; " - type_: Group - name: "{\"name\":\"c3\",\"span\":\"{\\\"line_start\\\":27,\\\"line_stop\\\":27,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c3: group = (0, 1)group; \\\"}\"}" + name: "{\"name\":\"c3\",\"span\":\"{\\\"line_start\\\":23,\\\"line_stop\\\":23,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c3: group = (0, 1)group; \\\"}\"}" value: Value: Group: @@ -582,8 +420,8 @@ outputs: Number: - "0" - span: - line_start: 27 - line_stop: 27 + line_start: 23 + line_stop: 23 col_start: 14 col_stop: 15 path: "" @@ -592,132 +430,51 @@ outputs: Number: - "1" - span: - line_start: 27 - line_stop: 27 + line_start: 23 + line_stop: 23 col_start: 17 col_stop: 18 path: "" content: "c3: group = (0, 1)group; " span: - line_start: 27 - line_stop: 27 + line_start: 23 + line_stop: 23 col_start: 14 col_stop: 24 path: "" content: "c3: group = (0, 1)group; " span: - line_start: 27 - line_stop: 27 + line_start: 23 + line_stop: 23 col_start: 5 col_stop: 10 path: "" content: "c3: group = (0, 1)group; " - type_: Address - name: "{\"name\":\"c4\",\"span\":\"{\\\"line_start\\\":28,\\\"line_stop\\\":28,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}" + name: "{\"name\":\"c4\",\"span\":\"{\\\"line_start\\\":24,\\\"line_stop\\\":24,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}" value: Value: Address: - aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 - span: - line_start: 28 - line_stop: 28 + line_start: 24 + line_stop: 24 col_start: 15 col_stop: 78 path: "" content: "c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;" span: - line_start: 28 - line_stop: 28 + line_start: 24 + line_stop: 24 col_start: 5 col_stop: 12 path: "" content: "c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;" - - type_: - Array: - - IntegerType: U8 - - - value: "32" - name: "{\"name\":\"c5\",\"span\":\"{\\\"line_start\\\":29,\\\"line_stop\\\":29,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c5: [u8; 32] = [0; 32]; \\\"}\"}" - value: - ArrayInit: - element: - Value: - Implicit: - - "0" - - span: - line_start: 29 - line_stop: 29 - col_start: 17 - col_stop: 18 - path: "" - content: "c5: [u8; 32] = [0; 32]; " - dimensions: - - value: "32" - span: - line_start: 29 - line_stop: 29 - col_start: 16 - col_stop: 23 - path: "" - content: "c5: [u8; 32] = [0; 32]; " - span: - line_start: 29 - line_stop: 29 - col_start: 5 - col_stop: 13 - path: "" - content: "c5: [u8; 32] = [0; 32]; " - - type_: - Array: - - Array: - - IntegerType: U8 - - - value: "2" - - - value: "3" - name: "{\"name\":\"c6\",\"span\":\"{\\\"line_start\\\":30,\\\"line_stop\\\":30,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c6: [[u8; 2]; 3] = [[0; 2]; 3]; \\\"}\"}" - value: - ArrayInit: - element: - ArrayInit: - element: - Value: - Implicit: - - "0" - - span: - line_start: 30 - line_stop: 30 - col_start: 22 - col_stop: 23 - path: "" - content: "c6: [[u8; 2]; 3] = [[0; 2]; 3]; " - dimensions: - - value: "2" - span: - line_start: 30 - line_stop: 30 - col_start: 21 - col_stop: 27 - path: "" - content: "c6: [[u8; 2]; 3] = [[0; 2]; 3]; " - dimensions: - - value: "3" - span: - line_start: 30 - line_stop: 30 - col_start: 20 - col_stop: 31 - path: "" - content: "c6: [[u8; 2]; 3] = [[0; 2]; 3]; " - span: - line_start: 30 - line_stop: 30 - col_start: 5 - col_stop: 17 - path: "" - content: "c6: [[u8; 2]; 3] = [[0; 2]; 3]; " - type_: Tuple: - Boolean - Boolean - name: "{\"name\":\"c7\",\"span\":\"{\\\"line_start\\\":31,\\\"line_stop\\\":31,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c7: (bool, bool) = (true, false); \\\"}\"}" + name: "{\"name\":\"c7\",\"span\":\"{\\\"line_start\\\":25,\\\"line_stop\\\":25,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c7: (bool, bool) = (true, false); \\\"}\"}" value: TupleInit: elements: @@ -725,8 +482,8 @@ outputs: Boolean: - "true" - span: - line_start: 31 - line_stop: 31 + line_start: 25 + line_stop: 25 col_start: 21 col_stop: 25 path: "" @@ -735,29 +492,29 @@ outputs: Boolean: - "false" - span: - line_start: 31 - line_stop: 31 + line_start: 25 + line_stop: 25 col_start: 27 col_stop: 32 path: "" content: "c7: (bool, bool) = (true, false); " span: - line_start: 31 - line_stop: 31 + line_start: 25 + line_stop: 25 col_start: 20 col_stop: 33 path: "" content: "c7: (bool, bool) = (true, false); " span: - line_start: 31 - line_stop: 31 + line_start: 25 + line_stop: 25 col_start: 5 col_stop: 17 path: "" content: "c7: (bool, bool) = (true, false); " span: - line_start: 23 - line_stop: 23 + line_start: 19 + line_stop: 19 col_start: 2 col_stop: 11 path: "" diff --git a/tests/expectations/parser/parser/statement/alias.leo.out b/tests/expectations/parser/parser/statement/alias.leo.out index a00927c45b..331f6c8d79 100644 --- a/tests/expectations/parser/parser/statement/alias.leo.out +++ b/tests/expectations/parser/parser/statement/alias.leo.out @@ -40,18 +40,5 @@ outputs: content: type c = a; represents: Identifier: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type c = a;\\\"}\"}" - "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type b = [u8; 5];\\\"}\"}": - name: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type b = [u8; 5];\\\"}\"}" - span: - line_start: 9 - line_stop: 9 - col_start: 1 - col_stop: 18 - path: "" - content: "type b = [u8; 5];" - represents: - Array: - - IntegerType: U8 - - - value: "5" global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/statement/assign.leo.out b/tests/expectations/parser/parser/statement/assign.leo.out index b0ccc8ac1b..1e9bf73cba 100644 --- a/tests/expectations/parser/parser/statement/assign.leo.out +++ b/tests/expectations/parser/parser/statement/assign.leo.out @@ -147,277 +147,6 @@ outputs: col_stop: 8 path: "" content: x = x(); - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] = y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[0] = y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x[0] = y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "x[0] = y;" - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] = y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Integer: - - U32 - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 7 - path: "" - content: "x[0u32] = y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x[0u32] = y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "x[0u32] = y;" - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 = y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 = y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 = y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: x.0 = y; - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2] = y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[1..2] = y;" - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "x[1..2] = y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x[1..2] = y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2] = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "x[1..2] = y;" - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2] = y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x[..2] = y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: "x[..2] = y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2] = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x[..2] = y;" - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..] = y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[2..] = y;" - - ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: "x[2..] = y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..] = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x[2..] = y;" - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..] = y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: "x[..] = y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..] = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[..] = y;" - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..] = y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0[0][..] = y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x.0[0][..] = y;" - - ArrayRange: - - ~ - - ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x.0[0][..] = y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..] = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x.0[0][..] = y;" - Assign: operation: Assign assignee: @@ -440,114 +169,6 @@ outputs: col_stop: 8 path: "" content: x.y = y; - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3] = y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3] = y;\\\"}\"}" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - - Tuple: - - value: "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3] = y;\\\"}\"}" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 18 - col_stop: 19 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 21 - col_stop: 22 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - - Value: - Implicit: - - "5" - - span: - line_start: 1 - line_stop: 1 - col_start: 24 - col_stop: 25 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - - ArrayRange: - - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 27 - col_stop: 28 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - - Value: - Implicit: - - "3" - - span: - line_start: 1 - line_stop: 1 - col_start: 30 - col_stop: 31 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 32 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":35,\\\"col_stop\\\":36,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3] = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 36 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - Assign: operation: Add assignee: @@ -662,71 +283,6 @@ outputs: col_stop: 9 path: "" content: x += x(); - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] += y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[0] += y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x[0] += y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[0] += y;" - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] += y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Integer: - - U32 - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 7 - path: "" - content: "x[0u32] += y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x[0u32] += y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "x[0u32] += y;" - Assign: operation: Add assignee: @@ -757,237 +313,6 @@ outputs: col_stop: 9 path: "" content: x.0 += y; - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] += y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[1..2][0] += y;" - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "x[1..2][0] += y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 10 - path: "" - content: "x[1..2][0] += y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x[1..2][0] += y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "x[1..2][0] += y;" - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] += y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x[..2][0] += y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[..2][0] += y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[..2][0] += y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x[..2][0] += y;" - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] += y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[2..][0] += y;" - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[2..][0] += y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[2..][0] += y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x[2..][0] += y;" - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] += y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x[..][0] += y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "x[..][0] += y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "x[..][0] += y;" - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] += y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0[0][..][0] += y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x.0[0][..][0] += y;" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 13 - path: "" - content: "x.0[0][..][0] += y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "x.0[0][..][0] += y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 19 - path: "" - content: "x.0[0][..][0] += y;" - Assign: operation: Add assignee: @@ -1010,125 +335,6 @@ outputs: col_stop: 9 path: "" content: x.y += y; - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] += y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] += y;\\\"}\"}" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - - Tuple: - - value: "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] += y;\\\"}\"}" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 18 - col_stop: 19 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 21 - col_stop: 22 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - - Value: - Implicit: - - "5" - - span: - line_start: 1 - line_stop: 1 - col_start: 24 - col_stop: 25 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - - ArrayRange: - - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 27 - col_stop: 28 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - - Value: - Implicit: - - "3" - - span: - line_start: 1 - line_stop: 1 - col_start: 30 - col_stop: 31 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 33 - col_stop: 34 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 35 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":39,\\\"col_stop\\\":40,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 40 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - Assign: operation: Sub assignee: @@ -1243,332 +449,6 @@ outputs: col_stop: 9 path: "" content: x -= x(); - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] -= y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[0] -= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x[0] -= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[0] -= y;" - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] -= y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Integer: - - U32 - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 7 - path: "" - content: "x[0u32] -= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x[0u32] -= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "x[0u32] -= y;" - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 -= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 -= y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 -= y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x.0 -= y; - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] -= y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[1..2][0] -= y;" - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "x[1..2][0] -= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 10 - path: "" - content: "x[1..2][0] -= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x[1..2][0] -= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "x[1..2][0] -= y;" - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] -= y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x[..2][0] -= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[..2][0] -= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[..2][0] -= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x[..2][0] -= y;" - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] -= y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[2..][0] -= y;" - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[2..][0] -= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[2..][0] -= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x[2..][0] -= y;" - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] -= y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x[..][0] -= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "x[..][0] -= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "x[..][0] -= y;" - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] -= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0[0][..][0] -= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x.0[0][..][0] -= y;" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 13 - path: "" - content: "x.0[0][..][0] -= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "x.0[0][..][0] -= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 19 - path: "" - content: "x.0[0][..][0] -= y;" - Assign: operation: Sub assignee: @@ -1591,125 +471,6 @@ outputs: col_stop: 9 path: "" content: x.y -= y; - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;\\\"}\"}" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - - Tuple: - - value: "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;\\\"}\"}" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 18 - col_stop: 19 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 21 - col_stop: 22 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - - Value: - Implicit: - - "5" - - span: - line_start: 1 - line_stop: 1 - col_start: 24 - col_stop: 25 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - - ArrayRange: - - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 27 - col_stop: 28 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - - Value: - Implicit: - - "3" - - span: - line_start: 1 - line_stop: 1 - col_start: 30 - col_stop: 31 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 33 - col_stop: 34 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 35 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":39,\\\"col_stop\\\":40,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 40 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - Assign: operation: Mul assignee: @@ -1824,71 +585,6 @@ outputs: col_stop: 9 path: "" content: x *= x(); - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] *= y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[0] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x[0] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[0] *= y;" - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] *= y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Integer: - - U32 - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 7 - path: "" - content: "x[0u32] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x[0u32] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "x[0u32] *= y;" - Assign: operation: Mul assignee: @@ -1919,237 +615,6 @@ outputs: col_stop: 9 path: "" content: x.0 *= y; - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] *= y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[1..2][0] *= y;" - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "x[1..2][0] *= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 10 - path: "" - content: "x[1..2][0] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x[1..2][0] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "x[1..2][0] *= y;" - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] *= y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x[..2][0] *= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[..2][0] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[..2][0] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x[..2][0] *= y;" - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] *= y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[2..][0] *= y;" - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[2..][0] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[2..][0] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x[2..][0] *= y;" - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] *= y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x[..][0] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "x[..][0] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "x[..][0] *= y;" - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] *= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0[0][..][0] *= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x.0[0][..][0] *= y;" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 13 - path: "" - content: "x.0[0][..][0] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "x.0[0][..][0] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 19 - path: "" - content: "x.0[0][..][0] *= y;" - Assign: operation: Mul assignee: @@ -2172,125 +637,6 @@ outputs: col_stop: 9 path: "" content: x.y *= y; - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;\\\"}\"}" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - - Tuple: - - value: "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;\\\"}\"}" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 18 - col_stop: 19 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 21 - col_stop: 22 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - - Value: - Implicit: - - "5" - - span: - line_start: 1 - line_stop: 1 - col_start: 24 - col_stop: 25 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - - ArrayRange: - - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 27 - col_stop: 28 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - - Value: - Implicit: - - "3" - - span: - line_start: 1 - line_stop: 1 - col_start: 30 - col_stop: 31 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 33 - col_stop: 34 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 35 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":39,\\\"col_stop\\\":40,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 40 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - Assign: operation: Div assignee: @@ -2405,71 +751,6 @@ outputs: col_stop: 9 path: "" content: x /= x(); - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] /= y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[0] /= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x[0] /= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[0] /= y;" - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] /= y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Integer: - - U32 - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 7 - path: "" - content: "x[0u32] /= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x[0u32] /= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "x[0u32] /= y;" - Assign: operation: Div assignee: @@ -2500,237 +781,6 @@ outputs: col_stop: 9 path: "" content: x.0 /= y; - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] /= y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[1..2][0] /= y;" - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "x[1..2][0] /= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 10 - path: "" - content: "x[1..2][0] /= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x[1..2][0] /= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "x[1..2][0] /= y;" - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] /= y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x[..2][0] /= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[..2][0] /= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[..2][0] /= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x[..2][0] /= y;" - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] /= y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[2..][0] /= y;" - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[2..][0] /= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[2..][0] /= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x[2..][0] /= y;" - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] /= y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x[..][0] /= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "x[..][0] /= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "x[..][0] /= y;" - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] /= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0[0][..][0] /= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x.0[0][..][0] /= y;" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 13 - path: "" - content: "x.0[0][..][0] /= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "x.0[0][..][0] /= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 19 - path: "" - content: "x.0[0][..][0] /= y;" - Assign: operation: Div assignee: @@ -2753,125 +803,6 @@ outputs: col_stop: 9 path: "" content: x.y /= y; - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;\\\"}\"}" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - - Tuple: - - value: "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;\\\"}\"}" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 18 - col_stop: 19 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 21 - col_stop: 22 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - - Value: - Implicit: - - "5" - - span: - line_start: 1 - line_stop: 1 - col_start: 24 - col_stop: 25 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - - ArrayRange: - - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 27 - col_stop: 28 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - - Value: - Implicit: - - "3" - - span: - line_start: 1 - line_stop: 1 - col_start: 30 - col_stop: 31 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 33 - col_stop: 34 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 35 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":39,\\\"col_stop\\\":40,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 40 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - Assign: operation: Pow assignee: @@ -2986,71 +917,6 @@ outputs: col_stop: 10 path: "" content: x **= x(); - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] *= y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[0] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x[0] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[0] *= y;" - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] *= y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Integer: - - U32 - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 7 - path: "" - content: "x[0u32] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x[0u32] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "x[0u32] *= y;" - Assign: operation: Pow assignee: @@ -3081,237 +947,6 @@ outputs: col_stop: 10 path: "" content: x.0 **= y; - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] **= y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[1..2][0] **= y;" - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "x[1..2][0] **= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 10 - path: "" - content: "x[1..2][0] **= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x[1..2][0] **= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] **= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 17 - path: "" - content: "x[1..2][0] **= y;" - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] **= y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x[..2][0] **= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[..2][0] **= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[..2][0] **= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] **= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "x[..2][0] **= y;" - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] **= y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[2..][0] **= y;" - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[2..][0] **= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[2..][0] **= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] **= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "x[2..][0] **= y;" - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] **= y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x[..][0] **= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "x[..][0] **= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] **= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x[..][0] **= y;" - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] **= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0[0][..][0] **= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x.0[0][..][0] **= y;" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 13 - path: "" - content: "x.0[0][..][0] **= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "x.0[0][..][0] **= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":19,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] **= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 20 - path: "" - content: "x.0[0][..][0] **= y;" - Assign: operation: Pow assignee: @@ -3334,122 +969,3 @@ outputs: col_stop: 10 path: "" content: x.y **= y; - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;\\\"}\"}" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - - Tuple: - - value: "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;\\\"}\"}" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 18 - col_stop: 19 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 21 - col_stop: 22 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - - Value: - Implicit: - - "5" - - span: - line_start: 1 - line_stop: 1 - col_start: 24 - col_stop: 25 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - - ArrayRange: - - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 27 - col_stop: 28 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - - Value: - Implicit: - - "3" - - span: - line_start: 1 - line_stop: 1 - col_start: 30 - col_stop: 31 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 33 - col_stop: 34 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 35 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":40,\\\"col_stop\\\":41,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 41 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" diff --git a/tests/expectations/parser/parser/statement/assign_fail.leo.out b/tests/expectations/parser/parser/statement/assign_fail.leo.out index 040454f134..86a87f809d 100644 --- a/tests/expectations/parser/parser/statement/assign_fail.leo.out +++ b/tests/expectations/parser/parser/statement/assign_fail.leo.out @@ -9,8 +9,8 @@ outputs: - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | !x = y;\n | ^^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | a? x : x = y;\n | ^^^^^^^^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x as u32 = y;\n | ^^^^^^^^" - - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | [x, x, x] = y;\n | ^^^^^^^^^" - - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | [x; 3] = y;\n | ^^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [x, x, x] = y;\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [x; 3] = y;\n | ^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | (x, x, x) = y;\n | ^^^^^^^^^" - "Error [EPAR0370005]: expected ; -- got '{'\n --> test:1:3\n |\n 1 | x {x: y, y: z} = y;\n | ^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x() = y;\n | ^^^" diff --git a/tests/expectations/parser/parser/statement/definition.leo.out b/tests/expectations/parser/parser/statement/definition.leo.out index ca3527b280..e55ecc0284 100644 --- a/tests/expectations/parser/parser/statement/definition.leo.out +++ b/tests/expectations/parser/parser/statement/definition.leo.out @@ -1441,203 +1441,6 @@ outputs: col_stop: 16 path: "" content: "let (x,y,) = ();" - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x: [[u8; 2]; 2] = [[0,0], [0,0]];\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];" - type_: - Array: - - Array: - - IntegerType: U8 - - - value: "2" - - - value: "2" - value: - ArrayInline: - elements: - - Expression: - ArrayInline: - elements: - - Expression: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 25 - col_stop: 26 - path: "" - content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];" - - Expression: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 27 - col_stop: 28 - path: "" - content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];" - span: - line_start: 1 - line_stop: 1 - col_start: 24 - col_stop: 29 - path: "" - content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];" - - Expression: - ArrayInline: - elements: - - Expression: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 32 - col_stop: 33 - path: "" - content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];" - - Expression: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 34 - col_stop: 35 - path: "" - content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];" - span: - line_start: 1 - line_stop: 1 - col_start: 31 - col_stop: 36 - path: "" - content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];" - span: - line_start: 1 - line_stop: 1 - col_start: 23 - col_stop: 37 - path: "" - content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 37 - path: "" - content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];" - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x: [u8; (2, 2)] = [[0,0], [0,0]];\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];" - type_: - Array: - - IntegerType: U8 - - - value: "2" - - value: "2" - value: - ArrayInline: - elements: - - Expression: - ArrayInline: - elements: - - Expression: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 25 - col_stop: 26 - path: "" - content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];" - - Expression: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 27 - col_stop: 28 - path: "" - content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];" - span: - line_start: 1 - line_stop: 1 - col_start: 24 - col_stop: 29 - path: "" - content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];" - - Expression: - ArrayInline: - elements: - - Expression: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 32 - col_stop: 33 - path: "" - content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];" - - Expression: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 34 - col_stop: 35 - path: "" - content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];" - span: - line_start: 1 - line_stop: 1 - col_start: 31 - col_stop: 36 - path: "" - content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];" - span: - line_start: 1 - line_stop: 1 - col_start: 23 - col_stop: 37 - path: "" - content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 37 - path: "" - content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];" - Definition: declaration_type: Let variable_names: diff --git a/tests/expectations/parser/parser/statement/definition_fail.leo.out b/tests/expectations/parser/parser/statement/definition_fail.leo.out index 869c0238aa..080bf09d84 100644 --- a/tests/expectations/parser/parser/statement/definition_fail.leo.out +++ b/tests/expectations/parser/parser/statement/definition_fail.leo.out @@ -25,7 +25,7 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:10\n |\n 1 | let (x,y,,) = ();\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:6\n |\n 1 | let (,x,y) = ();\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:8\n |\n 1 | let (x,,y) = ();\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'int', got ','\n --> test:1:16\n |\n 1 | let x: [u8; (2,,)] = [[0,0], [0,0]];\n | ^\nError [EPAR0370039]: do not put parens around single dimension array size\n --> test:1:13\n |\n 1 | let x: [u8; (2,,)] = [[0,0], [0,0]];\n | ^^^^^" + - "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got '['\n --> test:1:8\n |\n 1 | let x: [u8; (2,,)] = [[0,0], [0,0]];\n | ^" - "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got 'const'\n --> test:1:8\n |\n 1 | let x: const = expr;\n | ^^^^^" - "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got 'let'\n --> test:1:10\n |\n 1 | const x: let = expr;\n | ^^^" - "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got 'mut'\n --> test:1:8\n |\n 1 | let x: mut = expr;\n | ^^^" @@ -39,10 +39,10 @@ outputs: - "Error [EPAR0370005]: expected = -- got ';'\n --> test:1:10\n |\n 1 | let x: u8;\n | ^" - "Error [EPAR0370003]: unexpected EOF\n --> test:1:8\n |\n 1 | let x: u8\n | ^^" - "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got '='\n --> test:1:8\n |\n 1 | let x: = 1;\n | ^" - - "Error [EPAR0370005]: expected ; -- got ']'\n --> test:1:11\n |\n 1 | let x: [u8] = 1;\n | ^" - - "Error [EPAR0370003]: unexpected EOF\n --> test:1:11\n |\n 1 | let x: [u8;\n | ^" - - "Error [EPAR0370005]: expected ] -- got 'u8'\n --> test:1:14\n |\n 1 | let x: [u8; 1u8] = [1,\n | ^^" + - "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got '['\n --> test:1:8\n |\n 1 | let x: [u8] = 1;\n | ^" + - "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got '['\n --> test:1:8\n |\n 1 | let x: [u8;\n | ^" + - "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got '['\n --> test:1:8\n |\n 1 | let x: [u8; 1u8] = [1,\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ']'\n --> test:1:15\n |\n 1 | let dbg: u8 = ];\n | ^" - "Error [EPAR0370030]: Could not lex the following content: `🦀: u8 = 0;`." - - "Error [EPAR0370038]: do not put parens around single variable names\n --> test:1:6\n |\n 1 | let (x) = ...;\n | ^\nError [EPAR0370009]: unexpected string: expected 'expression', got '...'\n --> test:1:11\n |\n 1 | let (x) = ...;\n | ^^^" - - "Error [EPAR0370038]: do not put parens around single variable names\n --> test:1:6\n |\n 1 | let (x,) = ...;\n | ^\nError [EPAR0370009]: unexpected string: expected 'expression', got '...'\n --> test:1:12\n |\n 1 | let (x,) = ...;\n | ^^^" + - "Error [EPAR0370038]: do not put parens around single variable names\n --> test:1:6\n |\n 1 | let (x) = ...;\n | ^\nError [EPAR0370009]: unexpected string: expected 'expression', got '..'\n --> test:1:11\n |\n 1 | let (x) = ...;\n | ^^" + - "Error [EPAR0370038]: do not put parens around single variable names\n --> test:1:6\n |\n 1 | let (x,) = ...;\n | ^\nError [EPAR0370009]: unexpected string: expected 'expression', got '..'\n --> test:1:12\n |\n 1 | let (x,) = ...;\n | ^^" diff --git a/tests/expectations/parser/parser/statement/expression_fail.leo.out b/tests/expectations/parser/parser/statement/expression_fail.leo.out index 51218ebaa7..9d5ba21531 100644 --- a/tests/expectations/parser/parser/statement/expression_fail.leo.out +++ b/tests/expectations/parser/parser/statement/expression_fail.leo.out @@ -3,8 +3,8 @@ namespace: ParseStatement expectation: Fail outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', got ']'\n --> test:1:2\n |\n 1 | (];\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got ')'\n --> test:1:2\n |\n 1 | [);\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [);\n | ^" - "Error [EPAR0370030]: Could not lex the following content: `\\y;`." - "Error [EPAR0370040]: Found the char `;`, but expected `|`" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '}'\n --> test:1:3\n |\n 1 | x[};\n | ^" + - "Error [EPAR0370005]: expected ; -- got '['\n --> test:1:2\n |\n 1 | x[};\n | ^" - "Error [EPAR0370005]: expected ) -- got ']'\n --> test:1:6\n |\n 1 | (x, y];\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/define.leo.out b/tests/expectations/parser/parser/unreachable/define.leo.out index 28c899302b..f8eba9a3e3 100644 --- a/tests/expectations/parser/parser/unreachable/define.leo.out +++ b/tests/expectations/parser/parser/unreachable/define.leo.out @@ -6,7 +6,7 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', got '.'\n --> test:1:1\n |\n 1 | . x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'import'\n --> test:1:1\n |\n 1 | import x = 10u8;\n | ^^^^^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:1\n |\n 1 | , x = 10u8;\n | ^" - - "Error [EPAR0370005]: expected , -- got '='\n --> test:1:5\n |\n 1 | [ x = 10u8;\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [ x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ']'\n --> test:1:1\n |\n 1 | ] x = 10u8;\n | ^" - "Error [EPAR0370003]: unexpected EOF\n --> test:1:11\n |\n 1 | { x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '}'\n --> test:1:1\n |\n 1 | } x = 10u8;\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out b/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out index a08b9f50ff..43975e39c2 100644 --- a/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out +++ b/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out @@ -5,7 +5,7 @@ outputs: - "did not consume all input: 'b' @ 1:13-14\n';' @ 1:14-15\n" - "Error [EPAR0370005]: expected ; -- got 'import'\n --> test:1:11\n |\n 1 | let x = a import b;\n | ^^^^^^" - "Error [EPAR0370005]: expected ; -- got ','\n --> test:1:11\n |\n 1 | let x = a , b;\n | ^" - - "Error [EPAR0370005]: expected ] -- got ';'\n --> test:1:14\n |\n 1 | let x = a [ b;\n | ^" + - "Error [EPAR0370005]: expected ; -- got '['\n --> test:1:11\n |\n 1 | let x = a [ b;\n | ^" - "Error [EPAR0370005]: expected ; -- got ']'\n --> test:1:11\n |\n 1 | let x = a ] b;\n | ^" - "Error [EPAR0370005]: expected ; -- got '{'\n --> test:1:11\n |\n 1 | let x = a { b;\n | ^" - "Error [EPAR0370005]: expected ; -- got '}'\n --> test:1:11\n |\n 1 | let x = a } b;\n | ^" @@ -43,7 +43,7 @@ outputs: - "did not consume all input: '=' @ 1:3-4\n'b' @ 1:4-5\n';' @ 1:5-6\n" - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '='\n --> test:1:3\n |\n 1 | x.=b;\n | ^" - "Error [EPAR0370005]: expected ; -- got ','\n --> test:1:2\n |\n 1 | x,=b; // 43\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:3\n |\n 1 | x[=b;\n | ^" + - "Error [EPAR0370005]: expected ; -- got '['\n --> test:1:2\n |\n 1 | x[=b;\n | ^" - "Error [EPAR0370005]: expected ; -- got ']'\n --> test:1:2\n |\n 1 | x]=b;\n | ^" - "Error [EPAR0370005]: expected ; -- got '{'\n --> test:1:2\n |\n 1 | x{=b;\n | ^" - "Error [EPAR0370005]: expected ; -- got '}'\n --> test:1:2\n |\n 1 | x}=b;\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/postfix_fail.leo.out b/tests/expectations/parser/parser/unreachable/postfix_fail.leo.out index e5c6b15e5a..582b63369f 100644 --- a/tests/expectations/parser/parser/unreachable/postfix_fail.leo.out +++ b/tests/expectations/parser/parser/unreachable/postfix_fail.leo.out @@ -5,7 +5,7 @@ outputs: - "did not consume all input: ';' @ 1:11-12\n" - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got ';'\n --> test:1:11\n |\n 1 | let x = a.;\n | ^" - "Error [EPAR0370005]: expected ; -- got ','\n --> test:1:10\n |\n 1 | let x = a,;\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got ';'\n --> test:1:11\n |\n 1 | let x = a[;\n | ^" + - "Error [EPAR0370005]: expected ; -- got '['\n --> test:1:10\n |\n 1 | let x = a[;\n | ^" - "Error [EPAR0370005]: expected ; -- got ']'\n --> test:1:10\n |\n 1 | let x = a];\n | ^" - "Error [EPAR0370005]: expected ; -- got '{'\n --> test:1:10\n |\n 1 | let x = a{;\n | ^" - "Error [EPAR0370005]: expected ; -- got '}'\n --> test:1:10\n |\n 1 | let x = a};\n | ^" diff --git a/tests/parser/expression/access/array_access.leo b/tests/parser/expression/access/array_access.leo deleted file mode 100644 index 85b00b31dd..0000000000 --- a/tests/parser/expression/access/array_access.leo +++ /dev/null @@ -1,13 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -x[0] -X[1] -x[0u8] -x[1u8][2u8] -x[x][y][z] -x[0]() -x()[0] -x[x].0[x] \ No newline at end of file diff --git a/tests/parser/expression/access/array_range_access.leo b/tests/parser/expression/access/array_range_access.leo deleted file mode 100644 index 4ae4f62c3f..0000000000 --- a/tests/parser/expression/access/array_range_access.leo +++ /dev/null @@ -1,22 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -x[..] -x[1..] -x[..1] -x[1..1] -x[0..100] - -x[323452345.2345234523453453][323452345.2345234523453453] - -x[0u8..1u8] -x[0u8..] -x[..0u8] - -x[..] -x[x.y..] -x[..y.x] -x[x.y..y.x] -x[x.y.x..y.x.y] diff --git a/tests/parser/expression/access/call.leo b/tests/parser/expression/access/call.leo index b800b3842b..d0d1694350 100644 --- a/tests/parser/expression/access/call.leo +++ b/tests/parser/expression/access/call.leo @@ -9,4 +9,3 @@ x(y) x(y, z) x(x, y, z) x.0(x) -x[0](x) diff --git a/tests/parser/expression/access/circuit.leo b/tests/parser/expression/access/circuit.leo index ced0211988..58b9a1b3a2 100644 --- a/tests/parser/expression/access/circuit.leo +++ b/tests/parser/expression/access/circuit.leo @@ -7,5 +7,4 @@ x.y X.Y x.y.z x.y() -x.y.0 -x.y[1] \ No newline at end of file +x.y.0 \ No newline at end of file diff --git a/tests/parser/expression/array_init.leo b/tests/parser/expression/array_init.leo deleted file mode 100644 index 38826f66e7..0000000000 --- a/tests/parser/expression/array_init.leo +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -[0u8; 1] - -[0; 1] - -[0; (1, 2)] - -[0; (1, 2,)] - -[0; (1, 2, 3)] - -[[[0; 3]; 2]; 1] diff --git a/tests/parser/expression/array_inline.leo b/tests/parser/expression/array_inline.leo deleted file mode 100644 index 5dc6746f17..0000000000 --- a/tests/parser/expression/array_inline.leo +++ /dev/null @@ -1,24 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -[0u8, 1, 2, 3] - -[1] - -[1u8] - -[1u8,] - -[0, 1,] - -[0,1,] - -[] - -[[1,2,3],[1,2,3]] - -[[]] - -[[], []] \ No newline at end of file diff --git a/tests/parser/expression/array_len.leo b/tests/parser/expression/array_len.leo deleted file mode 100644 index eb59228e67..0000000000 --- a/tests/parser/expression/array_len.leo +++ /dev/null @@ -1,14 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -[0u8; 1].len() - -[0; 1].len() - -[0; (1, 2)].len() - -[0; (1, 2, 3)].len() - -[[[0; 3]; 2]; 1].len() diff --git a/tests/parser/functions/param_array.leo b/tests/parser/functions/param_array.leo deleted file mode 100644 index 36e5bbb930..0000000000 --- a/tests/parser/functions/param_array.leo +++ /dev/null @@ -1,8 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -function x(x: [u8; 12]) { - return (); -} \ No newline at end of file diff --git a/tests/parser/functions/param_circuit.leo b/tests/parser/functions/param_circuit.leo deleted file mode 100644 index dbffe0608c..0000000000 --- a/tests/parser/functions/param_circuit.leo +++ /dev/null @@ -1,8 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -function x(x: MyCircuit) { - return (); -} \ No newline at end of file diff --git a/tests/parser/inputs/input_success.leo b/tests/parser/inputs/input_success.leo index fae8348174..81e778f200 100644 --- a/tests/parser/inputs/input_success.leo +++ b/tests/parser/inputs/input_success.leo @@ -9,8 +9,6 @@ b: u8 = 2; c: field = 0; d: group = (0, 1)group; e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; -f: [u8; 32] = [0; 32]; -g: [[u8; 2]; 3] = [[0; 2]; 3]; h: (bool, bool) = (true, false); [registers] @@ -19,8 +17,6 @@ r1: u8 = 2; r2: field = 0; r3: group = (0, 1)group; r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; -r5: [u8; 32] = [0; 32]; -r6: [[u8; 2]; 3] = [[0; 2]; 3]; r7: (bool, bool) = (true, false); [constants] @@ -29,6 +25,4 @@ c1: u8 = 2; c2: field = 0; c3: group = (0, 1)group; c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; -c5: [u8; 32] = [0; 32]; -c6: [[u8; 2]; 3] = [[0; 2]; 3]; c7: (bool, bool) = (true, false); diff --git a/tests/parser/serialize/palindrome.leo b/tests/parser/serialize/palindrome.leo deleted file mode 100644 index 6825d668c5..0000000000 --- a/tests/parser/serialize/palindrome.leo +++ /dev/null @@ -1,63 +0,0 @@ -/* -namespace: Serialize -expectation: Pass -*/ - -// This Program takes in any 20-byte low register string and tells -// whether a string is a palindrome ignoring any spaces. - -function main(str: [char; 20]) -> bool { - return is_palindrome(str); -} - -function is_palindrome(str: [char; 20]) -> bool { - const str_len = 20u32; // saving const for convenience - - // By default we assume that input is a palindrome. - let result = true; - let processed = 0u8; - - for start in 0..(str_len / 2) { - let start_sym = str[start]; - if start_sym != ' ' { - let skipped = 0u8; - let end_empty = 0u8; - let end_sym = ' '; - - for end in (str_len - 1)..start { - if str[end] != ' ' && skipped == processed && end_sym == ' ' { - end_sym = str[end]; - } else { - end_empty = end_empty + 1; - if str[end] != ' ' { - skipped = skipped + 1; - } - } - } - - // If there are symbols left to the right from the start. - if end_sym != ' ' { - console.log("Comparing: {} ? {}", start_sym, end_sym); - - if result { - result = (start_sym == end_sym); - } - - processed = processed + 1; - } - } - } - - console.log("Result is: {}", result); - - return result; -} - -function test_is_palindrome() { - console.assert(is_palindrome("a b a ")); - console.assert(is_palindrome("😀😀😀😀😀 😀😀😀😀😀")); - console.assert(is_palindrome("borrow or rob ")); - console.assert(is_palindrome("bbbb aaaa aaaa bbbb")); - console.assert(is_palindrome("aaaaaaaaaaaaaaaaaaaa")); - console.assert(is_palindrome("taco cat ")); -} diff --git a/tests/parser/statement/alias.leo b/tests/parser/statement/alias.leo index 119df41acc..5c395301f9 100644 --- a/tests/parser/statement/alias.leo +++ b/tests/parser/statement/alias.leo @@ -8,5 +8,3 @@ type a = u32; type b = string; type c = a; - -type b = [u8; 5]; \ No newline at end of file diff --git a/tests/parser/statement/assign.leo b/tests/parser/statement/assign.leo index e5587ae045..e757f617e3 100644 --- a/tests/parser/statement/assign.leo +++ b/tests/parser/statement/assign.leo @@ -13,29 +13,8 @@ x = (x,y); x = x(); - -x[0] = y; - -x[0u32] = y; - -x.0 = y; - -x[1..2] = y; - -x[..2] = y; - -x[2..] = y; - -x[..] = y; - -x.0[0][..] = y; - x.y = y; -x.0.y[0].1.y[..][0][1..5][0..3] = y; - - - x += expr; x += (); @@ -44,29 +23,10 @@ x += x+y; x += x(); - -x[0] += y; - -x[0u32] += y; - x.0 += y; -x[1..2][0] += y; - -x[..2][0] += y; - -x[2..][0] += y; - -x[..][0] += y; - -x.0[0][..][0] += y; - x.y += y; -x.0.y[0].1.y[..][0][1..5][0..3][0] += y; - - - x -= expr; x -= (); @@ -75,29 +35,8 @@ x -= x+y; x -= x(); - -x[0] -= y; - -x[0u32] -= y; - -x.0 -= y; - -x[1..2][0] -= y; - -x[..2][0] -= y; - -x[2..][0] -= y; - -x[..][0] -= y; - -x.0[0][..][0] -= y; - x.y -= y; -x.0.y[0].1.y[..][0][1..5][0..3][0] -= y; - - - x *= expr; x *= (); @@ -106,28 +45,10 @@ x *= x+y; x *= x(); - -x[0] *= y; - -x[0u32] *= y; - x.0 *= y; -x[1..2][0] *= y; - -x[..2][0] *= y; - -x[2..][0] *= y; - -x[..][0] *= y; - -x.0[0][..][0] *= y; - x.y *= y; -x.0.y[0].1.y[..][0][1..5][0..3][0] *= y; - - x /= expr; @@ -137,28 +58,10 @@ x /= x+y; x /= x(); - -x[0] /= y; - -x[0u32] /= y; - x.0 /= y; -x[1..2][0] /= y; - -x[..2][0] /= y; - -x[2..][0] /= y; - -x[..][0] /= y; - -x.0[0][..][0] /= y; - x.y /= y; -x.0.y[0].1.y[..][0][1..5][0..3][0] /= y; - - x **= expr; @@ -169,22 +72,7 @@ x **= x+y; x **= x(); -x[0] *= y; - -x[0u32] *= y; x.0 **= y; -x[1..2][0] **= y; - -x[..2][0] **= y; - -x[2..][0] **= y; - -x[..][0] **= y; - -x.0[0][..][0] **= y; - x.y **= y; - -x.0.y[0].1.y[..][0][1..5][0..3][0] **= y; \ No newline at end of file diff --git a/tests/parser/statement/definition.leo b/tests/parser/statement/definition.leo index 1e10103111..841bd438ed 100644 --- a/tests/parser/statement/definition.leo +++ b/tests/parser/statement/definition.leo @@ -97,9 +97,4 @@ const (x, y): u32 = x(); let (x,y,) = (); -let x: [[u8; 2]; 2] = [[0,0], [0,0]]; - -let x: [u8; (2, 2)] = [[0,0], [0,0]]; - - let x: address = aleo15u4r0gzjtqzepkgurgn7p3u5kkhs9p74rx6aun3uh2s5std6759svgmg53; From 78b04ff00055144a79bc25d9f1b51dfeb11585d7 Mon Sep 17 00:00:00 2001 From: gluax <16431709+gluax@users.noreply.github.com> Date: Mon, 28 Mar 2022 07:42:23 -0700 Subject: [PATCH 07/10] remove as and imports --- compiler/ast/src/expression/cast.rs | 46 ------ compiler/ast/src/expression/mod.rs | 7 - compiler/ast/src/imports/mod.rs | 119 --------------- compiler/ast/src/lib.rs | 3 - compiler/ast/src/program.rs | 21 +-- .../src/reducer/reconstructing_director.rs | 67 +-------- .../ast/src/reducer/reconstructing_reducer.rs | 23 --- compiler/parser/src/parser/expression.rs | 23 +-- compiler/parser/src/parser/file.rs | 78 +--------- compiler/parser/src/test.rs | 22 --- compiler/parser/src/tokenizer/lexer.rs | 2 - compiler/parser/src/tokenizer/mod.rs | 5 +- compiler/parser/src/tokenizer/token.rs | 11 -- leo/span/src/symbol.rs | 2 - .../parser/expression/binary/exp.leo.out | 138 ------------------ .../parser/expression/literal/comment.leo.out | 2 - .../parser/expression/token_format.leo.out | 2 - .../functions/bounded_recursion.leo.out | 2 - .../parser/functions/const_function.leo.out | 2 - .../parser/functions/const_param.leo.out | 2 - .../parser/parser/functions/empty.leo.out | 2 - .../parser/parser/functions/empty2.leo.out | 2 - .../parser/functions/ident_token_fail.leo.out | 2 +- .../functions/infinite_recursion.leo.out | 2 - .../parser/functions/param_tuple.leo.out | 2 - .../parser/parser/functions/params.leo.out | 2 - .../parser/functions/params_return.leo.out | 2 - .../parser/parser/functions/return.leo.out | 2 - .../parser/functions/return_tuple.leo.out | 2 - .../parser/serialize/one_plus_one.leo.out | 2 - .../parser/serialize/parser_error.leo.out | 2 +- .../parser/parser/statement/alias.leo.out | 2 - .../parser/statement/assign_fail.leo.out | 2 +- .../parser/statement/global_const.leo.out | 2 - .../parser/parser/unreachable/define.leo.out | 4 +- .../parser/unreachable/math_op_pass.leo.out | 75 ---------- tests/parser/expression/binary/exp.leo | 4 - tests/parser/expression/cast.leo | 16 -- tests/parser/expression/token_format.leo | 4 - tests/parser/unreachable/math_op_pass.leo | 6 - 40 files changed, 13 insertions(+), 701 deletions(-) delete mode 100644 compiler/ast/src/expression/cast.rs delete mode 100644 compiler/ast/src/imports/mod.rs delete mode 100644 tests/parser/expression/cast.leo diff --git a/compiler/ast/src/expression/cast.rs b/compiler/ast/src/expression/cast.rs deleted file mode 100644 index 525618996c..0000000000 --- a/compiler/ast/src/expression/cast.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::Type; - -use super::*; - -/// A cast expression `e as U`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct CastExpression { - /// The expression `e` of a type `T` that is being cast to `U`. - pub inner: Box, - /// The type `U` to cast `e` to. - pub target_type: Type, - /// Span for the entire expression `e as U` to. - pub span: Span, -} - -impl fmt::Display for CastExpression { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{} as {}", self.inner, self.target_type) - } -} - -impl Node for CastExpression { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/expression/mod.rs b/compiler/ast/src/expression/mod.rs index c72a546945..684ec093c7 100644 --- a/compiler/ast/src/expression/mod.rs +++ b/compiler/ast/src/expression/mod.rs @@ -35,8 +35,6 @@ mod value; pub use value::*; mod call; pub use call::*; -mod cast; -pub use cast::*; mod err; pub use err::*; @@ -53,8 +51,6 @@ pub enum Expression { Unary(UnaryExpression), /// A ternary conditional expression `cond ? if_expr : else_expr`. Ternary(TernaryExpression), - /// A cast expression `expr as type`. - Cast(CastExpression), /// An access expression of some sort, e.g., `array[idx]` or `foo.bar`. Access(AccessExpression), /// A tuple expression e.g., `(foo, 42, true)`. @@ -77,7 +73,6 @@ impl Node for Expression { Ternary(n) => n.span(), TupleInit(n) => n.span(), Call(n) => n.span(), - Cast(n) => n.span(), Access(n) => n.span(), Err(n) => n.span(), } @@ -93,7 +88,6 @@ impl Node for Expression { Ternary(n) => n.set_span(span), TupleInit(n) => n.set_span(span), Call(n) => n.set_span(span), - Cast(n) => n.set_span(span), Access(n) => n.set_span(span), Err(n) => n.set_span(span), } @@ -111,7 +105,6 @@ impl fmt::Display for Expression { Ternary(n) => n.fmt(f), TupleInit(n) => n.fmt(f), Call(n) => n.fmt(f), - Cast(n) => n.fmt(f), Access(n) => n.fmt(f), Err(n) => n.fmt(f), } diff --git a/compiler/ast/src/imports/mod.rs b/compiler/ast/src/imports/mod.rs deleted file mode 100644 index 0abc99f168..0000000000 --- a/compiler/ast/src/imports/mod.rs +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::Identifier; -use leo_span::{Span, Symbol}; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -/// Represents an import statement in a Leo program. -#[derive(Clone, Eq, PartialEq, Serialize, Deserialize)] -pub struct ImportStatement { - /// The tree specifying what items or packages to import. - pub tree: ImportTree, - /// The span, excluding the `;`. - pub span: Span, -} - -impl ImportStatement { - /// Returns the the package file name of the self import statement. - pub fn get_file_name(&self) -> Symbol { - self.tree.base.first().unwrap().name - } -} - -impl fmt::Display for ImportStatement { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "import {};", self.tree) - } -} - -impl fmt::Debug for ImportStatement { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Display::fmt(self, f) - } -} - -/// An import tree specifies item(s) to import. -#[derive(Clone, Eq, PartialEq, Serialize, Deserialize)] -pub struct ImportTree { - /// A path to the base item or package to import or import from. - /// The list is always non-empty. - pub base: Vec, - /// Specifies the kind of import and the meaning of `base`. - /// This includes plain imports, renames, globs (`*`), and nested imports. - pub kind: ImportTreeKind, - /// The span for the import excluding `import` and `;`. - pub span: Span, -} - -impl fmt::Display for ImportTree { - /// Formats `self` to `f`. - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - // Format the path. - for (i, part) in self.base.iter().enumerate() { - write!(f, "{}", part)?; - if i < self.base.len() - 1 { - write!(f, ".")?; - } - } - - // Format the kind. - match &self.kind { - ImportTreeKind::Glob { .. } => write!(f, ".*"), - ImportTreeKind::Leaf { alias: None } => Ok(()), - ImportTreeKind::Leaf { alias: Some(alias) } => write!(f, "as {}", alias), - ImportTreeKind::Nested { tree } => { - write!(f, ".(")?; - for (i, node) in tree.iter().enumerate() { - write!(f, "{}", node)?; - if i < tree.len() - 1 { - write!(f, ", ")?; - } - } - write!(f, ")") - } - } - } -} - -impl fmt::Debug for ImportTree { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Display::fmt(self, f) - } -} - -/// Specifies the import kind and the meaning of `base`. -#[derive(Clone, Eq, PartialEq, Serialize, Deserialize)] -pub enum ImportTreeKind { - /// A glob import `*`. - Glob { - /// The span for the `*`. - span: Span, - }, - /// A leaf package to import. - Leaf { - /// When specified, the package is imported under a different name. - /// Otherwise, the `base` name is used as in the `ImportTree`. - alias: Option, - }, - /// A nested import of items or sub-packages. - Nested { - /// The sub-tree specifying what to import from the `base`. - tree: Vec, - }, -} diff --git a/compiler/ast/src/lib.rs b/compiler/ast/src/lib.rs index 4ff6b92a54..b9b7b57f5d 100644 --- a/compiler/ast/src/lib.rs +++ b/compiler/ast/src/lib.rs @@ -43,9 +43,6 @@ pub use self::functions::*; pub mod groups; pub use self::groups::*; -pub mod imports; -pub use self::imports::*; - pub mod input; pub use self::input::*; diff --git a/compiler/ast/src/program.rs b/compiler/ast/src/program.rs index 1533bef23e..89f8beef5a 100644 --- a/compiler/ast/src/program.rs +++ b/compiler/ast/src/program.rs @@ -17,9 +17,7 @@ //! A Leo program consists of import, circuit, and function definitions. //! Each defined type consists of ast statements and expressions. -use crate::{Alias, DefinitionStatement, Function, FunctionInput, Identifier, ImportStatement}; - -use leo_span::Symbol; +use crate::{Alias, DefinitionStatement, Function, FunctionInput, Identifier}; use indexmap::IndexMap; use serde::{Deserialize, Serialize}; @@ -34,11 +32,6 @@ pub struct Program { /// Expected main function inputs. /// Empty after parsing. pub expected_input: Vec, - /// The collected import statements. - pub import_statements: Vec, - #[serde(with = "crate::common::imported_modules")] - /// A map from paths to injected programs. - pub imports: IndexMap, Program>, /// A map from alias names to type aliases. pub aliases: IndexMap, /// A map from constant names to their definitions. @@ -56,21 +49,11 @@ impl AsRef for Program { impl fmt::Display for Program { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - for import in self.import_statements.iter() { - import.fmt(f)?; - writeln!(f,)?; - } - writeln!(f,)?; for (_, alias) in self.aliases.iter() { alias.fmt(f)?; writeln!(f,)?; } writeln!(f,)?; - for (_, import) in self.imports.iter() { - import.fmt(f)?; - writeln!(f,)?; - } - writeln!(f,)?; for (_, function) in self.functions.iter() { function.fmt(f)?; writeln!(f,)?; @@ -85,8 +68,6 @@ impl Program { Self { name, expected_input: vec![], - import_statements: vec![], - imports: IndexMap::new(), aliases: IndexMap::new(), global_consts: IndexMap::new(), functions: IndexMap::new(), diff --git a/compiler/ast/src/reducer/reconstructing_director.rs b/compiler/ast/src/reducer/reconstructing_director.rs index b56c9df0e0..cf03acc0a5 100644 --- a/compiler/ast/src/reducer/reconstructing_director.rs +++ b/compiler/ast/src/reducer/reconstructing_director.rs @@ -20,7 +20,7 @@ use crate::*; use leo_errors::{AstError, Result}; -use leo_span::{Span, Symbol}; +use leo_span::Span; use indexmap::IndexMap; @@ -58,7 +58,6 @@ impl ReconstructingDirector { Expression::Binary(binary) => Expression::Binary(self.reduce_binary(binary)?), Expression::Unary(unary) => Expression::Unary(self.reduce_unary(unary)?), Expression::Ternary(ternary) => Expression::Ternary(self.reduce_ternary(ternary)?), - Expression::Cast(cast) => Expression::Cast(self.reduce_cast(cast)?), Expression::Access(access) => Expression::Access(self.reduce_access(access)?), Expression::TupleInit(tuple_init) => Expression::TupleInit(self.reduce_tuple_init(tuple_init)?), @@ -124,13 +123,6 @@ impl ReconstructingDirector { self.reducer.reduce_ternary(ternary, condition, if_true, if_false) } - pub fn reduce_cast(&mut self, cast: &CastExpression) -> Result { - let inner = self.reduce_expression(&cast.inner)?; - let target_type = self.reduce_type(&cast.target_type, &cast.span)?; - - self.reducer.reduce_cast(cast, inner, target_type) - } - pub fn reduce_member_access(&mut self, member_access: &MemberAccess) -> Result { let inner = self.reduce_expression(&member_access.inner)?; let name = self.reduce_identifier(&member_access.name)?; @@ -327,17 +319,6 @@ impl ReconstructingDirector { inputs.push(self.reduce_function_input(input)?); } - let mut import_statements = vec![]; - for import in program.import_statements.iter() { - import_statements.push(self.reduce_import_statement(import)?); - } - - let mut imports = IndexMap::new(); - for (identifier, program) in program.imports.iter() { - let (ident, import) = self.reduce_import(identifier, program)?; - imports.insert(ident, import); - } - let mut aliases = IndexMap::new(); for (name, alias) in program.aliases.iter() { let represents = self.reduce_type(&alias.represents, &alias.name.span)?; @@ -361,15 +342,8 @@ impl ReconstructingDirector { global_consts.insert(name.clone(), self.reduce_definition(definition)?); } - self.reducer.reduce_program( - program, - inputs, - import_statements, - imports, - aliases, - functions, - global_consts, - ) + self.reducer + .reduce_program(program, inputs, aliases, functions, global_consts) } pub fn reduce_function_input_variable( @@ -392,41 +366,6 @@ impl ReconstructingDirector { self.reducer.reduce_function_input(input, new) } - pub fn reduce_import_tree(&mut self, tree: &ImportTree) -> Result { - let new = ImportTree { - base: tree - .base - .iter() - .map(|i| self.reduce_identifier(i)) - .collect::>()?, - - kind: match &tree.kind { - ImportTreeKind::Glob { .. } | ImportTreeKind::Leaf { alias: None } => tree.kind.clone(), - ImportTreeKind::Leaf { alias: Some(alias) } => { - let alias = self.reduce_identifier(alias)?; - ImportTreeKind::Leaf { alias: Some(alias) } - } - ImportTreeKind::Nested { tree } => ImportTreeKind::Nested { - tree: tree.iter().map(|n| self.reduce_import_tree(n)).collect::>()?, - }, - }, - span: tree.span.clone(), - }; - - self.reducer.reduce_import_tree(tree, new) - } - - pub fn reduce_import_statement(&mut self, import: &ImportStatement) -> Result { - let tree = self.reduce_import_tree(&import.tree)?; - self.reducer.reduce_import_statement(import, tree) - } - - pub fn reduce_import(&mut self, identifier: &[Symbol], import: &Program) -> Result<(Vec, Program)> { - let new_identifer = identifier.to_vec(); - let new_import = self.reduce_program(import)?; - self.reducer.reduce_import(new_identifer, new_import) - } - pub fn reduce_function(&mut self, function: &Function) -> Result { let identifier = self.reduce_identifier(&function.identifier)?; diff --git a/compiler/ast/src/reducer/reconstructing_reducer.rs b/compiler/ast/src/reducer/reconstructing_reducer.rs index 4560efc63b..da611dd039 100644 --- a/compiler/ast/src/reducer/reconstructing_reducer.rs +++ b/compiler/ast/src/reducer/reconstructing_reducer.rs @@ -113,14 +113,6 @@ pub trait ReconstructingReducer { }) } - fn reduce_cast(&mut self, cast: &CastExpression, inner: Expression, target_type: Type) -> Result { - Ok(CastExpression { - inner: Box::new(inner), - target_type, - span: cast.span.clone(), - }) - } - fn reduce_member_access( &mut self, member_access: &MemberAccess, @@ -299,8 +291,6 @@ pub trait ReconstructingReducer { &mut self, program: &Program, expected_input: Vec, - import_statements: Vec, - imports: IndexMap, Program>, aliases: IndexMap, functions: IndexMap, global_consts: IndexMap, DefinitionStatement>, @@ -308,8 +298,6 @@ pub trait ReconstructingReducer { Ok(Program { name: program.name.clone(), expected_input, - import_statements, - imports, aliases, functions, global_consts, @@ -335,17 +323,6 @@ pub trait ReconstructingReducer { Ok(new) } - fn reduce_import_tree(&mut self, _tree: &ImportTree, new: ImportTree) -> Result { - Ok(new) - } - - fn reduce_import_statement(&mut self, import: &ImportStatement, tree: ImportTree) -> Result { - Ok(ImportStatement { - tree, - span: import.span.clone(), - }) - } - fn reduce_import(&mut self, identifier: Vec, import: Program) -> Result<(Vec, Program)> { Ok((identifier, import)) } diff --git a/compiler/parser/src/parser/expression.rs b/compiler/parser/src/parser/expression.rs index 06ce05300f..c725237ad1 100644 --- a/compiler/parser/src/parser/expression.rs +++ b/compiler/parser/src/parser/expression.rs @@ -199,9 +199,9 @@ impl ParserContext<'_> { /// Returns an [`Expression`] AST node if the next tokens represent a /// binary exponentiation expression. /// - /// Otherwise, tries to parse the next token using [`parse_cast_expression`]. + /// Otherwise, tries to parse the next token using [`parse_unary_expression`]. pub fn parse_exponential_expression(&mut self) -> Result { - let mut expr = self.parse_cast_expression()?; + let mut expr = self.parse_unary_expression()?; if self.eat(Token::Exp).is_some() { let right = self.parse_exponential_expression()?; @@ -211,25 +211,6 @@ impl ParserContext<'_> { Ok(expr) } - /// - /// Returns an [`Expression`] AST node if the next tokens represent a - /// type cast expression. - /// - /// Otherwise, tries to parse the next token using [`parse_unary_expression`]. - /// - pub fn parse_cast_expression(&mut self) -> Result { - let mut expr = self.parse_unary_expression()?; - while self.eat(Token::As).is_some() { - let (type_, type_span) = self.parse_type()?; - expr = Expression::Cast(CastExpression { - span: expr.span() + &type_span, - inner: Box::new(expr), - target_type: type_, - }) - } - Ok(expr) - } - /// /// Returns an [`Expression`] AST node if the next tokens represent a /// unary not, negate, or bitwise not expression. diff --git a/compiler/parser/src/parser/file.rs b/compiler/parser/src/parser/file.rs index 3d8e9a5290..38186508bd 100644 --- a/compiler/parser/src/parser/file.rs +++ b/compiler/parser/src/parser/file.rs @@ -15,7 +15,6 @@ // along with the Leo library. If not, see . use super::*; -use crate::KEYWORD_TOKENS; use leo_errors::{ParserError, Result}; use leo_span::sym; @@ -25,7 +24,6 @@ impl ParserContext<'_> { /// Returns a [`Program`] AST if all tokens can be consumed and represent a valid Leo program. /// pub fn parse_program(&mut self) -> Result { - let mut import_statements = Vec::new(); let mut aliases = IndexMap::new(); let mut functions = IndexMap::new(); let mut global_consts = IndexMap::new(); @@ -33,9 +31,6 @@ impl ParserContext<'_> { while self.has_next() { let token = self.peek()?; match &token.token { - Token::Import => { - import_statements.push(self.parse_import_statement()?); - } Token::Ident(sym::test) => return Err(ParserError::test_function(&token.span).into()), // Const functions share the first token with the global Const. Token::Const if self.peek_is_function()? => { @@ -60,8 +55,6 @@ impl ParserContext<'_> { Ok(Program { name: String::new(), expected_input: Vec::new(), - import_statements, - imports: IndexMap::new(), aliases, functions, global_consts, @@ -71,7 +64,7 @@ impl ParserContext<'_> { fn unexpected_item(token: &SpannedToken) -> ParserError { ParserError::unexpected( &token.token, - [Token::Import, Token::Function, Token::Ident(sym::test)] + [Token::Function, Token::Ident(sym::test)] .iter() .map(|x| format!("'{}'", x)) .collect::>() @@ -80,75 +73,6 @@ impl ParserContext<'_> { ) } - /// Returns an [`Identifier`] AST node if the next tokens represent a valid package name. - pub fn parse_package_name(&mut self) -> Result { - // Build the package name, starting with valid characters up to a dash `-` (Token::Minus). - let base = self.expect_loose_identifier()?; - - // Return an error if the package name contains a keyword. - if let Some(token) = KEYWORD_TOKENS.iter().find(|x| x.keyword_to_symbol() == Some(base.name)) { - self.emit_err(ParserError::unexpected_str(token, "package name", &base.span)); - } - - // Return the package name. - Ok(base) - } - - /// Returns an [`ImportTree`] AST node if the next tokens represent a valid package import - /// with accesses. - // Public solely for writing import parsing tests. - pub fn parse_import_tree(&mut self) -> Result { - // Parse the first part of the path. - let first_name = self.parse_package_name()?; - let start = first_name.span.clone(); - let mut base = vec![first_name]; - - let make = |base, end, kind| { - let span = start + end; - ImportTree { base, span, kind } - }; - - // Paths are separated by `.`s. - while self.eat(Token::Dot).is_some() { - if self.peek_is_left_par() { - // Encountered `.(`, so we have a nested import. Recurse! - let (tree, _, end) = self.parse_paren_comma_list(|p| p.parse_import_tree().map(Some))?; - - if tree.is_empty() { - self.emit_err(ParserError::invalid_import_list(&end)); - } - - return Ok(make(base, end, ImportTreeKind::Nested { tree })); - } else if let Some(SpannedToken { span, .. }) = self.eat(Token::Mul) { - // Encountered `.*`, so we have a glob import. - return Ok(make(base, span.clone(), ImportTreeKind::Glob { span })); - } - - // Parse another path segment. - base.push(self.parse_package_name()?); - } - - let (end, alias) = if self.eat(Token::As).is_some() { - // Encountered `as`, so interpret as `path as rename`. - let alias = self.expect_ident()?; - (alias.span.clone(), Some(alias)) - } else { - (base.last().unwrap().span.clone(), None) - }; - Ok(make(base, end, ImportTreeKind::Leaf { alias })) - } - - /// Returns a [`ImportStatement`] AST node if the next tokens represent an import statement. - pub fn parse_import_statement(&mut self) -> Result { - self.expect(Token::Import)?; - let tree = self.parse_import_tree()?; - self.expect(Token::Semicolon)?; - Ok(ImportStatement { - span: tree.span.clone(), - tree, - }) - } - /// /// Returns a [`FunctionInput`] AST node if the next tokens represent a function parameter. /// diff --git a/compiler/parser/src/test.rs b/compiler/parser/src/test.rs index 12bdf89074..1fa2de3273 100644 --- a/compiler/parser/src/test.rs +++ b/compiler/parser/src/test.rs @@ -111,27 +111,6 @@ impl Namespace for ParseExpressionNamespace { } } -struct ParseImportNamespace; - -impl Namespace for ParseImportNamespace { - fn parse_type(&self) -> ParseType { - ParseType::ContinuousLines - } - - fn run_test(&self, test: Test) -> Result { - create_session_if_not_set_then(|_| { - let tokenizer = tokenize(test)?; - if all_are_comments(&tokenizer) { - return Ok(yaml_or_fail(Statement::Expression(ExpressionStatement { - expression: implicit_value_expr(), - span: Span::default(), - }))); - } - with_handler(tokenizer, |p| p.parse_import_statement()).map(yaml_or_fail) - }) - } -} - struct ParseStatementNamespace; impl Namespace for ParseStatementNamespace { @@ -248,7 +227,6 @@ impl Runner for TestRunner { fn resolve_namespace(&self, name: &str) -> Option> { Some(match name { "Parse" => Box::new(ParseNamespace), - "ParseImport" => Box::new(ParseImportNamespace), "ParseExpression" => Box::new(ParseExpressionNamespace), "ParseStatement" => Box::new(ParseStatementNamespace), "Serialize" => Box::new(SerializeNamespace), diff --git a/compiler/parser/src/tokenizer/lexer.rs b/compiler/parser/src/tokenizer/lexer.rs index 9a0bbe78ab..f8f87ae77c 100644 --- a/compiler/parser/src/tokenizer/lexer.rs +++ b/compiler/parser/src/tokenizer/lexer.rs @@ -401,7 +401,6 @@ impl Token { match &*ident { x if x.starts_with("aleo1") => Token::AddressLit(ident), "address" => Token::Address, - "as" => Token::As, "bool" => Token::Bool, "char" => Token::Char, "console" => Token::Console, @@ -418,7 +417,6 @@ impl Token { "i64" => Token::I64, "i128" => Token::I128, "if" => Token::If, - "import" => Token::Import, "in" => Token::In, "input" => Token::Input, "let" => Token::Let, diff --git a/compiler/parser/src/tokenizer/mod.rs b/compiler/parser/src/tokenizer/mod.rs index 6b9d8f171c..69fce18a11 100644 --- a/compiler/parser/src/tokenizer/mod.rs +++ b/compiler/parser/src/tokenizer/mod.rs @@ -124,9 +124,7 @@ mod tests { test_ident 12345 address - as bool - circuit const else false @@ -140,7 +138,6 @@ mod tests { i16 i8 if - import in input let @@ -202,7 +199,7 @@ mod tests { assert_eq!( output, - r#"'a' '😭' "test" "test{}test" "test{}" "{}test" "test{" "test}" "test{test" "test}test" "te{{}}" aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 test_ident 12345 address as bool circuit const else false field for function group i128 i64 i32 i16 i8 if import in input let mut return string test true u128 u64 u32 u16 u8 console ! != && ( ) * ** **= *= + += , - -= -> _ . .. / /= : ; < <= = == > >= [ ] { { } } || ? // test + r#"'a' '😭' "test" "test{}test" "test{}" "{}test" "test{" "test}" "test{test" "test}test" "te{{}}" aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 test_ident 12345 address bool const else false field for function group i128 i64 i32 i16 i8 if in input let mut return string test true u128 u64 u32 u16 u8 console ! != && ( ) * ** **= *= + += , - -= -> _ . .. / /= : ; < <= = == > >= [ ] { { } } || ? // test /* test */ // "# ); }); diff --git a/compiler/parser/src/tokenizer/token.rs b/compiler/parser/src/tokenizer/token.rs index b52a436750..f4f3fed866 100644 --- a/compiler/parser/src/tokenizer/token.rs +++ b/compiler/parser/src/tokenizer/token.rs @@ -117,11 +117,7 @@ pub enum Token { // primary expresion Input, - // Import - Import, - // Regular Keywords - As, Console, /// Const variable and a const function. Const, @@ -142,7 +138,6 @@ pub enum Token { /// Represents all valid Leo keyword tokens. pub const KEYWORD_TOKENS: &[Token] = &[ Token::Address, - Token::As, Token::Bool, Token::Char, Token::Console, @@ -159,7 +154,6 @@ pub const KEYWORD_TOKENS: &[Token] = &[ Token::I64, Token::I128, Token::If, - Token::Import, Token::In, Token::Input, Token::Let, @@ -184,7 +178,6 @@ impl Token { pub fn keyword_to_symbol(&self) -> Option { Some(match self { Token::Address => sym::address, - Token::As => sym::As, Token::Bool => sym::bool, Token::Char => sym::char, Token::Console => sym::console, @@ -201,7 +194,6 @@ impl Token { Token::I64 => sym::i64, Token::I128 => sym::i128, Token::If => sym::If, - Token::Import => sym::import, Token::In => sym::In, Token::Input => sym::input, Token::Let => sym::Let, @@ -293,9 +285,6 @@ impl fmt::Display for Token { Input => write!(f, "input"), - Import => write!(f, "import"), - - As => write!(f, "as"), Console => write!(f, "console"), Const => write!(f, "const"), Else => write!(f, "else"), diff --git a/leo/span/src/symbol.rs b/leo/span/src/symbol.rs index 327a40abff..7f5bbe42b0 100644 --- a/leo/span/src/symbol.rs +++ b/leo/span/src/symbol.rs @@ -102,7 +102,6 @@ symbols! { address, AlwaysConst, array, - As: "as", assert, bool, char, @@ -125,7 +124,6 @@ symbols! { i64, i128, If: "if", - import, In: "in", input, Let: "let", diff --git a/tests/expectations/parser/parser/expression/binary/exp.leo.out b/tests/expectations/parser/parser/expression/binary/exp.leo.out index 9ec292c313..7a6342565c 100644 --- a/tests/expectations/parser/parser/expression/binary/exp.leo.out +++ b/tests/expectations/parser/parser/expression/binary/exp.leo.out @@ -116,141 +116,3 @@ outputs: col_stop: 12 path: "" content: 1 ** 2 ** 3 - - Binary: - left: - Cast: - inner: - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: 1 as i8 ** 3 as i8 - target_type: - IntegerType: I8 - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: 1 as i8 ** 3 as i8 - right: - Cast: - inner: - Value: - Implicit: - - "3" - - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 13 - path: "" - content: 1 as i8 ** 3 as i8 - target_type: - IntegerType: I8 - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 19 - path: "" - content: 1 as i8 ** 3 as i8 - op: Pow - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 19 - path: "" - content: 1 as i8 ** 3 as i8 - - Binary: - left: - Cast: - inner: - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: 1 as i8 ** 3 as i8 ** 5 as i8 - target_type: - IntegerType: I8 - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: 1 as i8 ** 3 as i8 ** 5 as i8 - right: - Binary: - left: - Cast: - inner: - Value: - Implicit: - - "3" - - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 13 - path: "" - content: 1 as i8 ** 3 as i8 ** 5 as i8 - target_type: - IntegerType: I8 - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 19 - path: "" - content: 1 as i8 ** 3 as i8 ** 5 as i8 - right: - Cast: - inner: - Value: - Implicit: - - "5" - - span: - line_start: 1 - line_stop: 1 - col_start: 23 - col_stop: 24 - path: "" - content: 1 as i8 ** 3 as i8 ** 5 as i8 - target_type: - IntegerType: I8 - span: - line_start: 1 - line_stop: 1 - col_start: 23 - col_stop: 30 - path: "" - content: 1 as i8 ** 3 as i8 ** 5 as i8 - op: Pow - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 30 - path: "" - content: 1 as i8 ** 3 as i8 ** 5 as i8 - op: Pow - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 30 - path: "" - content: 1 as i8 ** 3 as i8 ** 5 as i8 diff --git a/tests/expectations/parser/parser/expression/literal/comment.leo.out b/tests/expectations/parser/parser/expression/literal/comment.leo.out index 86199de708..53a1d748cb 100644 --- a/tests/expectations/parser/parser/expression/literal/comment.leo.out +++ b/tests/expectations/parser/parser/expression/literal/comment.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} aliases: {} global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/expression/token_format.leo.out b/tests/expectations/parser/parser/expression/token_format.leo.out index b6a43b68ab..c329e3e9ef 100644 --- a/tests/expectations/parser/parser/expression/token_format.leo.out +++ b/tests/expectations/parser/parser/expression/token_format.leo.out @@ -62,8 +62,6 @@ outputs: - "Error [EPAR0370030]: Could not lex the following content: `~`." - "Error [EPAR0370030]: Could not lex the following content: `~`." - "Error [EPAR0370030]: Could not lex the following content: `~`." - - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'import'\n --> test:1:1\n |\n 1 | import\n | ^^^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'as'\n --> test:1:1\n |\n 1 | as\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'console'\n --> test:1:1\n |\n 1 | console\n | ^^^^^^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'const'\n --> test:1:1\n |\n 1 | const\n | ^^^^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'else'\n --> test:1:1\n |\n 1 | else\n | ^^^^" diff --git a/tests/expectations/parser/parser/functions/bounded_recursion.leo.out b/tests/expectations/parser/parser/functions/bounded_recursion.leo.out index c89bd4c82f..d6f231c45e 100644 --- a/tests/expectations/parser/parser/functions/bounded_recursion.leo.out +++ b/tests/expectations/parser/parser/functions/bounded_recursion.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} aliases: {} global_consts: {} functions: diff --git a/tests/expectations/parser/parser/functions/const_function.leo.out b/tests/expectations/parser/parser/functions/const_function.leo.out index 1adcf337ab..de57c5e98a 100644 --- a/tests/expectations/parser/parser/functions/const_function.leo.out +++ b/tests/expectations/parser/parser/functions/const_function.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} aliases: {} global_consts: {} functions: diff --git a/tests/expectations/parser/parser/functions/const_param.leo.out b/tests/expectations/parser/parser/functions/const_param.leo.out index 3e5a911c61..739dfcb9cd 100644 --- a/tests/expectations/parser/parser/functions/const_param.leo.out +++ b/tests/expectations/parser/parser/functions/const_param.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} aliases: {} global_consts: {} functions: diff --git a/tests/expectations/parser/parser/functions/empty.leo.out b/tests/expectations/parser/parser/functions/empty.leo.out index cc19481847..3527b26a9a 100644 --- a/tests/expectations/parser/parser/functions/empty.leo.out +++ b/tests/expectations/parser/parser/functions/empty.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} aliases: {} global_consts: {} functions: diff --git a/tests/expectations/parser/parser/functions/empty2.leo.out b/tests/expectations/parser/parser/functions/empty2.leo.out index 318fadee3c..1cce2c759e 100644 --- a/tests/expectations/parser/parser/functions/empty2.leo.out +++ b/tests/expectations/parser/parser/functions/empty2.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} aliases: {} global_consts: {} functions: diff --git a/tests/expectations/parser/parser/functions/ident_token_fail.leo.out b/tests/expectations/parser/parser/functions/ident_token_fail.leo.out index 3649ecdf35..c9f3bc759d 100644 --- a/tests/expectations/parser/parser/functions/ident_token_fail.leo.out +++ b/tests/expectations/parser/parser/functions/ident_token_fail.leo.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370005]: expected 'import', 'function', 'test' -- got '1'\n --> test:3:1\n |\n 3 | 1 main() {}\n | ^" + - "Error [EPAR0370005]: expected 'function', 'test' -- got '1'\n --> test:3:1\n |\n 3 | 1 main() {}\n | ^" diff --git a/tests/expectations/parser/parser/functions/infinite_recursion.leo.out b/tests/expectations/parser/parser/functions/infinite_recursion.leo.out index ef2916405a..5dd8732ba8 100644 --- a/tests/expectations/parser/parser/functions/infinite_recursion.leo.out +++ b/tests/expectations/parser/parser/functions/infinite_recursion.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} aliases: {} global_consts: {} functions: diff --git a/tests/expectations/parser/parser/functions/param_tuple.leo.out b/tests/expectations/parser/parser/functions/param_tuple.leo.out index 8ec5af6d18..43978a9ea8 100644 --- a/tests/expectations/parser/parser/functions/param_tuple.leo.out +++ b/tests/expectations/parser/parser/functions/param_tuple.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} aliases: {} global_consts: {} functions: diff --git a/tests/expectations/parser/parser/functions/params.leo.out b/tests/expectations/parser/parser/functions/params.leo.out index 9ffdb9ba90..5b89a44024 100644 --- a/tests/expectations/parser/parser/functions/params.leo.out +++ b/tests/expectations/parser/parser/functions/params.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} aliases: {} global_consts: {} functions: diff --git a/tests/expectations/parser/parser/functions/params_return.leo.out b/tests/expectations/parser/parser/functions/params_return.leo.out index 086a92234d..58598e9061 100644 --- a/tests/expectations/parser/parser/functions/params_return.leo.out +++ b/tests/expectations/parser/parser/functions/params_return.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} aliases: {} global_consts: {} functions: diff --git a/tests/expectations/parser/parser/functions/return.leo.out b/tests/expectations/parser/parser/functions/return.leo.out index 237123e0d1..f13226cd96 100644 --- a/tests/expectations/parser/parser/functions/return.leo.out +++ b/tests/expectations/parser/parser/functions/return.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} aliases: {} global_consts: {} functions: diff --git a/tests/expectations/parser/parser/functions/return_tuple.leo.out b/tests/expectations/parser/parser/functions/return_tuple.leo.out index 665104825a..9d36d866f8 100644 --- a/tests/expectations/parser/parser/functions/return_tuple.leo.out +++ b/tests/expectations/parser/parser/functions/return_tuple.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} aliases: {} global_consts: {} functions: diff --git a/tests/expectations/parser/parser/serialize/one_plus_one.leo.out b/tests/expectations/parser/parser/serialize/one_plus_one.leo.out index a820cd1997..af78423917 100644 --- a/tests/expectations/parser/parser/serialize/one_plus_one.leo.out +++ b/tests/expectations/parser/parser/serialize/one_plus_one.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} aliases: {} global_consts: {} functions: diff --git a/tests/expectations/parser/parser/serialize/parser_error.leo.out b/tests/expectations/parser/parser/serialize/parser_error.leo.out index 6dcccb2d2f..62f5bf28f9 100644 --- a/tests/expectations/parser/parser/serialize/parser_error.leo.out +++ b/tests/expectations/parser/parser/serialize/parser_error.leo.out @@ -2,4 +2,4 @@ namespace: Serialize expectation: Fail outputs: - - "Error [EPAR0370005]: expected 'import', 'function', 'test' -- got 'invalid'\n --> test:3:1\n |\n 3 | invalid\n | ^^^^^^^" + - "Error [EPAR0370005]: expected 'function', 'test' -- got 'invalid'\n --> test:3:1\n |\n 3 | invalid\n | ^^^^^^^" diff --git a/tests/expectations/parser/parser/statement/alias.leo.out b/tests/expectations/parser/parser/statement/alias.leo.out index 331f6c8d79..7ece282aab 100644 --- a/tests/expectations/parser/parser/statement/alias.leo.out +++ b/tests/expectations/parser/parser/statement/alias.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} aliases: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type a = u32;\\\"}\"}": name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type a = u32;\\\"}\"}" diff --git a/tests/expectations/parser/parser/statement/assign_fail.leo.out b/tests/expectations/parser/parser/statement/assign_fail.leo.out index 86a87f809d..ac73631625 100644 --- a/tests/expectations/parser/parser/statement/assign_fail.leo.out +++ b/tests/expectations/parser/parser/statement/assign_fail.leo.out @@ -8,7 +8,7 @@ outputs: - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | -x = y;\n | ^^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | !x = y;\n | ^^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | a? x : x = y;\n | ^^^^^^^^" - - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x as u32 = y;\n | ^^^^^^^^" + - "Error [EPAR0370005]: expected ; -- got 'as'\n --> test:1:3\n |\n 1 | x as u32 = y;\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [x, x, x] = y;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [x; 3] = y;\n | ^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | (x, x, x) = y;\n | ^^^^^^^^^" diff --git a/tests/expectations/parser/parser/statement/global_const.leo.out b/tests/expectations/parser/parser/statement/global_const.leo.out index a1a58cb282..52e7673324 100644 --- a/tests/expectations/parser/parser/statement/global_const.leo.out +++ b/tests/expectations/parser/parser/statement/global_const.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} aliases: {} global_consts: x: diff --git a/tests/expectations/parser/parser/unreachable/define.leo.out b/tests/expectations/parser/parser/unreachable/define.leo.out index f8eba9a3e3..e075c01cfc 100644 --- a/tests/expectations/parser/parser/unreachable/define.leo.out +++ b/tests/expectations/parser/parser/unreachable/define.leo.out @@ -4,7 +4,7 @@ expectation: Fail outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', got ';'\n --> test:1:1\n |\n 1 | ; x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '.'\n --> test:1:1\n |\n 1 | . x = 10u8;\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'import'\n --> test:1:1\n |\n 1 | import x = 10u8;\n | ^^^^^^" + - "Error [EPAR0370005]: expected ; -- got 'x'\n --> test:1:8\n |\n 1 | import x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:1\n |\n 1 | , x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [ x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ']'\n --> test:1:1\n |\n 1 | ] x = 10u8;\n | ^" @@ -26,7 +26,7 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', got '<='\n --> test:1:1\n |\n 1 | <= x = 10u8;\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '>'\n --> test:1:1\n |\n 1 | > x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '..'\n --> test:1:1\n |\n 1 | .. x = 10u8;\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'as'\n --> test:1:1\n |\n 1 | as x = 10u8;\n | ^^" + - "Error [EPAR0370005]: expected ; -- got 'x'\n --> test:1:4\n |\n 1 | as x = 10u8;\n | ^" - "Error [EPAR0370005]: expected . -- got 'x'\n --> test:1:9\n |\n 1 | console x = 10u8;\n | ^" - "Error [EPAR0370005]: expected in -- got '='\n --> test:1:7\n |\n 1 | for x = 10u8;\n | ^" - "Error [EPAR0370005]: expected { -- got '='\n --> test:1:6\n |\n 1 | if x = 10u8;\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out b/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out index 85543d14e1..6766de31df 100644 --- a/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out +++ b/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out @@ -274,60 +274,6 @@ outputs: col_stop: 14 path: "" content: let x = a > b; - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = a as b;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: let x = a as b; - type_: ~ - value: - Cast: - inner: - Identifier: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = a as b;\\\"}\"}" - target_type: - Identifier: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = a as b;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 15 - path: "" - content: let x = a as b; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: let x = a as b; - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"ximport\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"ximport=b;\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: ximport=b; - value: - Identifier: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"ximport=b;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: ximport=b; - Assign: operation: Assign assignee: @@ -459,27 +405,6 @@ outputs: col_stop: 5 path: "" content: x>=b; - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"xas\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"xas=b;\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: xas=b; - value: - Identifier: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"xas=b;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: xas=b; - Assign: operation: Assign assignee: diff --git a/tests/parser/expression/binary/exp.leo b/tests/parser/expression/binary/exp.leo index 0bd2795265..8e04d92748 100644 --- a/tests/parser/expression/binary/exp.leo +++ b/tests/parser/expression/binary/exp.leo @@ -8,7 +8,3 @@ expectation: Pass 2**3 1 ** 2 ** 3 - -1 as i8 ** 3 as i8 - -1 as i8 ** 3 as i8 ** 5 as i8 \ No newline at end of file diff --git a/tests/parser/expression/cast.leo b/tests/parser/expression/cast.leo deleted file mode 100644 index 76809aa8b9..0000000000 --- a/tests/parser/expression/cast.leo +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -x as u8 -y as id -z as u32 -x as i128 -x as u8 as u128 -x as field -x as group -x ** y as u32 ** z -// ~x as u32 -!x as u32 --x as u32 \ No newline at end of file diff --git a/tests/parser/expression/token_format.leo b/tests/parser/expression/token_format.leo index 0445fe5ce5..e9afe3cde6 100644 --- a/tests/parser/expression/token_format.leo +++ b/tests/parser/expression/token_format.leo @@ -123,10 +123,6 @@ char ~ input ~ -import - -as - console const diff --git a/tests/parser/unreachable/math_op_pass.leo b/tests/parser/unreachable/math_op_pass.leo index 85e876788e..6be9810d17 100644 --- a/tests/parser/unreachable/math_op_pass.leo +++ b/tests/parser/unreachable/math_op_pass.leo @@ -19,10 +19,6 @@ let x = a <= b; let x = a > b; -let x = a as b; - -ximport=b; - x_=b; x==b; @@ -35,8 +31,6 @@ x<=b; x>=b; -xas=b; - xconsole=b; xconst=b; From 877674230a200b7137b42a0b2e134e44afef7a5d Mon Sep 17 00:00:00 2001 From: gluax <16431709+gluax@users.noreply.github.com> Date: Mon, 28 Mar 2022 07:47:05 -0700 Subject: [PATCH 08/10] remove aliases and gcs --- compiler/ast/src/aliases/alias.rs | 42 ------------------- compiler/ast/src/aliases/mod.rs | 18 -------- compiler/ast/src/lib.rs | 3 -- compiler/ast/src/program.rs | 14 +------ .../src/reducer/reconstructing_director.rs | 21 +--------- .../ast/src/reducer/reconstructing_reducer.rs | 4 -- compiler/parser/src/parser/file.rs | 25 ----------- .../parser/expression/literal/comment.leo.out | 2 - .../functions/bounded_recursion.leo.out | 2 - .../parser/functions/const_function.leo.out | 2 - .../functions/const_function_fail.leo.out | 2 +- .../parser/functions/const_param.leo.out | 2 - .../parser/parser/functions/empty.leo.out | 2 - .../parser/parser/functions/empty2.leo.out | 2 - .../functions/infinite_recursion.leo.out | 2 - .../parser/functions/param_tuple.leo.out | 2 - .../parser/parser/functions/params.leo.out | 2 - .../parser/functions/params_return.leo.out | 2 - .../parser/parser/functions/return.leo.out | 2 - .../parser/functions/return_tuple.leo.out | 2 - .../parser/serialize/one_plus_one.leo.out | 2 - tests/parser/statement/alias.leo | 10 ----- tests/parser/statement/global_const.leo | 14 ------- 23 files changed, 3 insertions(+), 176 deletions(-) delete mode 100644 compiler/ast/src/aliases/alias.rs delete mode 100644 compiler/ast/src/aliases/mod.rs delete mode 100644 tests/parser/statement/alias.leo delete mode 100644 tests/parser/statement/global_const.leo diff --git a/compiler/ast/src/aliases/alias.rs b/compiler/ast/src/aliases/alias.rs deleted file mode 100644 index 17659ae657..0000000000 --- a/compiler/ast/src/aliases/alias.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{Identifier, Type}; -use leo_span::Span; - -use std::fmt; - -use serde::{Deserialize, Serialize}; - -/// A type alias `type name = represents;`. -/// -/// That is, `name` will become another name for `represents`. -/// This does not create a new type, that is, `name` is the same type as `represents`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct Alias { - /// The new name for `represents`. - pub name: Identifier, - /// A span for the entire `type name = represents;`. - pub span: Span, - /// The type that `name` will evaluate and is equal to. - pub represents: Type, -} - -impl fmt::Display for Alias { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{} : {}", self.name.name, self.represents) - } -} diff --git a/compiler/ast/src/aliases/mod.rs b/compiler/ast/src/aliases/mod.rs deleted file mode 100644 index 393212003a..0000000000 --- a/compiler/ast/src/aliases/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -pub mod alias; -pub use self::alias::*; diff --git a/compiler/ast/src/lib.rs b/compiler/ast/src/lib.rs index b9b7b57f5d..be4eb84c78 100644 --- a/compiler/ast/src/lib.rs +++ b/compiler/ast/src/lib.rs @@ -25,9 +25,6 @@ pub mod accesses; pub use self::accesses::*; -pub mod aliases; -pub use self::aliases::*; - pub mod chars; pub use self::chars::*; diff --git a/compiler/ast/src/program.rs b/compiler/ast/src/program.rs index 89f8beef5a..02dd7ad60d 100644 --- a/compiler/ast/src/program.rs +++ b/compiler/ast/src/program.rs @@ -17,7 +17,7 @@ //! A Leo program consists of import, circuit, and function definitions. //! Each defined type consists of ast statements and expressions. -use crate::{Alias, DefinitionStatement, Function, FunctionInput, Identifier}; +use crate::{Function, FunctionInput, Identifier}; use indexmap::IndexMap; use serde::{Deserialize, Serialize}; @@ -32,11 +32,6 @@ pub struct Program { /// Expected main function inputs. /// Empty after parsing. pub expected_input: Vec, - /// A map from alias names to type aliases. - pub aliases: IndexMap, - /// A map from constant names to their definitions. - #[serde(with = "crate::common::global_consts_json")] - pub global_consts: IndexMap, DefinitionStatement>, /// A map from function names to their definitions. pub functions: IndexMap, } @@ -49,11 +44,6 @@ impl AsRef for Program { impl fmt::Display for Program { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - for (_, alias) in self.aliases.iter() { - alias.fmt(f)?; - writeln!(f,)?; - } - writeln!(f,)?; for (_, function) in self.functions.iter() { function.fmt(f)?; writeln!(f,)?; @@ -68,8 +58,6 @@ impl Program { Self { name, expected_input: vec![], - aliases: IndexMap::new(), - global_consts: IndexMap::new(), functions: IndexMap::new(), } } diff --git a/compiler/ast/src/reducer/reconstructing_director.rs b/compiler/ast/src/reducer/reconstructing_director.rs index cf03acc0a5..e4a1295bbe 100644 --- a/compiler/ast/src/reducer/reconstructing_director.rs +++ b/compiler/ast/src/reducer/reconstructing_director.rs @@ -319,31 +319,12 @@ impl ReconstructingDirector { inputs.push(self.reduce_function_input(input)?); } - let mut aliases = IndexMap::new(); - for (name, alias) in program.aliases.iter() { - let represents = self.reduce_type(&alias.represents, &alias.name.span)?; - aliases.insert( - name.clone(), - Alias { - name: alias.name.clone(), - span: alias.span.clone(), - represents, - }, - ); - } - let mut functions = IndexMap::new(); for (name, function) in program.functions.iter() { functions.insert(name.clone(), self.reduce_function(function)?); } - let mut global_consts = IndexMap::new(); - for (name, definition) in program.global_consts.iter() { - global_consts.insert(name.clone(), self.reduce_definition(definition)?); - } - - self.reducer - .reduce_program(program, inputs, aliases, functions, global_consts) + self.reducer.reduce_program(program, inputs, functions) } pub fn reduce_function_input_variable( diff --git a/compiler/ast/src/reducer/reconstructing_reducer.rs b/compiler/ast/src/reducer/reconstructing_reducer.rs index da611dd039..855d98b74d 100644 --- a/compiler/ast/src/reducer/reconstructing_reducer.rs +++ b/compiler/ast/src/reducer/reconstructing_reducer.rs @@ -291,16 +291,12 @@ pub trait ReconstructingReducer { &mut self, program: &Program, expected_input: Vec, - aliases: IndexMap, functions: IndexMap, - global_consts: IndexMap, DefinitionStatement>, ) -> Result { Ok(Program { name: program.name.clone(), expected_input, - aliases, functions, - global_consts, }) } diff --git a/compiler/parser/src/parser/file.rs b/compiler/parser/src/parser/file.rs index 38186508bd..207711b1d5 100644 --- a/compiler/parser/src/parser/file.rs +++ b/compiler/parser/src/parser/file.rs @@ -24,9 +24,7 @@ impl ParserContext<'_> { /// Returns a [`Program`] AST if all tokens can be consumed and represent a valid Leo program. /// pub fn parse_program(&mut self) -> Result { - let mut aliases = IndexMap::new(); let mut functions = IndexMap::new(); - let mut global_consts = IndexMap::new(); while self.has_next() { let token = self.peek()?; @@ -37,27 +35,17 @@ impl ParserContext<'_> { let (id, function) = self.parse_function_declaration()?; functions.insert(id, function); } - Token::Const => { - let (name, global_const) = self.parse_global_const_declaration()?; - global_consts.insert(name, global_const); - } Token::Function => { let (id, function) = self.parse_function_declaration()?; functions.insert(id, function); } - Token::Type => { - let (name, alias) = self.parse_type_alias()?; - aliases.insert(name, alias); - } _ => return Err(Self::unexpected_item(token).into()), } } Ok(Program { name: String::new(), expected_input: Vec::new(), - aliases, functions, - global_consts, }) } @@ -147,17 +135,4 @@ impl ParserContext<'_> { Ok((variable_names, statement)) } - - /// - /// Returns a [`(String, Alias)`] AST node if the next tokens represent a type alias declaration. - /// - pub fn parse_type_alias(&mut self) -> Result<(Identifier, Alias)> { - let start = self.expect(Token::Type)?; - let name = self.expect_ident()?; - self.expect(Token::Assign)?; - let (represents, _) = self.parse_type()?; - let span = start + self.expect(Token::Semicolon)?; - - Ok((name.clone(), Alias { represents, span, name })) - } } diff --git a/tests/expectations/parser/parser/expression/literal/comment.leo.out b/tests/expectations/parser/parser/expression/literal/comment.leo.out index 53a1d748cb..bc50235bda 100644 --- a/tests/expectations/parser/parser/expression/literal/comment.leo.out +++ b/tests/expectations/parser/parser/expression/literal/comment.leo.out @@ -4,6 +4,4 @@ expectation: Pass outputs: - name: "" expected_input: [] - aliases: {} - global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/functions/bounded_recursion.leo.out b/tests/expectations/parser/parser/functions/bounded_recursion.leo.out index d6f231c45e..c5daae1256 100644 --- a/tests/expectations/parser/parser/functions/bounded_recursion.leo.out +++ b/tests/expectations/parser/parser/functions/bounded_recursion.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - aliases: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const y: u32) {\\\"}\"}": identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const y: u32) {\\\"}\"}" diff --git a/tests/expectations/parser/parser/functions/const_function.leo.out b/tests/expectations/parser/parser/functions/const_function.leo.out index de57c5e98a..279b8694e6 100644 --- a/tests/expectations/parser/parser/functions/const_function.leo.out +++ b/tests/expectations/parser/parser/functions/const_function.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - aliases: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const function x() {\\\"}\"}": identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const function x() {\\\"}\"}" diff --git a/tests/expectations/parser/parser/functions/const_function_fail.leo.out b/tests/expectations/parser/parser/functions/const_function_fail.leo.out index 72572b4700..c6df75c98d 100644 --- a/tests/expectations/parser/parser/functions/const_function_fail.leo.out +++ b/tests/expectations/parser/parser/functions/const_function_fail.leo.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370003]: unexpected EOF\n --> test:3:1\n |\n 3 | const\n | ^^^^^" + - "Error [EPAR0370005]: expected 'function', 'test' -- got 'const'\n --> test:3:1\n |\n 3 | const\n | ^^^^^" diff --git a/tests/expectations/parser/parser/functions/const_param.leo.out b/tests/expectations/parser/parser/functions/const_param.leo.out index 739dfcb9cd..7e1e9b437a 100644 --- a/tests/expectations/parser/parser/functions/const_param.leo.out +++ b/tests/expectations/parser/parser/functions/const_param.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - aliases: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}": identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}" diff --git a/tests/expectations/parser/parser/functions/empty.leo.out b/tests/expectations/parser/parser/functions/empty.leo.out index 3527b26a9a..090289cdca 100644 --- a/tests/expectations/parser/parser/functions/empty.leo.out +++ b/tests/expectations/parser/parser/functions/empty.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - aliases: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}" diff --git a/tests/expectations/parser/parser/functions/empty2.leo.out b/tests/expectations/parser/parser/functions/empty2.leo.out index 1cce2c759e..3de9314352 100644 --- a/tests/expectations/parser/parser/functions/empty2.leo.out +++ b/tests/expectations/parser/parser/functions/empty2.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - aliases: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {}\\\"}\"}": identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {}\\\"}\"}" diff --git a/tests/expectations/parser/parser/functions/infinite_recursion.leo.out b/tests/expectations/parser/parser/functions/infinite_recursion.leo.out index 5dd8732ba8..196af95639 100644 --- a/tests/expectations/parser/parser/functions/infinite_recursion.leo.out +++ b/tests/expectations/parser/parser/functions/infinite_recursion.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - aliases: {} - global_consts: {} functions: "{\"name\":\"inf\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function inf() {\\\"}\"}": identifier: "{\"name\":\"inf\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function inf() {\\\"}\"}" diff --git a/tests/expectations/parser/parser/functions/param_tuple.leo.out b/tests/expectations/parser/parser/functions/param_tuple.leo.out index 43978a9ea8..d9952c25e2 100644 --- a/tests/expectations/parser/parser/functions/param_tuple.leo.out +++ b/tests/expectations/parser/parser/functions/param_tuple.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - aliases: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: (u32, i32)) {\\\"}\"}": identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: (u32, i32)) {\\\"}\"}" diff --git a/tests/expectations/parser/parser/functions/params.leo.out b/tests/expectations/parser/parser/functions/params.leo.out index 5b89a44024..908451d00c 100644 --- a/tests/expectations/parser/parser/functions/params.leo.out +++ b/tests/expectations/parser/parser/functions/params.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - aliases: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}": identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}" diff --git a/tests/expectations/parser/parser/functions/params_return.leo.out b/tests/expectations/parser/parser/functions/params_return.leo.out index 58598e9061..afda5e6cfc 100644 --- a/tests/expectations/parser/parser/functions/params_return.leo.out +++ b/tests/expectations/parser/parser/functions/params_return.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - aliases: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}": identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}" diff --git a/tests/expectations/parser/parser/functions/return.leo.out b/tests/expectations/parser/parser/functions/return.leo.out index f13226cd96..de005bdb0e 100644 --- a/tests/expectations/parser/parser/functions/return.leo.out +++ b/tests/expectations/parser/parser/functions/return.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - aliases: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> u32 {\\\"}\"}": identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> u32 {\\\"}\"}" diff --git a/tests/expectations/parser/parser/functions/return_tuple.leo.out b/tests/expectations/parser/parser/functions/return_tuple.leo.out index 9d36d866f8..37cef6e6e3 100644 --- a/tests/expectations/parser/parser/functions/return_tuple.leo.out +++ b/tests/expectations/parser/parser/functions/return_tuple.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - aliases: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> (u32, u32) {\\\"}\"}": identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> (u32, u32) {\\\"}\"}" diff --git a/tests/expectations/parser/parser/serialize/one_plus_one.leo.out b/tests/expectations/parser/parser/serialize/one_plus_one.leo.out index af78423917..7812751117 100644 --- a/tests/expectations/parser/parser/serialize/one_plus_one.leo.out +++ b/tests/expectations/parser/parser/serialize/one_plus_one.leo.out @@ -4,8 +4,6 @@ expectation: Pass outputs: - name: "" expected_input: [] - aliases: {} - global_consts: {} functions: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() -> u8 {\\\"}\"}": identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() -> u8 {\\\"}\"}" diff --git a/tests/parser/statement/alias.leo b/tests/parser/statement/alias.leo deleted file mode 100644 index 5c395301f9..0000000000 --- a/tests/parser/statement/alias.leo +++ /dev/null @@ -1,10 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -type a = u32; - -type b = string; - -type c = a; diff --git a/tests/parser/statement/global_const.leo b/tests/parser/statement/global_const.leo deleted file mode 100644 index bb51ae8aa2..0000000000 --- a/tests/parser/statement/global_const.leo +++ /dev/null @@ -1,14 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -const x: u32 = 1u32; - -const f: u32 = x; - -const x: i32 = 1i32; - -const y: string = "hello world"; - -const x: char = 'b'; From 95d508566f96a693cc375e08e4bdd903e9c1f816 Mon Sep 17 00:00:00 2001 From: gluax <16431709+gluax@users.noreply.github.com> Date: Mon, 28 Mar 2022 07:54:29 -0700 Subject: [PATCH 09/10] remove circuit access --- compiler/ast/src/accesses/member_access.rs | 54 ------ compiler/ast/src/accesses/mod.rs | 3 - compiler/ast/src/expression/accesses.rs | 5 - .../src/reducer/reconstructing_director.rs | 13 -- .../ast/src/reducer/reconstructing_reducer.rs | 15 -- compiler/parser/src/parser/expression.rs | 9 +- compiler/parser/src/parser/statement.rs | 4 - .../parser/expression/unary/negate.leo.out | 23 --- .../parser/expression/unary/not.leo.out | 23 --- .../parser/parser/statement/assign.leo.out | 162 ------------------ .../parser/statement/assign_fail.leo.out | 2 +- .../parser/unreachable/math_op_pass.leo.out | 34 ---- tests/parser/expression/access/circuit.leo | 10 -- tests/parser/expression/literal/access.leo | 34 ---- tests/parser/expression/unary/negate.leo | 1 - tests/parser/expression/unary/not.leo | 1 - tests/parser/statement/assign.leo | 15 -- tests/parser/unreachable/math_op_pass.leo | 1 - 18 files changed, 2 insertions(+), 407 deletions(-) delete mode 100644 compiler/ast/src/accesses/member_access.rs delete mode 100644 tests/parser/expression/access/circuit.leo delete mode 100644 tests/parser/expression/literal/access.leo diff --git a/compiler/ast/src/accesses/member_access.rs b/compiler/ast/src/accesses/member_access.rs deleted file mode 100644 index fb29783583..0000000000 --- a/compiler/ast/src/accesses/member_access.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{Expression, Identifier, Node}; -use leo_span::Span; - -use std::fmt; - -use serde::{Deserialize, Serialize}; - -/// A field access expression `inner.name` to some structure with *named fields*. -/// -/// For accesses to a positional fields in e.g., a tuple, see `TupleAccess`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct MemberAccess { - /// The structure that the field `name` is being extracted from. - pub inner: Box, - /// The name of the field to extract in `inner`. - pub name: Identifier, - /// The span covering all of `inner.name`. - pub span: Span, - // FIXME(Centril): Type information shouldn't be injected into an AST, - // so this field should eventually be removed. - pub type_: Option, -} - -impl fmt::Display for MemberAccess { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}.{}", self.inner, self.name) - } -} - -impl Node for MemberAccess { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/accesses/mod.rs b/compiler/ast/src/accesses/mod.rs index e77b30956f..23b2e3321a 100644 --- a/compiler/ast/src/accesses/mod.rs +++ b/compiler/ast/src/accesses/mod.rs @@ -14,8 +14,5 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -mod member_access; -pub use member_access::*; - mod tuple_access; pub use tuple_access::*; diff --git a/compiler/ast/src/expression/accesses.rs b/compiler/ast/src/expression/accesses.rs index 974421b256..1cab84d36d 100644 --- a/compiler/ast/src/expression/accesses.rs +++ b/compiler/ast/src/expression/accesses.rs @@ -20,8 +20,6 @@ use crate::accesses::*; /// An access expressions, extracting a smaller part out of a whole. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub enum AccessExpression { - /// An expression accessing a field in a structure, e.g., `circuit_var.field`. - Member(MemberAccess), /// Access to a tuple field using its position, e.g., `tuple.1`. Tuple(TupleAccess), } @@ -31,7 +29,6 @@ impl fmt::Display for AccessExpression { use AccessExpression::*; match self { - Member(access) => access.fmt(f), Tuple(access) => access.fmt(f), } } @@ -42,7 +39,6 @@ impl Node for AccessExpression { use AccessExpression::*; match &self { - Member(access) => access.span(), Tuple(access) => access.span(), } } @@ -51,7 +47,6 @@ impl Node for AccessExpression { use AccessExpression::*; match self { - Member(access) => access.set_span(span), Tuple(access) => access.set_span(span), } } diff --git a/compiler/ast/src/reducer/reconstructing_director.rs b/compiler/ast/src/reducer/reconstructing_director.rs index e4a1295bbe..9f1110f951 100644 --- a/compiler/ast/src/reducer/reconstructing_director.rs +++ b/compiler/ast/src/reducer/reconstructing_director.rs @@ -123,18 +123,6 @@ impl ReconstructingDirector { self.reducer.reduce_ternary(ternary, condition, if_true, if_false) } - pub fn reduce_member_access(&mut self, member_access: &MemberAccess) -> Result { - let inner = self.reduce_expression(&member_access.inner)?; - let name = self.reduce_identifier(&member_access.name)?; - let type_ = member_access - .type_ - .as_ref() - .map(|type_| self.reduce_type(type_, &member_access.span)) - .transpose()?; - - self.reducer.reduce_member_access(member_access, inner, name, type_) - } - pub fn reduce_tuple_access(&mut self, tuple_access: &TupleAccess) -> Result { let tuple = self.reduce_expression(&tuple_access.tuple)?; @@ -145,7 +133,6 @@ impl ReconstructingDirector { use AccessExpression::*; let new = match access { - Member(access) => Member(self.reduce_member_access(access)?), Tuple(access) => Tuple(self.reduce_tuple_access(access)?), }; diff --git a/compiler/ast/src/reducer/reconstructing_reducer.rs b/compiler/ast/src/reducer/reconstructing_reducer.rs index 855d98b74d..b52aacec81 100644 --- a/compiler/ast/src/reducer/reconstructing_reducer.rs +++ b/compiler/ast/src/reducer/reconstructing_reducer.rs @@ -113,21 +113,6 @@ pub trait ReconstructingReducer { }) } - fn reduce_member_access( - &mut self, - member_access: &MemberAccess, - inner: Expression, - name: Identifier, - type_: Option, - ) -> Result { - Ok(MemberAccess { - inner: Box::new(inner), - name, - span: member_access.span.clone(), - type_, - }) - } - fn reduce_tuple_access(&mut self, tuple_access: &TupleAccess, tuple: Expression) -> Result { Ok(TupleAccess { tuple: Box::new(tuple), diff --git a/compiler/parser/src/parser/expression.rs b/compiler/parser/src/parser/expression.rs index c725237ad1..7632f162b6 100644 --- a/compiler/parser/src/parser/expression.rs +++ b/compiler/parser/src/parser/expression.rs @@ -252,14 +252,7 @@ impl ParserContext<'_> { while let Some(token) = self.eat_any(&[Token::Dot, Token::LeftParen]) { match token.token { Token::Dot => { - if let Some(ident) = self.eat_identifier() { - expr = Expression::Access(AccessExpression::Member(MemberAccess { - span: expr.span() + &ident.span, - inner: Box::new(expr), - name: ident, - type_: None, - })); - } else if let Some((num, span)) = self.eat_int() { + if let Some((num, span)) = self.eat_int() { expr = Expression::Access(AccessExpression::Tuple(TupleAccess { span: expr.span() + &span, tuple: Box::new(expr), diff --git a/compiler/parser/src/parser/statement.rs b/compiler/parser/src/parser/statement.rs index 38ac00e747..a0ada17f6c 100644 --- a/compiler/parser/src/parser/statement.rs +++ b/compiler/parser/src/parser/statement.rs @@ -37,10 +37,6 @@ impl ParserContext<'_> { let identifier; match expr { Expression::Access(access) => match access { - AccessExpression::Member(expr) => { - identifier = Self::construct_assignee_access(*expr.inner, accesses)?; - accesses.push(AssigneeAccess::Member(expr.name)); - } AccessExpression::Tuple(expr) => { identifier = Self::construct_assignee_access(*expr.tuple, accesses)?; accesses.push(AssigneeAccess::Tuple(expr.index, expr.span)); diff --git a/tests/expectations/parser/parser/expression/unary/negate.leo.out b/tests/expectations/parser/parser/expression/unary/negate.leo.out index c6df1f7d1f..c411c19563 100644 --- a/tests/expectations/parser/parser/expression/unary/negate.leo.out +++ b/tests/expectations/parser/parser/expression/unary/negate.leo.out @@ -13,29 +13,6 @@ outputs: col_stop: 3 path: "" content: "-x" - - Unary: - inner: - Access: - Member: - inner: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"-x.y\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"-x.y\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 2 - col_stop: 5 - path: "" - content: "-x.y" - type_: ~ - op: Negate - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "-x.y" - Unary: inner: Call: diff --git a/tests/expectations/parser/parser/expression/unary/not.leo.out b/tests/expectations/parser/parser/expression/unary/not.leo.out index 931535a3ff..221c8c8c35 100644 --- a/tests/expectations/parser/parser/expression/unary/not.leo.out +++ b/tests/expectations/parser/parser/expression/unary/not.leo.out @@ -13,29 +13,6 @@ outputs: col_stop: 3 path: "" content: "!x" - - Unary: - inner: - Access: - Member: - inner: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"!x.y\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"!x.y\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 2 - col_stop: 5 - path: "" - content: "!x.y" - type_: ~ - op: Not - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "!x.y" - Unary: inner: Call: diff --git a/tests/expectations/parser/parser/statement/assign.leo.out b/tests/expectations/parser/parser/statement/assign.leo.out index 1e9bf73cba..b9760d5364 100644 --- a/tests/expectations/parser/parser/statement/assign.leo.out +++ b/tests/expectations/parser/parser/statement/assign.leo.out @@ -147,28 +147,6 @@ outputs: col_stop: 8 path: "" content: x = x(); - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y = y;\\\"}\"}" - accesses: - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.y = y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: x.y = y; - Assign: operation: Add assignee: @@ -283,58 +261,6 @@ outputs: col_stop: 9 path: "" content: x += x(); - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 += y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 += y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 += y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x.0 += y; - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y += y;\\\"}\"}" - accesses: - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.y += y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x.y += y; - Assign: operation: Sub assignee: @@ -449,28 +375,6 @@ outputs: col_stop: 9 path: "" content: x -= x(); - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y -= y;\\\"}\"}" - accesses: - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.y -= y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x.y -= y; - Assign: operation: Mul assignee: @@ -615,28 +519,6 @@ outputs: col_stop: 9 path: "" content: x.0 *= y; - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y *= y;\\\"}\"}" - accesses: - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.y *= y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x.y *= y; - Assign: operation: Div assignee: @@ -781,28 +663,6 @@ outputs: col_stop: 9 path: "" content: x.0 /= y; - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y /= y;\\\"}\"}" - accesses: - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.y /= y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x.y /= y; - Assign: operation: Pow assignee: @@ -947,25 +807,3 @@ outputs: col_stop: 10 path: "" content: x.0 **= y; - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y **= y;\\\"}\"}" - accesses: - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y **= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.y **= y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y **= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: x.y **= y; diff --git a/tests/expectations/parser/parser/statement/assign_fail.leo.out b/tests/expectations/parser/parser/statement/assign_fail.leo.out index ac73631625..4440cb96d8 100644 --- a/tests/expectations/parser/parser/statement/assign_fail.leo.out +++ b/tests/expectations/parser/parser/statement/assign_fail.leo.out @@ -14,5 +14,5 @@ outputs: - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | (x, x, x) = y;\n | ^^^^^^^^^" - "Error [EPAR0370005]: expected ; -- got '{'\n --> test:1:3\n |\n 1 | x {x: y, y: z} = y;\n | ^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x() = y;\n | ^^^" - - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x.y() = y;\n | ^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got 'y'\n --> test:1:3\n |\n 1 | x.y() = y;\n | ^" - "Error [EPAR0370030]: Could not lex the following content: `🦀 = y;`." diff --git a/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out b/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out index 6766de31df..0c0509b4cd 100644 --- a/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out +++ b/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out @@ -2,40 +2,6 @@ namespace: ParseStatement expectation: Pass outputs: - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = a . b;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: let x = a . b; - type_: ~ - value: - Access: - Member: - inner: - Identifier: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = a . b;\\\"}\"}" - name: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = a . b;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 14 - path: "" - content: let x = a . b; - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: let x = a . b; - Definition: declaration_type: Let variable_names: diff --git a/tests/parser/expression/access/circuit.leo b/tests/parser/expression/access/circuit.leo deleted file mode 100644 index 58b9a1b3a2..0000000000 --- a/tests/parser/expression/access/circuit.leo +++ /dev/null @@ -1,10 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -x.y -X.Y -x.y.z -x.y() -x.y.0 \ No newline at end of file diff --git a/tests/parser/expression/literal/access.leo b/tests/parser/expression/literal/access.leo deleted file mode 100644 index 905661ff3c..0000000000 --- a/tests/parser/expression/literal/access.leo +++ /dev/null @@ -1,34 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -// address -aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8.call() - -// bool -true.call() - -// char -'a'.call() - -// field -1field.call() - -//group -0group.call() -(0, 1)group.call() - -// ints -1i8.call() -1i16.call() -1i32.call() -1i64.call() -1i128.call() - -// uints -1u8.call() -1u16.call() -1u32.call() -1u64.call() -1u128.call() \ No newline at end of file diff --git a/tests/parser/expression/unary/negate.leo b/tests/parser/expression/unary/negate.leo index 1dc70ba2ed..39438fca2f 100644 --- a/tests/parser/expression/unary/negate.leo +++ b/tests/parser/expression/unary/negate.leo @@ -4,7 +4,6 @@ expectation: Pass */ -x --x.y -x() --x -!x diff --git a/tests/parser/expression/unary/not.leo b/tests/parser/expression/unary/not.leo index 998459f4e2..db83e523bd 100644 --- a/tests/parser/expression/unary/not.leo +++ b/tests/parser/expression/unary/not.leo @@ -4,7 +4,6 @@ expectation: Pass */ !x -!x.y !x() !!x !-x \ No newline at end of file diff --git a/tests/parser/statement/assign.leo b/tests/parser/statement/assign.leo index e757f617e3..583c3dcbd6 100644 --- a/tests/parser/statement/assign.leo +++ b/tests/parser/statement/assign.leo @@ -13,8 +13,6 @@ x = (x,y); x = x(); -x.y = y; - x += expr; x += (); @@ -23,10 +21,6 @@ x += x+y; x += x(); -x.0 += y; - -x.y += y; - x -= expr; x -= (); @@ -35,8 +29,6 @@ x -= x+y; x -= x(); -x.y -= y; - x *= expr; x *= (); @@ -47,8 +39,6 @@ x *= x(); x.0 *= y; -x.y *= y; - x /= expr; @@ -60,9 +50,6 @@ x /= x(); x.0 /= y; -x.y /= y; - - x **= expr; x **= (); @@ -74,5 +61,3 @@ x **= x(); x.0 **= y; - -x.y **= y; diff --git a/tests/parser/unreachable/math_op_pass.leo b/tests/parser/unreachable/math_op_pass.leo index 6be9810d17..cec1cc0064 100644 --- a/tests/parser/unreachable/math_op_pass.leo +++ b/tests/parser/unreachable/math_op_pass.leo @@ -3,7 +3,6 @@ namespace: ParseStatement expectation: Pass */ -let x = a . b; let x = a == b; From 27921a61e69f222d7b9975079d3867db7d028611 Mon Sep 17 00:00:00 2001 From: gluax <16431709+gluax@users.noreply.github.com> Date: Mon, 28 Mar 2022 10:35:36 -0700 Subject: [PATCH 10/10] tuples removed --- compiler/ast/src/accesses/mod.rs | 18 - compiler/ast/src/accesses/tuple_access.rs | 49 -- compiler/ast/src/common/mod.rs | 2 - compiler/ast/src/common/vec_tendril_json.rs | 34 - compiler/ast/src/expression/accesses.rs | 53 -- compiler/ast/src/expression/mod.rs | 14 - compiler/ast/src/expression/tuple_init.rs | 50 -- compiler/ast/src/input/input_value.rs | 19 - compiler/ast/src/lib.rs | 3 - .../src/reducer/reconstructing_director.rs | 37 -- .../ast/src/reducer/reconstructing_reducer.rs | 19 - compiler/ast/src/types/type_.rs | 13 +- compiler/parser/src/parser/expression.rs | 17 +- compiler/parser/src/parser/statement.rs | 13 +- compiler/parser/src/parser/type_.rs | 3 - .../parser/expression/access/call.leo.out | 24 - .../expression/literal/group_fail.leo.out | 12 +- .../parser/functions/const_function.leo.out | 23 +- .../parser/functions/const_param.leo.out | 46 +- .../parser/parser/functions/params.leo.out | 23 +- .../parser/functions/params_return.leo.out | 23 +- .../parser/parser/functions/return.leo.out | 23 +- .../parser/inputs/input_success.leo.out | 274 +++----- .../parser/parser/statement/assign.leo.out | 326 ---------- .../parser/statement/assign_fail.leo.out | 2 +- .../parser/parser/statement/block.leo.out | 69 +- .../parser/statement/conditional.leo.out | 107 +-- .../parser/statement/definition.leo.out | 615 ------------------ .../parser/statement/definition_fail.leo.out | 16 +- .../parser/statement/expression.leo.out | 38 -- .../parser/parser/statement/iteration.leo.out | 69 +- .../parser/parser/statement/return.leo.out | 78 --- .../parser/parser/unreachable/eat_int.leo.out | 100 +-- .../parser/unreachable/math_op_pass.leo.out | 42 -- tests/parser/expression/access/call.leo | 1 - tests/parser/expression/access/tuple.leo | 11 - tests/parser/expression/tuple.leo | 19 - tests/parser/functions/const_function.leo | 2 +- tests/parser/functions/const_param.leo | 4 +- tests/parser/functions/empty.leo | 8 - tests/parser/functions/param_tuple.leo | 8 - tests/parser/functions/params.leo | 2 +- tests/parser/functions/params_return.leo | 2 +- tests/parser/functions/return.leo | 2 +- tests/parser/functions/return_tuple.leo | 8 - tests/parser/inputs/input_success.leo | 3 - tests/parser/statement/assign.leo | 25 - tests/parser/statement/block.leo | 6 +- tests/parser/statement/conditional.leo | 10 +- tests/parser/statement/definition.leo | 35 - tests/parser/statement/expression.leo | 4 - tests/parser/statement/iteration.leo | 6 +- tests/parser/statement/return.leo | 8 - tests/parser/unreachable/math_op_pass.leo | 4 - 54 files changed, 340 insertions(+), 2082 deletions(-) delete mode 100644 compiler/ast/src/accesses/mod.rs delete mode 100644 compiler/ast/src/accesses/tuple_access.rs delete mode 100644 compiler/ast/src/common/vec_tendril_json.rs delete mode 100644 compiler/ast/src/expression/accesses.rs delete mode 100644 compiler/ast/src/expression/tuple_init.rs delete mode 100644 tests/parser/expression/access/tuple.leo delete mode 100644 tests/parser/expression/tuple.leo delete mode 100644 tests/parser/functions/empty.leo delete mode 100644 tests/parser/functions/param_tuple.leo delete mode 100644 tests/parser/functions/return_tuple.leo diff --git a/compiler/ast/src/accesses/mod.rs b/compiler/ast/src/accesses/mod.rs deleted file mode 100644 index 23b2e3321a..0000000000 --- a/compiler/ast/src/accesses/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -mod tuple_access; -pub use tuple_access::*; diff --git a/compiler/ast/src/accesses/tuple_access.rs b/compiler/ast/src/accesses/tuple_access.rs deleted file mode 100644 index 89e8e1429e..0000000000 --- a/compiler/ast/src/accesses/tuple_access.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{Expression, Node, PositiveNumber}; -use leo_span::Span; - -use std::fmt; - -use serde::{Deserialize, Serialize}; - -/// An tuple access expression, e.g., `tuple.index`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct TupleAccess { - /// An expression evaluating to some tuple type, e.g., `(5, 2)`. - pub tuple: Box, - /// The index to access in the tuple expression. E.g., `0` for `(5, 2)` would yield `5`. - pub index: PositiveNumber, - /// The span for the entire expression `tuple.index`. - pub span: Span, -} - -impl fmt::Display for TupleAccess { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}.{}", self.tuple, self.index) - } -} - -impl Node for TupleAccess { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/common/mod.rs b/compiler/ast/src/common/mod.rs index e53ff1a1af..ad45846431 100644 --- a/compiler/ast/src/common/mod.rs +++ b/compiler/ast/src/common/mod.rs @@ -24,5 +24,3 @@ pub use imported_modules::*; pub mod positive_number; pub use positive_number::*; - -pub mod vec_tendril_json; diff --git a/compiler/ast/src/common/vec_tendril_json.rs b/compiler/ast/src/common/vec_tendril_json.rs deleted file mode 100644 index 79c288428f..0000000000 --- a/compiler/ast/src/common/vec_tendril_json.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; -use tendril::StrTendril; - -#[allow(clippy::ptr_arg)] -pub fn serialize(tendril: &Vec, serializer: S) -> Result { - tendril - .iter() - .map(|x| x.as_ref()) - .collect::>() - .serialize(serializer) -} - -pub fn deserialize<'de, D: Deserializer<'de>>(deserializer: D) -> Result, D::Error> { - Ok(Vec::::deserialize(deserializer)? - .into_iter() - .map(|x| x.into()) - .collect()) -} diff --git a/compiler/ast/src/expression/accesses.rs b/compiler/ast/src/expression/accesses.rs deleted file mode 100644 index 1cab84d36d..0000000000 --- a/compiler/ast/src/expression/accesses.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use super::*; -use crate::accesses::*; - -/// An access expressions, extracting a smaller part out of a whole. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum AccessExpression { - /// Access to a tuple field using its position, e.g., `tuple.1`. - Tuple(TupleAccess), -} - -impl fmt::Display for AccessExpression { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use AccessExpression::*; - - match self { - Tuple(access) => access.fmt(f), - } - } -} - -impl Node for AccessExpression { - fn span(&self) -> &Span { - use AccessExpression::*; - - match &self { - Tuple(access) => access.span(), - } - } - - fn set_span(&mut self, span: Span) { - use AccessExpression::*; - - match self { - Tuple(access) => access.set_span(span), - } - } -} diff --git a/compiler/ast/src/expression/mod.rs b/compiler/ast/src/expression/mod.rs index 684ec093c7..e4f0e7a117 100644 --- a/compiler/ast/src/expression/mod.rs +++ b/compiler/ast/src/expression/mod.rs @@ -21,16 +21,12 @@ use leo_span::Span; use serde::{Deserialize, Serialize}; use std::fmt; -mod accesses; -pub use accesses::*; mod binary; pub use binary::*; mod unary; pub use unary::*; mod ternary; pub use ternary::*; -mod tuple_init; -pub use tuple_init::*; mod value; pub use value::*; mod call; @@ -51,10 +47,6 @@ pub enum Expression { Unary(UnaryExpression), /// A ternary conditional expression `cond ? if_expr : else_expr`. Ternary(TernaryExpression), - /// An access expression of some sort, e.g., `array[idx]` or `foo.bar`. - Access(AccessExpression), - /// A tuple expression e.g., `(foo, 42, true)`. - TupleInit(TupleInitExpression), /// A call expression like `my_fun(args)`. Call(CallExpression), /// An expression of type "error". @@ -71,9 +63,7 @@ impl Node for Expression { Binary(n) => n.span(), Unary(n) => n.span(), Ternary(n) => n.span(), - TupleInit(n) => n.span(), Call(n) => n.span(), - Access(n) => n.span(), Err(n) => n.span(), } } @@ -86,9 +76,7 @@ impl Node for Expression { Binary(n) => n.set_span(span), Unary(n) => n.set_span(span), Ternary(n) => n.set_span(span), - TupleInit(n) => n.set_span(span), Call(n) => n.set_span(span), - Access(n) => n.set_span(span), Err(n) => n.set_span(span), } } @@ -103,9 +91,7 @@ impl fmt::Display for Expression { Binary(n) => n.fmt(f), Unary(n) => n.fmt(f), Ternary(n) => n.fmt(f), - TupleInit(n) => n.fmt(f), Call(n) => n.fmt(f), - Access(n) => n.fmt(f), Err(n) => n.fmt(f), } } diff --git a/compiler/ast/src/expression/tuple_init.rs b/compiler/ast/src/expression/tuple_init.rs deleted file mode 100644 index 7167b63300..0000000000 --- a/compiler/ast/src/expression/tuple_init.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) 2019-2022 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use super::*; - -/// A tuple construction expression, e.g., `(foo, false, 42)`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct TupleInitExpression { - /// The elements of the tuple. - /// In the example above, it would be `foo`, `false`, and `42`. - pub elements: Vec, - /// The span from `(` to `)`. - pub span: Span, -} - -impl fmt::Display for TupleInitExpression { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "(")?; - for (i, member) in self.elements.iter().enumerate() { - write!(f, "{}", member)?; - if i < self.elements.len() - 1 { - write!(f, ", ")?; - } - } - write!(f, ")") - } -} - -impl Node for TupleInitExpression { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/input/input_value.rs b/compiler/ast/src/input/input_value.rs index b041b3d4d1..e31121079d 100644 --- a/compiler/ast/src/input/input_value.rs +++ b/compiler/ast/src/input/input_value.rs @@ -28,7 +28,6 @@ pub enum InputValue { Field(String), Group(GroupValue), Integer(IntegerType, String), - Tuple(Vec), } impl TryFrom<(Type, Expression)> for InputValue { @@ -60,20 +59,6 @@ impl TryFrom<(Type, Expression)> for InputValue { } } } - (Type::Tuple(types), Expression::TupleInit(tuple_init)) => { - let size = tuple_init.elements.len(); - let mut elements = Vec::with_capacity(size); - - if size != types.len() { - return Err(InputError::tuple_length_mismatch(size, types.len(), tuple_init.span()).into()); - } - - for (i, element) in tuple_init.elements.into_iter().enumerate() { - elements.push(Self::try_from((types[i].clone(), element))?); - } - - Self::Tuple(elements) - } (_type_, expr) => return Err(InputError::illegal_expression(&expr, expr.span()).into()), }) } @@ -88,10 +73,6 @@ impl fmt::Display for InputValue { InputValue::Group(ref group) => write!(f, "{}", group), InputValue::Field(ref field) => write!(f, "{}", field), InputValue::Integer(ref type_, ref number) => write!(f, "{}{:?}", number, type_), - InputValue::Tuple(ref tuple) => { - let values = tuple.iter().map(|x| x.to_string()).collect::>().join(", "); - write!(f, "({})", values) - } } } } diff --git a/compiler/ast/src/lib.rs b/compiler/ast/src/lib.rs index be4eb84c78..b988b348cd 100644 --- a/compiler/ast/src/lib.rs +++ b/compiler/ast/src/lib.rs @@ -22,9 +22,6 @@ #![doc = include_str!("../README.md")] -pub mod accesses; -pub use self::accesses::*; - pub mod chars; pub use self::chars::*; diff --git a/compiler/ast/src/reducer/reconstructing_director.rs b/compiler/ast/src/reducer/reconstructing_director.rs index 9f1110f951..06161ac65c 100644 --- a/compiler/ast/src/reducer/reconstructing_director.rs +++ b/compiler/ast/src/reducer/reconstructing_director.rs @@ -35,14 +35,6 @@ impl ReconstructingDirector { pub fn reduce_type(&mut self, type_: &Type, span: &Span) -> Result { let new = match type_ { - Type::Tuple(types) => { - let mut reduced_types = vec![]; - for type_ in types.iter() { - reduced_types.push(self.reduce_type(type_, span)?); - } - - Type::Tuple(reduced_types) - } Type::Identifier(identifier) => Type::Identifier(self.reduce_identifier(identifier)?), _ => type_.clone(), }; @@ -58,10 +50,6 @@ impl ReconstructingDirector { Expression::Binary(binary) => Expression::Binary(self.reduce_binary(binary)?), Expression::Unary(unary) => Expression::Unary(self.reduce_unary(unary)?), Expression::Ternary(ternary) => Expression::Ternary(self.reduce_ternary(ternary)?), - Expression::Access(access) => Expression::Access(self.reduce_access(access)?), - - Expression::TupleInit(tuple_init) => Expression::TupleInit(self.reduce_tuple_init(tuple_init)?), - Expression::Call(call) => Expression::Call(self.reduce_call(call)?), Expression::Err(s) => Expression::Err(s.clone()), }; @@ -123,31 +111,6 @@ impl ReconstructingDirector { self.reducer.reduce_ternary(ternary, condition, if_true, if_false) } - pub fn reduce_tuple_access(&mut self, tuple_access: &TupleAccess) -> Result { - let tuple = self.reduce_expression(&tuple_access.tuple)?; - - self.reducer.reduce_tuple_access(tuple_access, tuple) - } - - pub fn reduce_access(&mut self, access: &AccessExpression) -> Result { - use AccessExpression::*; - - let new = match access { - Tuple(access) => Tuple(self.reduce_tuple_access(access)?), - }; - - Ok(new) - } - - pub fn reduce_tuple_init(&mut self, tuple_init: &TupleInitExpression) -> Result { - let mut elements = vec![]; - for element in tuple_init.elements.iter() { - elements.push(self.reduce_expression(element)?); - } - - self.reducer.reduce_tuple_init(tuple_init, elements) - } - pub fn reduce_call(&mut self, call: &CallExpression) -> Result { let function = self.reduce_expression(&call.function)?; diff --git a/compiler/ast/src/reducer/reconstructing_reducer.rs b/compiler/ast/src/reducer/reconstructing_reducer.rs index b52aacec81..9521010288 100644 --- a/compiler/ast/src/reducer/reconstructing_reducer.rs +++ b/compiler/ast/src/reducer/reconstructing_reducer.rs @@ -113,25 +113,6 @@ pub trait ReconstructingReducer { }) } - fn reduce_tuple_access(&mut self, tuple_access: &TupleAccess, tuple: Expression) -> Result { - Ok(TupleAccess { - tuple: Box::new(tuple), - index: tuple_access.index.clone(), - span: tuple_access.span.clone(), - }) - } - - fn reduce_tuple_init( - &mut self, - tuple_init: &TupleInitExpression, - elements: Vec, - ) -> Result { - Ok(TupleInitExpression { - elements, - span: tuple_init.span.clone(), - }) - } - fn reduce_call( &mut self, call: &CallExpression, diff --git a/compiler/ast/src/types/type_.rs b/compiler/ast/src/types/type_.rs index 07700ec31e..0c19983eee 100644 --- a/compiler/ast/src/types/type_.rs +++ b/compiler/ast/src/types/type_.rs @@ -36,9 +36,6 @@ pub enum Type { /// An integer type. IntegerType(IntegerType), - /// A tuple type `(T_0, T_1, ...)` made up of a list of types. - Tuple(Vec), - /// A reference to either a nominal type (e.g., a `circuit`) or a type alias. Identifier(Identifier), @@ -69,10 +66,7 @@ impl Type { (Type::Group, Type::Group) => true, (Type::IntegerType(left), Type::IntegerType(right)) => left.eq(right), (Type::Identifier(left), Type::Identifier(right)) => left.eq(right), - (Type::Tuple(left), Type::Tuple(right)) => left - .iter() - .zip(right) - .all(|(left_type, right_type)| left_type.eq_flat(right_type)), + _ => false, } } @@ -88,11 +82,6 @@ impl fmt::Display for Type { Type::Group => write!(f, "group"), Type::IntegerType(ref integer_type) => write!(f, "{}", integer_type), Type::Identifier(ref variable) => write!(f, "circuit {}", variable), - Type::Tuple(ref tuple) => { - let types = tuple.iter().map(|x| x.to_string()).collect::>().join(", "); - - write!(f, "({})", types) - } Type::Err => write!(f, "error"), } } diff --git a/compiler/parser/src/parser/expression.rs b/compiler/parser/src/parser/expression.rs index 7632f162b6..2e9409e10a 100644 --- a/compiler/parser/src/parser/expression.rs +++ b/compiler/parser/src/parser/expression.rs @@ -252,16 +252,8 @@ impl ParserContext<'_> { while let Some(token) = self.eat_any(&[Token::Dot, Token::LeftParen]) { match token.token { Token::Dot => { - if let Some((num, span)) = self.eat_int() { - expr = Expression::Access(AccessExpression::Tuple(TupleAccess { - span: expr.span() + &span, - tuple: Box::new(expr), - index: num, - })); - } else { - let next = self.peek()?; - return Err(ParserError::unexpected_str(&next.token, "int or ident", &next.span).into()); - } + let next = self.peek()?; + return Err(ParserError::unexpected_str(&next.token, "int or ident", &next.span).into()); } Token::LeftParen => { let mut arguments = Vec::new(); @@ -321,10 +313,7 @@ impl ParserContext<'_> { if args.len() == 1 { Ok(args.remove(0)) } else { - Ok(Expression::TupleInit(TupleInitExpression { - span: span + &end_span, - elements: args, - })) + Err(ParserError::unexpected("A tuple expression.", "A valid expression.", &(span + &end_span)).into()) } } diff --git a/compiler/parser/src/parser/statement.rs b/compiler/parser/src/parser/statement.rs index a0ada17f6c..ce2fdaa0a6 100644 --- a/compiler/parser/src/parser/statement.rs +++ b/compiler/parser/src/parser/statement.rs @@ -33,20 +33,11 @@ impl ParserContext<'_> { /// Returns an [`Identifier`] AST node if the given [`Expression`] AST node evaluates to an /// identifier access. The access is stored in the given accesses. /// - pub fn construct_assignee_access(expr: Expression, accesses: &mut Vec) -> Result { - let identifier; + pub fn construct_assignee_access(expr: Expression, _accesses: &mut Vec) -> Result { match expr { - Expression::Access(access) => match access { - AccessExpression::Tuple(expr) => { - identifier = Self::construct_assignee_access(*expr.tuple, accesses)?; - accesses.push(AssigneeAccess::Tuple(expr.index, expr.span)); - } - }, - - Expression::Identifier(id) => identifier = id, + Expression::Identifier(id) => Ok(id), _ => return Err(ParserError::invalid_assignment_target(expr.span()).into()), } - Ok(identifier) } /// diff --git a/compiler/parser/src/parser/type_.rs b/compiler/parser/src/parser/type_.rs index e1376b2b64..4b8caefb07 100644 --- a/compiler/parser/src/parser/type_.rs +++ b/compiler/parser/src/parser/type_.rs @@ -61,9 +61,6 @@ impl ParserContext<'_> { Ok(if let Some(ident) = self.eat_identifier() { let span = ident.span.clone(); (Type::Identifier(ident), span) - } else if self.peek_is_left_par() { - let (types, _, span) = self.parse_paren_comma_list(|p| p.parse_type().map(|t| Some(t.0)))?; - (Type::Tuple(types), span) } else { let token = self.expect_oneof(TYPE_TOKENS)?; ( diff --git a/tests/expectations/parser/parser/expression/access/call.leo.out b/tests/expectations/parser/parser/expression/access/call.leo.out index 2472f55b58..51bf44b889 100644 --- a/tests/expectations/parser/parser/expression/access/call.leo.out +++ b/tests/expectations/parser/parser/expression/access/call.leo.out @@ -63,27 +63,3 @@ outputs: col_stop: 11 path: "" content: "x(x, y, z)" - - Call: - function: - Access: - Tuple: - tuple: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0(x)\\\"}\"}" - index: - value: "0" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0(x) - arguments: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0(x)\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: x.0(x) diff --git a/tests/expectations/parser/parser/expression/literal/group_fail.leo.out b/tests/expectations/parser/parser/expression/literal/group_fail.leo.out index 4114e3fa46..929acf4609 100644 --- a/tests/expectations/parser/parser/expression/literal/group_fail.leo.out +++ b/tests/expectations/parser/parser/expression/literal/group_fail.leo.out @@ -2,15 +2,15 @@ namespace: ParseExpression expectation: Fail outputs: - - "did not consume all input: 'group' @ 1:3-8\n" + - "Error [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:1\n |\n 1 | ()group\n | ^^" - "did not consume all input: 'group' @ 1:6-11\n" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:2\n |\n 1 | (,)group\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '+'\n --> test:1:2\n |\n 1 | (+, -,)group\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:2\n |\n 1 | (,+, -)group\n | ^" - - "did not consume all input: 'group' @ 1:6-11\n" - - "did not consume all input: 'group' @ 1:12-17\n" - - "did not consume all input: 'group' @ 1:15-20\n" + - "Error [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:1\n |\n 1 | (x,y)group\n | ^^^^^" + - "Error [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:1\n |\n 1 | (123,456u8)group\n | ^^^^^^^^^^^" + - "Error [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:1\n |\n 1 | (123,456field)group\n | ^^^^^^^^^^^^^^" - "Error [EPAR0370004]: Unexpected white space between terms (123,456) and group\n --> test:1:10\n |\n 1 | (123, 456) group\n | ^" - "did not consume all input: 'group' @ 1:8-13\n" - - "did not consume all input: 'group' @ 1:16-21\n" - - "did not consume all input: 'bool' @ 1:11-15\n" + - "Error [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:1\n |\n 1 | (123, 456, 789)group\n | ^^^^^^^^^^^^^^^" + - "Error [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:1\n |\n 1 | (123, 456)bool\n | ^^^^^^^^^^" diff --git a/tests/expectations/parser/parser/functions/const_function.leo.out b/tests/expectations/parser/parser/functions/const_function.leo.out index 279b8694e6..b860726f28 100644 --- a/tests/expectations/parser/parser/functions/const_function.leo.out +++ b/tests/expectations/parser/parser/functions/const_function.leo.out @@ -15,22 +15,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 4 - line_stop: 4 - col_start: 12 - col_stop: 14 - path: "" - content: " return ();" + Value: + Implicit: + - "0" + - span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 13 + path: "" + content: " return 0;" span: line_start: 4 line_stop: 4 col_start: 5 - col_stop: 14 + col_stop: 13 path: "" - content: " return ();" + content: " return 0;" span: line_start: 3 line_stop: 5 diff --git a/tests/expectations/parser/parser/functions/const_param.leo.out b/tests/expectations/parser/parser/functions/const_param.leo.out index 7e1e9b437a..1abefd7344 100644 --- a/tests/expectations/parser/parser/functions/const_param.leo.out +++ b/tests/expectations/parser/parser/functions/const_param.leo.out @@ -41,22 +41,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 4 - line_stop: 4 - col_start: 12 - col_stop: 14 - path: "" - content: " return ();" + Value: + Implicit: + - "0" + - span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 13 + path: "" + content: " return 0;" span: line_start: 4 line_stop: 4 col_start: 5 - col_stop: 14 + col_stop: 13 path: "" - content: " return ();" + content: " return 0;" span: line_start: 3 line_stop: 5 @@ -107,22 +108,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 8 - line_stop: 8 - col_start: 12 - col_stop: 14 - path: "" - content: " return ();" + Value: + Implicit: + - "0" + - span: + line_start: 8 + line_stop: 8 + col_start: 12 + col_stop: 13 + path: "" + content: " return 0;" span: line_start: 8 line_stop: 8 col_start: 5 - col_stop: 14 + col_stop: 13 path: "" - content: " return ();" + content: " return 0;" span: line_start: 7 line_stop: 9 diff --git a/tests/expectations/parser/parser/functions/params.leo.out b/tests/expectations/parser/parser/functions/params.leo.out index 908451d00c..555c27d59b 100644 --- a/tests/expectations/parser/parser/functions/params.leo.out +++ b/tests/expectations/parser/parser/functions/params.leo.out @@ -41,22 +41,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 4 - line_stop: 4 - col_start: 12 - col_stop: 14 - path: "" - content: " return ();" + Value: + Implicit: + - "0" + - span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 13 + path: "" + content: " return 0;" span: line_start: 4 line_stop: 4 col_start: 5 - col_stop: 14 + col_stop: 13 path: "" - content: " return ();" + content: " return 0;" span: line_start: 3 line_stop: 5 diff --git a/tests/expectations/parser/parser/functions/params_return.leo.out b/tests/expectations/parser/parser/functions/params_return.leo.out index afda5e6cfc..6be865eaa0 100644 --- a/tests/expectations/parser/parser/functions/params_return.leo.out +++ b/tests/expectations/parser/parser/functions/params_return.leo.out @@ -42,22 +42,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 4 - line_stop: 4 - col_start: 12 - col_stop: 14 - path: "" - content: " return ();" + Value: + Implicit: + - "0" + - span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 13 + path: "" + content: " return 0;" span: line_start: 4 line_stop: 4 col_start: 5 - col_stop: 14 + col_stop: 13 path: "" - content: " return ();" + content: " return 0;" span: line_start: 3 line_stop: 5 diff --git a/tests/expectations/parser/parser/functions/return.leo.out b/tests/expectations/parser/parser/functions/return.leo.out index de005bdb0e..c3e05b9ae2 100644 --- a/tests/expectations/parser/parser/functions/return.leo.out +++ b/tests/expectations/parser/parser/functions/return.leo.out @@ -16,22 +16,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 4 - line_stop: 4 - col_start: 12 - col_stop: 14 - path: "" - content: " return ();" + Value: + Implicit: + - "0" + - span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 13 + path: "" + content: " return 0;" span: line_start: 4 line_stop: 4 col_start: 5 - col_stop: 14 + col_stop: 13 path: "" - content: " return ();" + content: " return 0;" span: line_start: 3 line_stop: 5 diff --git a/tests/expectations/parser/parser/inputs/input_success.leo.out b/tests/expectations/parser/parser/inputs/input_success.leo.out index e5b57a942f..e8089469d1 100644 --- a/tests/expectations/parser/parser/inputs/input_success.leo.out +++ b/tests/expectations/parser/parser/inputs/input_success.leo.out @@ -126,48 +126,6 @@ outputs: col_stop: 11 path: "" content: "e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;" - - type_: - Tuple: - - Boolean - - Boolean - name: "{\"name\":\"h\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"h: (bool, bool) = (true, false); \\\"}\"}" - value: - TupleInit: - elements: - - Value: - Boolean: - - "true" - - span: - line_start: 9 - line_stop: 9 - col_start: 20 - col_stop: 24 - path: "" - content: "h: (bool, bool) = (true, false); " - - Value: - Boolean: - - "false" - - span: - line_start: 9 - line_stop: 9 - col_start: 26 - col_stop: 31 - path: "" - content: "h: (bool, bool) = (true, false); " - span: - line_start: 9 - line_stop: 9 - col_start: 19 - col_stop: 32 - path: "" - content: "h: (bool, bool) = (true, false); " - span: - line_start: 9 - line_stop: 9 - col_start: 4 - col_stop: 16 - path: "" - content: "h: (bool, bool) = (true, false); " span: line_start: 3 line_stop: 3 @@ -178,68 +136,68 @@ outputs: - name: registers definitions: - type_: Boolean - name: "{\"name\":\"r0\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r0: bool = true; \\\"}\"}" + name: "{\"name\":\"r0\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r0: bool = true; \\\"}\"}" value: Value: Boolean: - "true" - span: - line_start: 12 - line_stop: 12 + line_start: 11 + line_stop: 11 col_start: 13 col_stop: 17 path: "" content: "r0: bool = true; " span: - line_start: 12 - line_stop: 12 + line_start: 11 + line_stop: 11 col_start: 5 col_stop: 9 path: "" content: "r0: bool = true; " - type_: IntegerType: U8 - name: "{\"name\":\"r1\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r1: u8 = 2; \\\"}\"}" + name: "{\"name\":\"r1\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r1: u8 = 2; \\\"}\"}" value: Value: Implicit: - "2" + - span: + line_start: 12 + line_stop: 12 + col_start: 13 + col_stop: 14 + path: "" + content: "r1: u8 = 2; " + span: + line_start: 12 + line_stop: 12 + col_start: 5 + col_stop: 7 + path: "" + content: "r1: u8 = 2; " + - type_: Field + name: "{\"name\":\"r2\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r2: field = 0; \\\"}\"}" + value: + Value: + Implicit: + - "0" - span: line_start: 13 line_stop: 13 col_start: 13 col_stop: 14 path: "" - content: "r1: u8 = 2; " + content: "r2: field = 0; " span: line_start: 13 line_stop: 13 col_start: 5 - col_stop: 7 - path: "" - content: "r1: u8 = 2; " - - type_: Field - name: "{\"name\":\"r2\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r2: field = 0; \\\"}\"}" - value: - Value: - Implicit: - - "0" - - span: - line_start: 14 - line_stop: 14 - col_start: 13 - col_stop: 14 - path: "" - content: "r2: field = 0; " - span: - line_start: 14 - line_stop: 14 - col_start: 5 col_stop: 10 path: "" content: "r2: field = 0; " - type_: Group - name: "{\"name\":\"r3\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r3: group = (0, 1)group; \\\"}\"}" + name: "{\"name\":\"r3\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r3: group = (0, 1)group; \\\"}\"}" value: Value: Group: @@ -248,8 +206,8 @@ outputs: Number: - "0" - span: - line_start: 15 - line_stop: 15 + line_start: 14 + line_stop: 14 col_start: 14 col_stop: 15 path: "" @@ -258,91 +216,49 @@ outputs: Number: - "1" - span: - line_start: 15 - line_stop: 15 + line_start: 14 + line_stop: 14 col_start: 17 col_stop: 18 path: "" content: "r3: group = (0, 1)group; " span: - line_start: 15 - line_stop: 15 + line_start: 14 + line_stop: 14 col_start: 14 col_stop: 24 path: "" content: "r3: group = (0, 1)group; " span: - line_start: 15 - line_stop: 15 + line_start: 14 + line_stop: 14 col_start: 5 col_stop: 10 path: "" content: "r3: group = (0, 1)group; " - type_: Address - name: "{\"name\":\"r4\",\"span\":\"{\\\"line_start\\\":16,\\\"line_stop\\\":16,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}" + name: "{\"name\":\"r4\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}" value: Value: Address: - aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 - span: - line_start: 16 - line_stop: 16 + line_start: 15 + line_stop: 15 col_start: 15 col_stop: 78 path: "" content: "r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;" span: - line_start: 16 - line_stop: 16 + line_start: 15 + line_stop: 15 col_start: 5 col_stop: 12 path: "" content: "r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;" - - type_: - Tuple: - - Boolean - - Boolean - name: "{\"name\":\"r7\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r7: (bool, bool) = (true, false); \\\"}\"}" - value: - TupleInit: - elements: - - Value: - Boolean: - - "true" - - span: - line_start: 17 - line_stop: 17 - col_start: 21 - col_stop: 25 - path: "" - content: "r7: (bool, bool) = (true, false); " - - Value: - Boolean: - - "false" - - span: - line_start: 17 - line_stop: 17 - col_start: 27 - col_stop: 32 - path: "" - content: "r7: (bool, bool) = (true, false); " - span: - line_start: 17 - line_stop: 17 - col_start: 20 - col_stop: 33 - path: "" - content: "r7: (bool, bool) = (true, false); " - span: - line_start: 17 - line_stop: 17 - col_start: 5 - col_stop: 17 - path: "" - content: "r7: (bool, bool) = (true, false); " span: - line_start: 11 - line_stop: 11 + line_start: 10 + line_stop: 10 col_start: 2 col_stop: 11 path: "" @@ -350,68 +266,68 @@ outputs: - name: constants definitions: - type_: Boolean - name: "{\"name\":\"c0\",\"span\":\"{\\\"line_start\\\":20,\\\"line_stop\\\":20,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c0: bool = true; \\\"}\"}" + name: "{\"name\":\"c0\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c0: bool = true; \\\"}\"}" value: Value: Boolean: - "true" - span: - line_start: 20 - line_stop: 20 + line_start: 18 + line_stop: 18 col_start: 13 col_stop: 17 path: "" content: "c0: bool = true; " span: - line_start: 20 - line_stop: 20 + line_start: 18 + line_stop: 18 col_start: 5 col_stop: 9 path: "" content: "c0: bool = true; " - type_: IntegerType: U8 - name: "{\"name\":\"c1\",\"span\":\"{\\\"line_start\\\":21,\\\"line_stop\\\":21,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c1: u8 = 2; \\\"}\"}" + name: "{\"name\":\"c1\",\"span\":\"{\\\"line_start\\\":19,\\\"line_stop\\\":19,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c1: u8 = 2; \\\"}\"}" value: Value: Implicit: - "2" - span: - line_start: 21 - line_stop: 21 + line_start: 19 + line_stop: 19 col_start: 13 col_stop: 14 path: "" content: "c1: u8 = 2; " span: - line_start: 21 - line_stop: 21 + line_start: 19 + line_stop: 19 col_start: 5 col_stop: 7 path: "" content: "c1: u8 = 2; " - type_: Field - name: "{\"name\":\"c2\",\"span\":\"{\\\"line_start\\\":22,\\\"line_stop\\\":22,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c2: field = 0; \\\"}\"}" + name: "{\"name\":\"c2\",\"span\":\"{\\\"line_start\\\":20,\\\"line_stop\\\":20,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c2: field = 0; \\\"}\"}" value: Value: Implicit: - "0" - span: - line_start: 22 - line_stop: 22 + line_start: 20 + line_stop: 20 col_start: 13 col_stop: 14 path: "" content: "c2: field = 0; " span: - line_start: 22 - line_stop: 22 + line_start: 20 + line_stop: 20 col_start: 5 col_stop: 10 path: "" content: "c2: field = 0; " - type_: Group - name: "{\"name\":\"c3\",\"span\":\"{\\\"line_start\\\":23,\\\"line_stop\\\":23,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c3: group = (0, 1)group; \\\"}\"}" + name: "{\"name\":\"c3\",\"span\":\"{\\\"line_start\\\":21,\\\"line_stop\\\":21,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c3: group = (0, 1)group; \\\"}\"}" value: Value: Group: @@ -420,8 +336,8 @@ outputs: Number: - "0" - span: - line_start: 23 - line_stop: 23 + line_start: 21 + line_stop: 21 col_start: 14 col_stop: 15 path: "" @@ -430,91 +346,49 @@ outputs: Number: - "1" - span: - line_start: 23 - line_stop: 23 + line_start: 21 + line_stop: 21 col_start: 17 col_stop: 18 path: "" content: "c3: group = (0, 1)group; " span: - line_start: 23 - line_stop: 23 + line_start: 21 + line_stop: 21 col_start: 14 col_stop: 24 path: "" content: "c3: group = (0, 1)group; " span: - line_start: 23 - line_stop: 23 + line_start: 21 + line_stop: 21 col_start: 5 col_stop: 10 path: "" content: "c3: group = (0, 1)group; " - type_: Address - name: "{\"name\":\"c4\",\"span\":\"{\\\"line_start\\\":24,\\\"line_stop\\\":24,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}" + name: "{\"name\":\"c4\",\"span\":\"{\\\"line_start\\\":22,\\\"line_stop\\\":22,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}" value: Value: Address: - aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 - span: - line_start: 24 - line_stop: 24 + line_start: 22 + line_stop: 22 col_start: 15 col_stop: 78 path: "" content: "c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;" span: - line_start: 24 - line_stop: 24 + line_start: 22 + line_stop: 22 col_start: 5 col_stop: 12 path: "" content: "c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;" - - type_: - Tuple: - - Boolean - - Boolean - name: "{\"name\":\"c7\",\"span\":\"{\\\"line_start\\\":25,\\\"line_stop\\\":25,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c7: (bool, bool) = (true, false); \\\"}\"}" - value: - TupleInit: - elements: - - Value: - Boolean: - - "true" - - span: - line_start: 25 - line_stop: 25 - col_start: 21 - col_stop: 25 - path: "" - content: "c7: (bool, bool) = (true, false); " - - Value: - Boolean: - - "false" - - span: - line_start: 25 - line_stop: 25 - col_start: 27 - col_stop: 32 - path: "" - content: "c7: (bool, bool) = (true, false); " - span: - line_start: 25 - line_stop: 25 - col_start: 20 - col_stop: 33 - path: "" - content: "c7: (bool, bool) = (true, false); " - span: - line_start: 25 - line_stop: 25 - col_start: 5 - col_stop: 17 - path: "" - content: "c7: (bool, bool) = (true, false); " span: - line_start: 19 - line_stop: 19 + line_start: 17 + line_stop: 17 col_start: 2 col_stop: 11 path: "" diff --git a/tests/expectations/parser/parser/statement/assign.leo.out b/tests/expectations/parser/parser/statement/assign.leo.out index b9760d5364..ac520eb734 100644 --- a/tests/expectations/parser/parser/statement/assign.leo.out +++ b/tests/expectations/parser/parser/statement/assign.leo.out @@ -23,35 +23,6 @@ outputs: col_stop: 9 path: "" content: x = expr; - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x = ();\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x = (); - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 7 - path: "" - content: x = (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: x = (); - Assign: operation: Assign assignee: @@ -85,37 +56,6 @@ outputs: col_stop: 8 path: "" content: x = x+y; - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x = (x,y);\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: "x = (x,y);" - value: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x = (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 10 - path: "" - content: "x = (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x = (x,y);" - Assign: operation: Assign assignee: @@ -168,35 +108,6 @@ outputs: col_stop: 10 path: "" content: x += expr; - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x += ();\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x += (); - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 8 - path: "" - content: x += (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: x += (); - Assign: operation: Add assignee: @@ -282,35 +193,6 @@ outputs: col_stop: 10 path: "" content: x -= expr; - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x -= ();\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x -= (); - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 8 - path: "" - content: x -= (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: x -= (); - Assign: operation: Sub assignee: @@ -396,35 +278,6 @@ outputs: col_stop: 10 path: "" content: x *= expr; - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x *= ();\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x *= (); - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 8 - path: "" - content: x *= (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: x *= (); - Assign: operation: Mul assignee: @@ -489,36 +342,6 @@ outputs: col_stop: 9 path: "" content: x *= x(); - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 *= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 *= y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 *= y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x.0 *= y; - Assign: operation: Div assignee: @@ -540,35 +363,6 @@ outputs: col_stop: 10 path: "" content: x /= expr; - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x /= ();\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x /= (); - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 8 - path: "" - content: x /= (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: x /= (); - Assign: operation: Div assignee: @@ -633,36 +427,6 @@ outputs: col_stop: 9 path: "" content: x /= x(); - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 /= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 /= y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 /= y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x.0 /= y; - Assign: operation: Pow assignee: @@ -684,35 +448,6 @@ outputs: col_stop: 11 path: "" content: x **= expr; - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x **= ();\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x **= (); - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 9 - path: "" - content: x **= (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x **= (); - Assign: operation: Pow assignee: @@ -746,64 +481,3 @@ outputs: col_stop: 10 path: "" content: x **= x+y; - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x **= x();\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x **= x(); - value: - Call: - function: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x **= x();\\\"}\"}" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 10 - path: "" - content: x **= x(); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: x **= x(); - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 **= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 **= y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 **= y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 **= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: x.0 **= y; diff --git a/tests/expectations/parser/parser/statement/assign_fail.leo.out b/tests/expectations/parser/parser/statement/assign_fail.leo.out index 4440cb96d8..a4ac3d898c 100644 --- a/tests/expectations/parser/parser/statement/assign_fail.leo.out +++ b/tests/expectations/parser/parser/statement/assign_fail.leo.out @@ -11,7 +11,7 @@ outputs: - "Error [EPAR0370005]: expected ; -- got 'as'\n --> test:1:3\n |\n 1 | x as u32 = y;\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [x, x, x] = y;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [x; 3] = y;\n | ^" - - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | (x, x, x) = y;\n | ^^^^^^^^^" + - "Error [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:1\n |\n 1 | (x, x, x) = y;\n | ^^^^^^^^^" - "Error [EPAR0370005]: expected ; -- got '{'\n --> test:1:3\n |\n 1 | x {x: y, y: z} = y;\n | ^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x() = y;\n | ^^^" - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got 'y'\n --> test:1:3\n |\n 1 | x.y() = y;\n | ^" diff --git a/tests/expectations/parser/parser/statement/block.leo.out b/tests/expectations/parser/parser/statement/block.leo.out index 4ad226b576..8b88799c01 100644 --- a/tests/expectations/parser/parser/statement/block.leo.out +++ b/tests/expectations/parser/parser/statement/block.leo.out @@ -15,22 +15,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 2 - line_stop: 2 - col_start: 8 - col_stop: 10 - path: "" - content: return (); + Value: + Implicit: + - "0" + - span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 9 + path: "" + content: return 0; span: line_start: 2 line_stop: 2 col_start: 1 - col_stop: 10 + col_stop: 9 path: "" - content: return (); + content: return 0; span: line_start: 1 line_stop: 3 @@ -62,22 +63,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 3 - line_stop: 3 - col_start: 8 - col_stop: 10 - path: "" - content: return (); + Value: + Implicit: + - "0" + - span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 9 + path: "" + content: return 0; span: line_start: 3 line_stop: 3 col_start: 1 - col_stop: 10 + col_stop: 9 path: "" - content: return (); + content: return 0; span: line_start: 2 line_stop: 4 @@ -101,22 +103,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 3 - line_stop: 3 - col_start: 8 - col_stop: 10 - path: "" - content: return (); + Value: + Implicit: + - "0" + - span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 9 + path: "" + content: return 0; span: line_start: 3 line_stop: 3 col_start: 1 - col_stop: 10 + col_stop: 9 path: "" - content: return (); + content: return 0; span: line_start: 2 line_stop: 4 diff --git a/tests/expectations/parser/parser/statement/conditional.leo.out b/tests/expectations/parser/parser/statement/conditional.leo.out index 3fd8752374..48d793e620 100644 --- a/tests/expectations/parser/parser/statement/conditional.leo.out +++ b/tests/expectations/parser/parser/statement/conditional.leo.out @@ -9,22 +9,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 2 - line_stop: 2 - col_start: 8 - col_stop: 10 - path: "" - content: return (); + Value: + Implicit: + - "0" + - span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 9 + path: "" + content: return 0; span: line_start: 2 line_stop: 2 col_start: 1 - col_stop: 10 + col_stop: 9 path: "" - content: return (); + content: return 0; span: line_start: 1 line_stop: 3 @@ -40,44 +41,6 @@ outputs: col_stop: 2 path: "" content: "if x {\n ...\n}" - - Conditional: - condition: - Identifier: "{\"name\":\"Self\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"if Self {\\\"}\"}" - block: - statements: - - Return: - expression: - TupleInit: - elements: [] - span: - line_start: 2 - line_stop: 2 - col_start: 8 - col_stop: 10 - path: "" - content: return (); - span: - line_start: 2 - line_stop: 2 - col_start: 1 - col_stop: 10 - path: "" - content: return (); - span: - line_start: 1 - line_stop: 3 - col_start: 9 - col_stop: 2 - path: "" - content: "if Self {\n ...\n}" - next: ~ - span: - line_start: 1 - line_stop: 3 - col_start: 1 - col_stop: 2 - path: "" - content: "if Self {\n ...\n}" - Conditional: condition: Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"if (x) {\\\"}\"}" @@ -85,22 +48,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 2 - line_stop: 2 - col_start: 8 - col_stop: 10 - path: "" - content: return (); + Value: + Implicit: + - "0" + - span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 9 + path: "" + content: return 0; span: line_start: 2 line_stop: 2 col_start: 1 - col_stop: 10 + col_stop: 9 path: "" - content: return (); + content: return 0; span: line_start: 1 line_stop: 3 @@ -247,22 +211,23 @@ outputs: content: expr; - Return: expression: - TupleInit: - elements: [] - span: - line_start: 3 - line_stop: 3 - col_start: 8 - col_stop: 10 - path: "" - content: return (); + Value: + Implicit: + - "0" + - span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 9 + path: "" + content: return 0; span: line_start: 3 line_stop: 3 col_start: 1 - col_stop: 10 + col_stop: 9 path: "" - content: return (); + content: return 0; span: line_start: 1 line_stop: 4 diff --git a/tests/expectations/parser/parser/statement/definition.leo.out b/tests/expectations/parser/parser/statement/definition.leo.out index e55ecc0284..56f9c11987 100644 --- a/tests/expectations/parser/parser/statement/definition.leo.out +++ b/tests/expectations/parser/parser/statement/definition.leo.out @@ -24,36 +24,6 @@ outputs: col_stop: 13 path: "" content: let x = expr; - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: let x = (); - type_: ~ - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 11 - path: "" - content: let x = (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: let x = (); - Definition: declaration_type: Let variable_names: @@ -88,38 +58,6 @@ outputs: col_stop: 12 path: "" content: let x = x+y; - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "let x = (x,y);" - type_: ~ - value: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 14 - path: "" - content: "let x = (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "let x = (x,y);" - Definition: declaration_type: Let variable_names: @@ -174,36 +112,6 @@ outputs: col_stop: 15 path: "" content: const x = expr; - - Definition: - declaration_type: Const - variable_names: - - mutable: false - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: const x = (); - type_: ~ - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 11 - col_stop: 13 - path: "" - content: const x = (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: const x = (); - Definition: declaration_type: Const variable_names: @@ -238,38 +146,6 @@ outputs: col_stop: 14 path: "" content: const x = x+y; - - Definition: - declaration_type: Const - variable_names: - - mutable: false - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "const x = (x,y);" - type_: ~ - value: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x = (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 11 - col_stop: 16 - path: "" - content: "const x = (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "const x = (x,y);" - Definition: declaration_type: Const variable_names: @@ -325,37 +201,6 @@ outputs: col_stop: 18 path: "" content: "let x: u32 = expr;" - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x: u32 = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "let x: u32 = ();" - type_: - IntegerType: U32 - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 14 - col_stop: 16 - path: "" - content: "let x: u32 = ();" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "let x: u32 = ();" - Definition: declaration_type: Let variable_names: @@ -391,39 +236,6 @@ outputs: col_stop: 17 path: "" content: "let x: u32 = x+y;" - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x: u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "let x: u32 = (x,y);" - type_: - IntegerType: U32 - value: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x: u32 = (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":17,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x: u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 14 - col_stop: 19 - path: "" - content: "let x: u32 = (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 19 - path: "" - content: "let x: u32 = (x,y);" - Definition: declaration_type: Let variable_names: @@ -480,37 +292,6 @@ outputs: col_stop: 20 path: "" content: "const x: u32 = expr;" - - Definition: - declaration_type: Const - variable_names: - - mutable: false - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x: u32 = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "const x: u32 = ();" - type_: - IntegerType: U32 - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 16 - col_stop: 18 - path: "" - content: "const x: u32 = ();" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 18 - path: "" - content: "const x: u32 = ();" - Definition: declaration_type: Const variable_names: @@ -546,39 +327,6 @@ outputs: col_stop: 19 path: "" content: "const x: u32 = x+y;" - - Definition: - declaration_type: Const - variable_names: - - mutable: false - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x: u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "const x: u32 = (x,y);" - type_: - IntegerType: U32 - value: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":17,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x: u32 = (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":19,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x: u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 16 - col_stop: 21 - path: "" - content: "const x: u32 = (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 21 - path: "" - content: "const x: u32 = (x,y);" - Definition: declaration_type: Const variable_names: @@ -643,45 +391,6 @@ outputs: col_stop: 18 path: "" content: "let (x, y) = expr;" - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y) = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "let (x, y) = ();" - - mutable: true - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y) = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 10 - path: "" - content: "let (x, y) = ();" - type_: ~ - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 14 - col_stop: 16 - path: "" - content: "let (x, y) = ();" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "let (x, y) = ();" - Definition: declaration_type: Let variable_names: @@ -725,47 +434,6 @@ outputs: col_stop: 17 path: "" content: "let (x, y) = x+y;" - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y) = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "let (x, y) = (x,y);" - - mutable: true - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y) = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 10 - path: "" - content: "let (x, y) = (x,y);" - type_: ~ - value: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y) = (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":17,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y) = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 14 - col_stop: 19 - path: "" - content: "let (x, y) = (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 19 - path: "" - content: "let (x, y) = (x,y);" - Definition: declaration_type: Let variable_names: @@ -838,45 +506,6 @@ outputs: col_stop: 20 path: "" content: "const (x, y) = expr;" - - Definition: - declaration_type: Const - variable_names: - - mutable: false - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y) = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "const (x, y) = ();" - - mutable: false - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y) = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 11 - col_stop: 12 - path: "" - content: "const (x, y) = ();" - type_: ~ - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 16 - col_stop: 18 - path: "" - content: "const (x, y) = ();" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 18 - path: "" - content: "const (x, y) = ();" - Definition: declaration_type: Const variable_names: @@ -920,47 +549,6 @@ outputs: col_stop: 19 path: "" content: "const (x, y) = x+y;" - - Definition: - declaration_type: Const - variable_names: - - mutable: false - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y) = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "const (x, y) = (x,y);" - - mutable: false - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y) = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 11 - col_stop: 12 - path: "" - content: "const (x, y) = (x,y);" - type_: ~ - value: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":17,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y) = (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":19,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y) = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 16 - col_stop: 21 - path: "" - content: "const (x, y) = (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 21 - path: "" - content: "const (x, y) = (x,y);" - Definition: declaration_type: Const variable_names: @@ -1034,46 +622,6 @@ outputs: col_stop: 23 path: "" content: "let (x, y): u32 = expr;" - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y): u32 = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "let (x, y): u32 = ();" - - mutable: true - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y): u32 = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 10 - path: "" - content: "let (x, y): u32 = ();" - type_: - IntegerType: U32 - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 19 - col_stop: 21 - path: "" - content: "let (x, y): u32 = ();" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 21 - path: "" - content: "let (x, y): u32 = ();" - Definition: declaration_type: Let variable_names: @@ -1118,48 +666,6 @@ outputs: col_stop: 22 path: "" content: "let (x, y): u32 = x+y;" - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y): u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "let (x, y): u32 = (x,y);" - - mutable: true - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y): u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 10 - path: "" - content: "let (x, y): u32 = (x,y);" - type_: - IntegerType: U32 - value: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y): u32 = (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":22,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y): u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 19 - col_stop: 24 - path: "" - content: "let (x, y): u32 = (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 24 - path: "" - content: "let (x, y): u32 = (x,y);" - Definition: declaration_type: Let variable_names: @@ -1234,46 +740,6 @@ outputs: col_stop: 25 path: "" content: "const (x, y): u32 = expr;" - - Definition: - declaration_type: Const - variable_names: - - mutable: false - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y): u32 = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "const (x, y): u32 = ();" - - mutable: false - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y): u32 = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 11 - col_stop: 12 - path: "" - content: "const (x, y): u32 = ();" - type_: - IntegerType: U32 - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 21 - col_stop: 23 - path: "" - content: "const (x, y): u32 = ();" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 23 - path: "" - content: "const (x, y): u32 = ();" - Definition: declaration_type: Const variable_names: @@ -1318,48 +784,6 @@ outputs: col_stop: 24 path: "" content: "const (x, y): u32 = x+y;" - - Definition: - declaration_type: Const - variable_names: - - mutable: false - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y): u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "const (x, y): u32 = (x,y);" - - mutable: false - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y): u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 11 - col_stop: 12 - path: "" - content: "const (x, y): u32 = (x,y);" - type_: - IntegerType: U32 - value: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":22,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y): u32 = (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":24,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y): u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 21 - col_stop: 26 - path: "" - content: "const (x, y): u32 = (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 26 - path: "" - content: "const (x, y): u32 = (x,y);" - Definition: declaration_type: Const variable_names: @@ -1402,45 +826,6 @@ outputs: col_stop: 24 path: "" content: "const (x, y): u32 = x();" - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x,y,) = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "let (x,y,) = ();" - - mutable: true - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x,y,) = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "let (x,y,) = ();" - type_: ~ - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 14 - col_stop: 16 - path: "" - content: "let (x,y,) = ();" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "let (x,y,) = ();" - Definition: declaration_type: Let variable_names: diff --git a/tests/expectations/parser/parser/statement/definition_fail.leo.out b/tests/expectations/parser/parser/statement/definition_fail.leo.out index 080bf09d84..cdaf512fdd 100644 --- a/tests/expectations/parser/parser/statement/definition_fail.leo.out +++ b/tests/expectations/parser/parser/statement/definition_fail.leo.out @@ -3,24 +3,24 @@ namespace: ParseStatement expectation: Fail outputs: - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = expr;\n | ^^^^^^^" - - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = ();\n | ^^^^^^^" + - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = ();\n | ^^^^^^^\nError [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:13\n |\n 1 | let mut x = ();\n | ^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = x+y;\n | ^^^^^^^" - - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = (x,y);\n | ^^^^^^^" + - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = (x,y);\n | ^^^^^^^\nError [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:13\n |\n 1 | let mut x = (x,y);\n | ^^^^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = x();\n | ^^^^^^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = expr;\n | ^^^^^^^^^" - - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = ();\n | ^^^^^^^^^" + - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = ();\n | ^^^^^^^^^\nError [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:15\n |\n 1 | const mut x = ();\n | ^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = x+y;\n | ^^^^^^^^^" - - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = (x,y);\n | ^^^^^^^^^" + - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = (x,y);\n | ^^^^^^^^^\nError [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:15\n |\n 1 | const mut x = (x,y);\n | ^^^^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = x();\n | ^^^^^^^^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = expr;\n | ^^^^^^^" - - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = ();\n | ^^^^^^^" + - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = ();\n | ^^^^^^^\nError [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:18\n |\n 1 | let mut x: u32 = ();\n | ^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = x+y;\n | ^^^^^^^" - - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = (x,y);\n | ^^^^^^^" + - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = (x,y);\n | ^^^^^^^\nError [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:18\n |\n 1 | let mut x: u32 = (x,y);\n | ^^^^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = x();\n | ^^^^^^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = expr;\n | ^^^^^^^^^" - - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = ();\n | ^^^^^^^^^" + - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = ();\n | ^^^^^^^^^\nError [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:20\n |\n 1 | const mut x: u32 = ();\n | ^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = x+y;\n | ^^^^^^^^^" - - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = (x,y);\n | ^^^^^^^^^" + - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = (x,y);\n | ^^^^^^^^^\nError [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:20\n |\n 1 | const mut x: u32 = (x,y);\n | ^^^^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = x();\n | ^^^^^^^^^" - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:10\n |\n 1 | let (x,y,,) = ();\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:6\n |\n 1 | let (,x,y) = ();\n | ^" diff --git a/tests/expectations/parser/parser/statement/expression.leo.out b/tests/expectations/parser/parser/statement/expression.leo.out index d03278d686..06cbb5ad23 100644 --- a/tests/expectations/parser/parser/statement/expression.leo.out +++ b/tests/expectations/parser/parser/statement/expression.leo.out @@ -12,24 +12,6 @@ outputs: col_stop: 5 path: "" content: expr; - - Expression: - expression: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 3 - path: "" - content: (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 3 - path: "" - content: (); - Expression: expression: Binary: @@ -52,26 +34,6 @@ outputs: col_stop: 4 path: "" content: x+y; - - Expression: - expression: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"(x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"(x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: "(x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: "(x,y);" - Expression: expression: Call: diff --git a/tests/expectations/parser/parser/statement/iteration.leo.out b/tests/expectations/parser/parser/statement/iteration.leo.out index 05513bd21e..c4e876a74e 100644 --- a/tests/expectations/parser/parser/statement/iteration.leo.out +++ b/tests/expectations/parser/parser/statement/iteration.leo.out @@ -72,22 +72,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 2 - line_stop: 2 - col_start: 8 - col_stop: 10 - path: "" - content: return (); + Value: + Implicit: + - "0" + - span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 9 + path: "" + content: return 0; span: line_start: 2 line_stop: 2 col_start: 1 - col_stop: 10 + col_stop: 9 path: "" - content: return (); + content: return 0; span: line_start: 1 line_stop: 3 @@ -132,22 +133,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 2 - line_stop: 2 - col_start: 8 - col_stop: 10 - path: "" - content: return (); + Value: + Implicit: + - "0" + - span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 9 + path: "" + content: return 0; span: line_start: 2 line_stop: 2 col_start: 1 - col_stop: 10 + col_stop: 9 path: "" - content: return (); + content: return 0; span: line_start: 1 line_stop: 3 @@ -182,22 +184,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 2 - line_stop: 2 - col_start: 8 - col_stop: 10 - path: "" - content: return (); + Value: + Implicit: + - "0" + - span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 9 + path: "" + content: return 0; span: line_start: 2 line_stop: 2 col_start: 1 - col_stop: 10 + col_stop: 9 path: "" - content: return (); + content: return 0; span: line_start: 1 line_stop: 3 diff --git a/tests/expectations/parser/parser/statement/return.leo.out b/tests/expectations/parser/parser/statement/return.leo.out index 2994e613bc..ed1fb34ada 100644 --- a/tests/expectations/parser/parser/statement/return.leo.out +++ b/tests/expectations/parser/parser/statement/return.leo.out @@ -12,84 +12,6 @@ outputs: col_stop: 12 path: "" content: return expr; - - Return: - expression: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 10 - path: "" - content: return (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: return (); - - Return: - expression: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 10 - path: "" - content: return (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: return (); - - Return: - expression: - Binary: - left: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"return x+y;\\\"}\"}" - right: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"return x+y;\\\"}\"}" - op: Add - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 11 - path: "" - content: return x+y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: return x+y; - - Return: - expression: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"return (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"return (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 13 - path: "" - content: "return (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "return (x,y);" - Return: expression: Value: diff --git a/tests/expectations/parser/parser/unreachable/eat_int.leo.out b/tests/expectations/parser/parser/unreachable/eat_int.leo.out index e3393e9411..881cd8dfbe 100644 --- a/tests/expectations/parser/parser/unreachable/eat_int.leo.out +++ b/tests/expectations/parser/parser/unreachable/eat_int.leo.out @@ -3,54 +3,54 @@ namespace: ParseStatement expectation: Fail outputs: - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '-'\n --> test:1:3\n |\n 1 | x.-12\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_;\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_.\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_import\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_,\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_*\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_+\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_-\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_/\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_[\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_]\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_{\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_}\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_(\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_)\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_:\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_::\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_?\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0__\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_=\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_==\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_!\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_!=\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_>\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_>=\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_<\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_<=\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_>\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_..\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_as\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_console\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_const\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_let\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_for\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_if\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_else\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_i8\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_i16\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_i32\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_i64\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_i128\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_u8\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_u16\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_u32\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_u64\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_u128\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_;\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_.\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_import\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_,\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_*\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_+\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_-\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_/\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_[\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_{\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_}\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_(\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_)\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_:\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_::\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_?\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0__\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_=\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_==\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_!\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_!=\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_>\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_>=\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_<\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_<=\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_>\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_..\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_as\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_console\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_const\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_let\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_for\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_if\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_else\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_i8\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_i16\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_i32\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_i64\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_i128\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_u8\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_u16\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_u32\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_u64\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_u128\n | ^" - "Error [EPAR0370023]: Expected more characters to lex but found none." - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_return\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_self\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_Self\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_true\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_false\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_return\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_self\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_Self\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_true\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_false\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out b/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out index 0c0509b4cd..324d10b3e1 100644 --- a/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out +++ b/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out @@ -728,48 +728,6 @@ outputs: col_stop: 10 path: "" content: xreturn=b; - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"xself\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"xself=b;\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: xself=b; - value: - Identifier: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"xself=b;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: xself=b; - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"xSelf\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"xSelf=b;\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: xSelf=b; - value: - Identifier: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"xSelf=b;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: xSelf=b; - Assign: operation: Assign assignee: diff --git a/tests/parser/expression/access/call.leo b/tests/parser/expression/access/call.leo index d0d1694350..28d1d9e2ae 100644 --- a/tests/parser/expression/access/call.leo +++ b/tests/parser/expression/access/call.leo @@ -8,4 +8,3 @@ X() x(y) x(y, z) x(x, y, z) -x.0(x) diff --git a/tests/parser/expression/access/tuple.leo b/tests/parser/expression/access/tuple.leo deleted file mode 100644 index c96e38953f..0000000000 --- a/tests/parser/expression/access/tuple.leo +++ /dev/null @@ -1,11 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -x.0 -x.1 -x.2 -x.0.0 -x.1.1 -x.2.2 \ No newline at end of file diff --git a/tests/parser/expression/tuple.leo b/tests/parser/expression/tuple.leo deleted file mode 100644 index abfcab0999..0000000000 --- a/tests/parser/expression/tuple.leo +++ /dev/null @@ -1,19 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -//not tuples -(x) -(y) -(z) - -//tuples -(x,) -(x,y) -(x,y,z) -(123,123) - -() - -(()) \ No newline at end of file diff --git a/tests/parser/functions/const_function.leo b/tests/parser/functions/const_function.leo index fd8703b9fc..d65dc46c1a 100644 --- a/tests/parser/functions/const_function.leo +++ b/tests/parser/functions/const_function.leo @@ -4,5 +4,5 @@ expectation: Pass */ const function x() { - return (); + return 0; } diff --git a/tests/parser/functions/const_param.leo b/tests/parser/functions/const_param.leo index 3fbe5dfdba..a69f08e3d7 100644 --- a/tests/parser/functions/const_param.leo +++ b/tests/parser/functions/const_param.leo @@ -4,9 +4,9 @@ expectation: Pass */ function x(x: u32, const y: i32) { - return (); + return 0; } function x(const x: u32, y: i32) { - return (); + return 0; } \ No newline at end of file diff --git a/tests/parser/functions/empty.leo b/tests/parser/functions/empty.leo deleted file mode 100644 index 0c463ae036..0000000000 --- a/tests/parser/functions/empty.leo +++ /dev/null @@ -1,8 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -function x() { - return (); -} \ No newline at end of file diff --git a/tests/parser/functions/param_tuple.leo b/tests/parser/functions/param_tuple.leo deleted file mode 100644 index 80d9c202f9..0000000000 --- a/tests/parser/functions/param_tuple.leo +++ /dev/null @@ -1,8 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -function x(x: (u32, i32)) { - return (); -} \ No newline at end of file diff --git a/tests/parser/functions/params.leo b/tests/parser/functions/params.leo index e42363568c..9392a2784b 100644 --- a/tests/parser/functions/params.leo +++ b/tests/parser/functions/params.leo @@ -4,5 +4,5 @@ expectation: Pass */ function x(x: u32, y: i32) { - return (); + return 0; } \ No newline at end of file diff --git a/tests/parser/functions/params_return.leo b/tests/parser/functions/params_return.leo index d1f2b434fd..ed61c09ad3 100644 --- a/tests/parser/functions/params_return.leo +++ b/tests/parser/functions/params_return.leo @@ -4,5 +4,5 @@ expectation: Pass */ function x(x: u32, y: i32) -> u32 { - return (); + return 0; } \ No newline at end of file diff --git a/tests/parser/functions/return.leo b/tests/parser/functions/return.leo index ccf8dee32b..1a78e8d5ef 100644 --- a/tests/parser/functions/return.leo +++ b/tests/parser/functions/return.leo @@ -4,5 +4,5 @@ expectation: Pass */ function x() -> u32 { - return (); + return 0; } \ No newline at end of file diff --git a/tests/parser/functions/return_tuple.leo b/tests/parser/functions/return_tuple.leo deleted file mode 100644 index 618ddec00d..0000000000 --- a/tests/parser/functions/return_tuple.leo +++ /dev/null @@ -1,8 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -function x() -> (u32, u32) { - return (); -} \ No newline at end of file diff --git a/tests/parser/inputs/input_success.leo b/tests/parser/inputs/input_success.leo index 81e778f200..ed24602a59 100644 --- a/tests/parser/inputs/input_success.leo +++ b/tests/parser/inputs/input_success.leo @@ -9,7 +9,6 @@ b: u8 = 2; c: field = 0; d: group = (0, 1)group; e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; -h: (bool, bool) = (true, false); [registers] r0: bool = true; @@ -17,7 +16,6 @@ r1: u8 = 2; r2: field = 0; r3: group = (0, 1)group; r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; -r7: (bool, bool) = (true, false); [constants] c0: bool = true; @@ -25,4 +23,3 @@ c1: u8 = 2; c2: field = 0; c3: group = (0, 1)group; c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; -c7: (bool, bool) = (true, false); diff --git a/tests/parser/statement/assign.leo b/tests/parser/statement/assign.leo index 583c3dcbd6..6d368cc6fd 100644 --- a/tests/parser/statement/assign.leo +++ b/tests/parser/statement/assign.leo @@ -5,59 +5,34 @@ expectation: Pass x = expr; -x = (); - x = x+y; -x = (x,y); - x = x(); x += expr; -x += (); - x += x+y; x += x(); x -= expr; -x -= (); - x -= x+y; x -= x(); x *= expr; -x *= (); - x *= x+y; x *= x(); -x.0 *= y; - - x /= expr; -x /= (); - x /= x+y; x /= x(); -x.0 /= y; - x **= expr; -x **= (); - x **= x+y; - -x **= x(); - - - -x.0 **= y; diff --git a/tests/parser/statement/block.leo b/tests/parser/statement/block.leo index 307cc6928d..199b47cbc4 100644 --- a/tests/parser/statement/block.leo +++ b/tests/parser/statement/block.leo @@ -6,20 +6,20 @@ expectation: Pass {} { - return (); + return 0; } {{}} { { - return (); + return 0; } } { if x { - return (); + return 0; } } diff --git a/tests/parser/statement/conditional.leo b/tests/parser/statement/conditional.leo index 62a9e7f54e..6740174fbd 100644 --- a/tests/parser/statement/conditional.leo +++ b/tests/parser/statement/conditional.leo @@ -4,15 +4,11 @@ expectation: Pass */ if x { - return (); -} - -if Self { - return (); + return 0; } if (x) { - return (); + return 0; } if (x) {} else {} @@ -21,5 +17,5 @@ if x+y {} else if x+z {} else {} if x+y { expr; - return (); + return 0; } \ No newline at end of file diff --git a/tests/parser/statement/definition.leo b/tests/parser/statement/definition.leo index 841bd438ed..598cec9594 100644 --- a/tests/parser/statement/definition.leo +++ b/tests/parser/statement/definition.leo @@ -5,45 +5,29 @@ expectation: Pass let x = expr; -let x = (); - let x = x+y; -let x = (x,y); - let x = x(); const x = expr; -const x = (); - const x = x+y; -const x = (x,y); - const x = x(); let x: u32 = expr; -let x: u32 = (); - let x: u32 = x+y; -let x: u32 = (x,y); - let x: u32 = x(); const x: u32 = expr; -const x: u32 = (); - const x: u32 = x+y; -const x: u32 = (x,y); - const x: u32 = x(); @@ -53,48 +37,29 @@ const x: u32 = x(); let (x, y) = expr; -let (x, y) = (); - let (x, y) = x+y; -let (x, y) = (x,y); - let (x, y) = x(); const (x, y) = expr; -const (x, y) = (); - const (x, y) = x+y; -const (x, y) = (x,y); - const (x, y) = x(); let (x, y): u32 = expr; -let (x, y): u32 = (); - let (x, y): u32 = x+y; -let (x, y): u32 = (x,y); - let (x, y): u32 = x(); const (x, y): u32 = expr; -const (x, y): u32 = (); - const (x, y): u32 = x+y; -const (x, y): u32 = (x,y); - const (x, y): u32 = x(); - -let (x,y,) = (); - let x: address = aleo15u4r0gzjtqzepkgurgn7p3u5kkhs9p74rx6aun3uh2s5std6759svgmg53; diff --git a/tests/parser/statement/expression.leo b/tests/parser/statement/expression.leo index cc63041b00..1a5b3b1fe1 100644 --- a/tests/parser/statement/expression.leo +++ b/tests/parser/statement/expression.leo @@ -5,10 +5,6 @@ expectation: Pass expr; -(); - x+y; -(x,y); - x(); \ No newline at end of file diff --git a/tests/parser/statement/iteration.leo b/tests/parser/statement/iteration.leo index 79850fa6b9..506110850c 100644 --- a/tests/parser/statement/iteration.leo +++ b/tests/parser/statement/iteration.leo @@ -6,13 +6,13 @@ expectation: Pass for x in 0..7 {} for x in 0..7 { - return (); + return 0; } for x in 0..99u8 { - return (); + return 0; } for x in 0..Self { - return (); + return 0; } \ No newline at end of file diff --git a/tests/parser/statement/return.leo b/tests/parser/statement/return.leo index e3e835c5df..9451b67f16 100644 --- a/tests/parser/statement/return.leo +++ b/tests/parser/statement/return.leo @@ -5,13 +5,5 @@ expectation: Pass return expr; -return (); - -return (); - -return x+y; - -return (x,y); - return 5; \ No newline at end of file diff --git a/tests/parser/unreachable/math_op_pass.leo b/tests/parser/unreachable/math_op_pass.leo index cec1cc0064..48e55ffb5b 100644 --- a/tests/parser/unreachable/math_op_pass.leo +++ b/tests/parser/unreachable/math_op_pass.leo @@ -64,10 +64,6 @@ xu128=b; xreturn=b; -xself=b; - -xSelf=b; - xtrue=b; xfalse=b;