diff --git a/compiler/parser/src/parser/file.rs b/compiler/parser/src/parser/file.rs index a64e526b5e..f40976bc57 100644 --- a/compiler/parser/src/parser/file.rs +++ b/compiler/parser/src/parser/file.rs @@ -85,14 +85,9 @@ impl ParserContext<'_> { /// Returns a [`FunctionInput`] AST node if the next tokens represent a function parameter. pub fn parse_function_parameter(&mut self) -> Result { let mode = self.parse_function_parameter_mode()?; - let mutable = self.eat(&Token::Mut).then(|| self.prev_token.clone()); let name = self.expect_ident()?; - if let Some(mutable) = &mutable { - self.emit_err(ParserError::mut_function_input(mutable.span + name.span)); - } - self.expect(&Token::Colon)?; let type_ = self.parse_type()?.0; Ok(FunctionInput::Variable(FunctionInputVariable::new( diff --git a/compiler/parser/src/parser/statement.rs b/compiler/parser/src/parser/statement.rs index b464bf21e2..273587be2e 100644 --- a/compiler/parser/src/parser/statement.rs +++ b/compiler/parser/src/parser/statement.rs @@ -219,10 +219,7 @@ impl ParserContext<'_> { /// Returns a [`VariableName`] AST node if the next tokens represent a variable name with /// valid keywords. - pub fn parse_variable_name(&mut self, decl_ty: Declare, span: Span) -> Result { - if self.eat(&Token::Mut) { - self.emit_err(ParserError::let_mut_statement(self.prev_token.span + span)); - } + pub fn parse_variable_name(&mut self, decl_ty: Declare, _span: Span) -> Result { let name = self.expect_ident()?; Ok(VariableName { diff --git a/compiler/parser/src/tokenizer/lexer.rs b/compiler/parser/src/tokenizer/lexer.rs index da372b9636..12680db01d 100644 --- a/compiler/parser/src/tokenizer/lexer.rs +++ b/compiler/parser/src/tokenizer/lexer.rs @@ -422,11 +422,9 @@ impl Token { "in" => Token::In, "input" => Token::Input, "let" => Token::Let, - "mut" => Token::Mut, "public" => Token::Public, "return" => Token::Return, "true" => Token::True, - "type" => Token::Type, "u8" => Token::U8, "u16" => Token::U16, "u32" => Token::U32, diff --git a/compiler/parser/src/tokenizer/token.rs b/compiler/parser/src/tokenizer/token.rs index 5a0d58aff6..76d69b9811 100644 --- a/compiler/parser/src/tokenizer/token.rs +++ b/compiler/parser/src/tokenizer/token.rs @@ -124,11 +124,9 @@ pub enum Token { If, In, Let, - Mut, /// For public inputs. Public, Return, - Type, // Meta Tokens Eof, @@ -156,11 +154,9 @@ pub const KEYWORD_TOKENS: &[Token] = &[ Token::In, Token::Input, Token::Let, - Token::Mut, Token::Public, Token::Return, Token::True, - Token::Type, Token::U8, Token::U16, Token::U32, @@ -198,11 +194,9 @@ impl Token { Token::In => sym::In, Token::Input => sym::input, Token::Let => sym::Let, - Token::Mut => sym::Mut, Token::Public => sym::Public, Token::Return => sym::Return, Token::True => sym::True, - Token::Type => sym::Type, Token::U8 => sym::u8, Token::U16 => sym::u16, Token::U32 => sym::u32, @@ -291,10 +285,8 @@ impl fmt::Display for Token { If => write!(f, "if"), In => write!(f, "in"), Let => write!(f, "let"), - Mut => write!(f, "mut"), Public => write!(f, "public"), Return => write!(f, "return"), - Type => write!(f, "type"), Eof => write!(f, ""), } } diff --git a/tests/expectations/parser/parser/expression/token_format.leo.out b/tests/expectations/parser/parser/expression/token_format.leo.out index 9d66a72ae5..3d9b7f4902 100644 --- a/tests/expectations/parser/parser/expression/token_format.leo.out +++ b/tests/expectations/parser/parser/expression/token_format.leo.out @@ -70,7 +70,5 @@ outputs: - "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 [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 'type'\n --> test:1:1\n |\n 1 | type\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 index 5714154f71..3f657a07e7 100644 --- a/tests/expectations/parser/parser/functions/mut_input_fail.leo.out +++ b/tests/expectations/parser/parser/functions/mut_input_fail.leo.out @@ -2,4 +2,4 @@ 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 | ^^^^^\nError [EPAR0370005]: expected -> -- got '{'\n --> test:3:23\n |\n 3 | function f(mut a: u8) {}\n | ^" + - "Error [EPAR0370005]: expected : -- got 'a'\n --> test:3:16\n |\n 3 | function f(mut a: u8) {}\n | ^" diff --git a/tests/expectations/parser/parser/statement/definition_fail.leo.out b/tests/expectations/parser/parser/statement/definition_fail.leo.out index 48074c2ff5..3d5f898659 100644 --- a/tests/expectations/parser/parser/statement/definition_fail.leo.out +++ b/tests/expectations/parser/parser/statement/definition_fail.leo.out @@ -2,26 +2,26 @@ 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 | ^^^^^^^\nError [EPAR0370005]: expected : -- got '='\n --> test:1:11\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 | ^^^^^^^\nError [EPAR0370005]: expected : -- got '='\n --> test:1:11\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 | ^^^^^^^\nError [EPAR0370005]: expected : -- got '='\n --> test:1:11\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 : -- got '='\n --> test:1:11\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 | ^^^^^^^\nError [EPAR0370005]: expected : -- got '='\n --> test:1:11\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 | ^^^^^^^^^\nError [EPAR0370005]: expected : -- got '='\n --> test:1:13\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 | ^^^^^^^^^\nError [EPAR0370005]: expected : -- got '='\n --> test:1:13\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 | ^^^^^^^^^\nError [EPAR0370005]: expected : -- got '='\n --> test:1:13\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 : -- got '='\n --> test:1:13\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 | ^^^^^^^^^\nError [EPAR0370005]: expected : -- got '='\n --> test:1:13\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 | ^^^^^^^\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 | ^^^^^^^\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 | ^^^^^^^^^\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 | ^^^^^^^^^\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 [EPAR0370005]: expected : -- got 'x'\n --> test:1:9\n |\n 1 | let mut x = expr;\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:9\n |\n 1 | let mut x = ();\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:9\n |\n 1 | let mut x = x+y;\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:9\n |\n 1 | let mut x = (x,y);\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:9\n |\n 1 | let mut x = x();\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:11\n |\n 1 | const mut x = expr;\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:11\n |\n 1 | const mut x = ();\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:11\n |\n 1 | const mut x = x+y;\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:11\n |\n 1 | const mut x = (x,y);\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:11\n |\n 1 | const mut x = x();\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:9\n |\n 1 | let mut x: u32 = expr;\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:9\n |\n 1 | let mut x: u32 = ();\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:9\n |\n 1 | let mut x: u32 = x+y;\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:9\n |\n 1 | let mut x: u32 = (x,y);\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:9\n |\n 1 | let mut x: u32 = x();\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:11\n |\n 1 | const mut x: u32 = expr;\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:11\n |\n 1 | const mut x: u32 = ();\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:11\n |\n 1 | const mut x: u32 = x+y;\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:11\n |\n 1 | const mut x: u32 = (x,y);\n | ^" + - "Error [EPAR0370005]: expected : -- got 'x'\n --> test:1:11\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 | ^" - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:8\n |\n 1 | let (x,,y) = ();\n | ^" diff --git a/tests/parser/expression/token_format.leo b/tests/parser/expression/token_format.leo index c0c8bc4eef..a114ea9773 100644 --- a/tests/parser/expression/token_format.leo +++ b/tests/parser/expression/token_format.leo @@ -139,10 +139,6 @@ in let -mut - & return - -type