Pārlūkot izejas kodu

Do not panic if the value of a constant cannot be evaluated (#1281)

If a constant value makes no sense, then using that constant should
not result in any error (previously this paniced).

Signed-off-by: Sean Young <sean@mess.org>
Sean Young 2 gadi atpakaļ
vecāks
revīzija
4934459138

+ 6 - 6
solang-parser/src/tests.rs

@@ -47,13 +47,13 @@ contract 9c {
                 Diagnostic { loc: File(0, 48, 49), level: Error, ty: ParserError, message: r#"unrecognised token ';', expected string"#.to_string(), notes: vec![] },
                 Diagnostic { loc: File(0, 62, 65), level: Error, ty: ParserError, message: r#"unrecognised token 'for', expected "(", ";", "=""#.to_string(), notes: vec![] },
                 Diagnostic { loc: File(0, 78, 79), level: Error, ty: ParserError, message: r#"unrecognised token '9', expected "case", "default", "leave", "revert", "switch", identifier"#.to_string(), notes: vec![] },
-                Diagnostic { loc: File(0, 95, 96), level: Error, ty: ParserError, message: "unrecognised token '0', expected \"!=\", \"%\", \"%=\", \"&\", \"&&\", \"&=\", \"(\", \")\", \"*\", \"**\", \"*=\", \"+\", \"++\", \"+=\", \",\", \"-\", \"--\", \"-=\", \".\", \"/\", \"/=\", \":\", \";\", \"<\", \"<<\", \"<<=\", \"<=\", \"=\", \"==\", \"=>\", \">\", \">=\", \">>\", \">>=\", \"?\", \"[\", \"]\", \"^\", \"^=\", \"calldata\", \"case\", \"constant\", \"default\", \"external\", \"immutable\", \"indexed\", \"internal\", \"leave\", \"memory\", \"override\", \"private\", \"public\", \"revert\", \"storage\", \"switch\", \"{\", \"|\", \"|=\", \"||\", \"}\", identifier".to_string(), notes: vec![] },
-                Diagnostic { loc: File(0, 116, 123), level: Error, ty: ParserError, message: "unrecognised token 'uint256', expected \"!=\", \"%\", \"%=\", \"&\", \"&&\", \"&=\", \")\", \"*\", \"**\", \"*=\", \"+\", \"++\", \"+=\", \",\", \"-\", \"--\", \"-=\", \".\", \"/\", \"/=\", \":\", \";\", \"<\", \"<<\", \"<<=\", \"<=\", \"=\", \"==\", \">\", \">=\", \">>\", \">>=\", \"?\", \"[\", \"]\", \"^\", \"^=\", \"case\", \"default\", \"leave\", \"switch\", \"|\", \"|=\", \"||\", \"}\", identifier".to_string(), notes: vec![] },
-                Diagnostic { loc: File(0, 403, 404), level: Error, ty: ParserError, message: "unrecognised token '3', expected \"!=\", \"%\", \"%=\", \"&\", \"&&\", \"&=\", \"(\", \")\", \"*\", \"**\", \"*=\", \"+\", \"++\", \"+=\", \",\", \"-\", \"--\", \"-=\", \".\", \"/\", \"/=\", \":\", \";\", \"<\", \"<<\", \"<<=\", \"<=\", \"=\", \"==\", \"=>\", \">\", \">=\", \">>\", \">>=\", \"?\", \"[\", \"]\", \"^\", \"^=\", \"calldata\", \"case\", \"constant\", \"default\", \"external\", \"immutable\", \"indexed\", \"internal\", \"leave\", \"memory\", \"override\", \"private\", \"public\", \"revert\", \"storage\", \"switch\", \"{\", \"|\", \"|=\", \"||\", \"}\", identifier".to_string(), notes: vec![] },
+                Diagnostic { loc: File(0, 95, 96), level: Error, ty: ParserError, message: "unrecognised token '0', expected \"(\", \"++\", \"--\", \".\", \"[\", \"case\", \"constant\", \"default\", \"external\", \"immutable\", \"internal\", \"leave\", \"override\", \"private\", \"public\", \"revert\", \"switch\", \"{\", identifier".to_string(), notes: vec![] },
+                Diagnostic { loc: File(0, 116, 123), level: Error, ty: ParserError, message: "unrecognised token 'uint256', expected \"++\", \"--\", \".\", \"[\", \"case\", \"default\", \"leave\", \"switch\", identifier".to_string(), notes: vec![] },
+                Diagnostic { loc: File(0, 403, 404), level: Error, ty: ParserError, message: "unrecognised token '3', expected \"(\", \"++\", \"--\", \".\", \"[\", \"case\", \"constant\", \"default\", \"external\", \"immutable\", \"internal\", \"leave\", \"override\", \"private\", \"public\", \"revert\", \"switch\", \"{\", identifier".to_string(), notes: vec![] },
                 Diagnostic { loc: File(0, 441, 442), level: Error, ty: ParserError, message: r#"unrecognised token '4', expected "(", "case", "default", "leave", "revert", "switch", identifier"#.to_string(), notes: vec![] },
-                Diagnostic { loc: File(0, 460, 461), level: Error, ty: ParserError, message: "unrecognised token '!', expected \"!=\", \"%\", \"%=\", \"&\", \"&&\", \"&=\", \")\", \"*\", \"**\", \"*=\", \"+\", \"++\", \"+=\", \",\", \"-\", \"--\", \"-=\", \".\", \"/\", \"/=\", \":\", \";\", \"<\", \"<<\", \"<<=\", \"<=\", \"=\", \"==\", \"=>\", \">\", \">=\", \">>\", \">>=\", \"?\", \"[\", \"]\", \"^\", \"^=\", \"calldata\", \"case\", \"constant\", \"default\", \"external\", \"immutable\", \"indexed\", \"internal\", \"leave\", \"memory\", \"override\", \"payable\", \"private\", \"public\", \"pure\", \"return\", \"returns\", \"revert\", \"storage\", \"switch\", \"view\", \"virtual\", \"{\", \"|\", \"|=\", \"||\", \"}\", identifier".to_string(), notes: vec![] },
-                Diagnostic { loc: File(0, 482, 483), level: Error, ty: ParserError, message: "unrecognised token '3', expected \"!=\", \"%\", \"%=\", \"&\", \"&&\", \"&=\", \"(\", \")\", \"*\", \"**\", \"*=\", \"+\", \"++\", \"+=\", \",\", \"-\", \"--\", \"-=\", \".\", \"/\", \"/=\", \":\", \";\", \"<\", \"<<\", \"<<=\", \"<=\", \"=\", \"==\", \"=>\", \">\", \">=\", \">>\", \">>=\", \"?\", \"[\", \"]\", \"^\", \"^=\", \"calldata\", \"case\", \"constant\", \"default\", \"external\", \"immutable\", \"indexed\", \"internal\", \"leave\", \"memory\", \"override\", \"private\", \"public\", \"revert\", \"storage\", \"switch\", \"{\", \"|\", \"|=\", \"||\", \"}\", identifier".to_string(), notes: vec![] },
-                Diagnostic { loc: File(0, 518, 522), level: Error, ty: ParserError, message: "unrecognised token 'uint256', expected \"!=\", \"%\", \"%=\", \"&\", \"&&\", \"&=\", \")\", \"*\", \"**\", \"*=\", \"+\", \"++\", \"+=\", \",\", \"-\", \"--\", \"-=\", \".\", \"/\", \"/=\", \":\", \";\", \"<\", \"<<\", \"<<=\", \"<=\", \"=\", \"==\", \">\", \">=\", \">>\", \">>=\", \"?\", \"[\", \"]\", \"^\", \"^=\", \"case\", \"default\", \"leave\", \"switch\", \"|\", \"|=\", \"||\", \"}\", identifier".to_string(), notes: vec![] },
+                Diagnostic { loc: File(0, 460, 461), level: Error, ty: ParserError, message: "unrecognised token '!', expected \";\", \"case\", \"constant\", \"default\", \"external\", \"immutable\", \"internal\", \"leave\", \"override\", \"payable\", \"private\", \"public\", \"pure\", \"return\", \"returns\", \"revert\", \"switch\", \"view\", \"virtual\", \"{\", identifier".to_string(), notes: vec![] },
+                Diagnostic { loc: File(0, 482, 483), level: Error, ty: ParserError, message: "unrecognised token '3', expected \"!=\", \"%\", \"%=\", \"&\", \"&&\", \"&=\", \"(\", \"*\", \"**\", \"*=\", \"+\", \"++\", \"+=\", \"-\", \"--\", \"-=\", \".\", \"/\", \"/=\", \";\", \"<\", \"<<\", \"<<=\", \"<=\", \"=\", \"==\", \">\", \">=\", \">>\", \">>=\", \"?\", \"[\", \"^\", \"^=\", \"calldata\", \"case\", \"default\", \"leave\", \"memory\", \"revert\", \"storage\", \"switch\", \"{\", \"|\", \"|=\", \"||\", identifier".to_string(), notes: vec![] },
+                Diagnostic { loc: File(0, 518, 522), level: Error, ty: ParserError, message: "unrecognised token 'uint256', expected \"!=\", \"%\", \"%=\", \"&\", \"&&\", \"&=\", \"*\", \"**\", \"*=\", \"+\", \"++\", \"+=\", \"-\", \"--\", \"-=\", \".\", \"/\", \"/=\", \";\", \"<\", \"<<\", \"<<=\", \"<=\", \"=\", \"==\", \">\", \">=\", \">>\", \">>=\", \"?\", \"[\", \"^\", \"^=\", \"case\", \"default\", \"leave\", \"switch\", \"|\", \"|=\", \"||\", identifier".to_string(), notes: vec![] },
                 Diagnostic { loc: File(0, 555, 556), level: Error, ty: ParserError, message: "unrecognised token '}', expected \"!\", \"(\", \"+\", \"++\", \"-\", \"--\", \"[\", \"address\", \"assembly\", \"bool\", \"break\", \"byte\", \"bytes\", \"case\", \"continue\", \"default\", \"delete\", \"do\", \"emit\", \"false\", \"for\", \"function\", \"if\", \"leave\", \"mapping\", \"new\", \"payable\", \"return\", \"revert\", \"string\", \"switch\", \"this\", \"true\", \"try\", \"type\", \"unchecked\", \"while\", \"{\", \"~\", Bytes, Int, Uint, address, hexnumber, hexstring, identifier, number, rational, string".to_string(), notes: vec![] },
                 Diagnostic { loc: File(0, 557, 558), level: Error, ty: ParserError, message: "unrecognised token '}', expected \"(\", \";\", \"@\", \"[\", \"abstract\", \"address\", \"bool\", \"byte\", \"bytes\", \"case\", \"contract\", \"default\", \"enum\", \"event\", \"false\", \"function\", \"import\", \"interface\", \"leave\", \"library\", \"mapping\", \"payable\", \"pragma\", \"string\", \"struct\", \"switch\", \"this\", \"true\", \"type\", \"using\", Bytes, Int, Uint, address, hexnumber, hexstring, identifier, number, rational, string".to_string(), notes: vec![] }
             ]

+ 2 - 1
src/codegen/expression.rs

@@ -705,7 +705,8 @@ pub fn expression(
             expr: Box::new(expression(expr, cfg, contract_no, func, ns, vartab, opt)),
         },
         ast::Expression::Cast { loc, to, expr } if matches!(to, Type::Address(_)) => {
-            if let Ok((_, address)) = eval_const_number(expr, ns) {
+            let mut diagnostics = Diagnostics::default();
+            if let Ok((_, address)) = eval_const_number(expr, ns, &mut diagnostics) {
                 Expression::NumberLiteral {
                     loc: *loc,
                     ty: to.clone(),

+ 1 - 1
src/sema/builtin.rs

@@ -958,7 +958,7 @@ pub(super) fn resolve_call(
         } else {
             // tx.gasprice(1) is a bad idea, just like tx.gasprice. Warn about this
             if ns.target.is_substrate() && func.builtin == Builtin::Gasprice {
-                if let Ok((_, val)) = eval_const_number(&cast_args[0], ns) {
+                if let Ok((_, val)) = eval_const_number(&cast_args[0], ns, diagnostics) {
                     if val == BigInt::one() {
                         diagnostics.push(Diagnostic::warning(
                             *loc,

+ 83 - 49
src/sema/eval.rs

@@ -1,6 +1,9 @@
 // SPDX-License-Identifier: Apache-2.0
 
-use super::ast::{Diagnostic, Expression, Namespace, Type};
+use super::{
+    ast::{Diagnostic, Expression, Namespace, Type},
+    diagnostics::Diagnostics,
+};
 use num_bigint::BigInt;
 use num_bigint::Sign;
 use num_rational::BigRational;
@@ -15,75 +18,88 @@ use std::ops::{Add, BitAnd, BitOr, BitXor, Div, Mul, Shl, Shr, Sub};
 pub fn eval_const_number(
     expr: &Expression,
     ns: &Namespace,
-) -> Result<(pt::Loc, BigInt), Diagnostic> {
+    diagnostics: &mut Diagnostics,
+) -> Result<(pt::Loc, BigInt), ()> {
     match expr {
         Expression::Add {
             loc, left, right, ..
         } => Ok((
             *loc,
-            eval_const_number(left, ns)?.1 + eval_const_number(right, ns)?.1,
+            eval_const_number(left, ns, diagnostics)?.1
+                + eval_const_number(right, ns, diagnostics)?.1,
         )),
         Expression::Subtract {
             loc, left, right, ..
         } => Ok((
             *loc,
-            eval_const_number(left, ns)?.1 - eval_const_number(right, ns)?.1,
+            eval_const_number(left, ns, diagnostics)?.1
+                - eval_const_number(right, ns, diagnostics)?.1,
         )),
         Expression::Multiply {
             loc, left, right, ..
         } => Ok((
             *loc,
-            eval_const_number(left, ns)?.1 * eval_const_number(right, ns)?.1,
+            eval_const_number(left, ns, diagnostics)?.1
+                * eval_const_number(right, ns, diagnostics)?.1,
         )),
         Expression::Divide {
             loc, left, right, ..
         } => {
-            let divisor = eval_const_number(right, ns)?.1;
+            let divisor = eval_const_number(right, ns, diagnostics)?.1;
 
             if divisor.is_zero() {
-                Err(Diagnostic::error(*loc, "divide by zero".to_string()))
+                diagnostics.push(Diagnostic::error(*loc, "divide by zero".to_string()));
+
+                Err(())
             } else {
-                Ok((*loc, eval_const_number(left, ns)?.1 / divisor))
+                Ok((*loc, eval_const_number(left, ns, diagnostics)?.1 / divisor))
             }
         }
         Expression::Modulo {
             loc, left, right, ..
         } => {
-            let divisor = eval_const_number(right, ns)?.1;
+            let divisor = eval_const_number(right, ns, diagnostics)?.1;
 
             if divisor.is_zero() {
-                Err(Diagnostic::error(*loc, "divide by zero".to_string()))
+                diagnostics.push(Diagnostic::error(*loc, "divide by zero".to_string()));
+
+                Err(())
             } else {
-                Ok((*loc, eval_const_number(left, ns)?.1 % divisor))
+                Ok((*loc, eval_const_number(left, ns, diagnostics)?.1 % divisor))
             }
         }
         Expression::BitwiseAnd {
             loc, left, right, ..
         } => Ok((
             *loc,
-            eval_const_number(left, ns)?.1 & eval_const_number(right, ns)?.1,
+            eval_const_number(left, ns, diagnostics)?.1
+                & eval_const_number(right, ns, diagnostics)?.1,
         )),
         Expression::BitwiseOr {
             loc, left, right, ..
         } => Ok((
             *loc,
-            eval_const_number(left, ns)?.1 | eval_const_number(right, ns)?.1,
+            eval_const_number(left, ns, diagnostics)?.1
+                | eval_const_number(right, ns, diagnostics)?.1,
         )),
         Expression::BitwiseXor {
             loc, left, right, ..
         } => Ok((
             *loc,
-            eval_const_number(left, ns)?.1 ^ eval_const_number(right, ns)?.1,
+            eval_const_number(left, ns, diagnostics)?.1
+                ^ eval_const_number(right, ns, diagnostics)?.1,
         )),
         Expression::Power { loc, base, exp, .. } => {
-            let b = eval_const_number(base, ns)?.1;
-            let mut e = eval_const_number(exp, ns)?.1;
+            let b = eval_const_number(base, ns, diagnostics)?.1;
+            let mut e = eval_const_number(exp, ns, diagnostics)?.1;
 
             if e.sign() == Sign::Minus {
-                Err(Diagnostic::error(
-                    expr.loc(),
+                diagnostics.push(Diagnostic::error(
+                    *loc,
                     "power cannot take negative number as exponent".to_string(),
-                ))
+                ));
+
+                Err(())
             } else if e.sign() == Sign::NoSign {
                 Ok((*loc, BigInt::one()))
             } else {
@@ -99,15 +115,14 @@ pub fn eval_const_number(
         Expression::ShiftLeft {
             loc, left, right, ..
         } => {
-            let l = eval_const_number(left, ns)?.1;
-            let r = eval_const_number(right, ns)?.1;
+            let l = eval_const_number(left, ns, diagnostics)?.1;
+            let r = eval_const_number(right, ns, diagnostics)?.1;
             let r = match r.to_usize() {
                 Some(r) => r,
                 None => {
-                    return Err(Diagnostic::error(
-                        expr.loc(),
-                        format!("cannot left shift by {r}"),
-                    ));
+                    diagnostics.push(Diagnostic::error(*loc, format!("cannot left shift by {r}")));
+
+                    return Err(());
                 }
             };
             Ok((*loc, l << r))
@@ -115,52 +130,71 @@ pub fn eval_const_number(
         Expression::ShiftRight {
             loc, left, right, ..
         } => {
-            let l = eval_const_number(left, ns)?.1;
-            let r = eval_const_number(right, ns)?.1;
+            let l = eval_const_number(left, ns, diagnostics)?.1;
+            let r = eval_const_number(right, ns, diagnostics)?.1;
             let r = match r.to_usize() {
                 Some(r) => r,
                 None => {
-                    return Err(Diagnostic::error(
-                        expr.loc(),
-                        format!("cannot right shift by {r}"),
-                    ));
+                    diagnostics.push(Diagnostic::error(*loc, format!("right left shift by {r}")));
+
+                    return Err(());
                 }
             };
             Ok((*loc, l >> r))
         }
         Expression::NumberLiteral { loc, value, .. } => Ok((*loc, value.clone())),
-        Expression::ZeroExt { loc, expr, .. } => Ok((*loc, eval_const_number(expr, ns)?.1)),
-        Expression::SignExt { loc, expr, .. } => Ok((*loc, eval_const_number(expr, ns)?.1)),
-        Expression::Cast { loc, expr, .. } => Ok((*loc, eval_const_number(expr, ns)?.1)),
-        Expression::Not { loc, expr: n } => Ok((*loc, !eval_const_number(n, ns)?.1)),
-        Expression::BitwiseNot { loc, expr, .. } => Ok((*loc, !eval_const_number(expr, ns)?.1)),
-        Expression::Negate { loc, expr, .. } => Ok((*loc, -eval_const_number(expr, ns)?.1)),
+        Expression::ZeroExt { loc, expr, .. } => {
+            Ok((*loc, eval_const_number(expr, ns, diagnostics)?.1))
+        }
+        Expression::SignExt { loc, expr, .. } => {
+            Ok((*loc, eval_const_number(expr, ns, diagnostics)?.1))
+        }
+        Expression::Cast { loc, expr, .. } => {
+            Ok((*loc, eval_const_number(expr, ns, diagnostics)?.1))
+        }
+        Expression::Not { loc, expr: n } => Ok((*loc, !eval_const_number(n, ns, diagnostics)?.1)),
+        Expression::BitwiseNot { loc, expr, .. } => {
+            Ok((*loc, !eval_const_number(expr, ns, diagnostics)?.1))
+        }
+        Expression::Negate { loc, expr, .. } => {
+            Ok((*loc, -eval_const_number(expr, ns, diagnostics)?.1))
+        }
         Expression::ConstantVariable {
             contract_no: Some(contract_no),
             var_no,
             ..
         } => {
-            let expr = ns.contracts[*contract_no].variables[*var_no]
-                .initializer
-                .as_ref()
-                .unwrap()
-                .clone();
+            let var = &ns.contracts[*contract_no].variables[*var_no];
 
-            eval_const_number(&expr, ns)
+            if let Some(init) = &var.initializer {
+                eval_const_number(init, ns, diagnostics)
+            } else {
+                // we should have errored about this already
+                Err(())
+            }
         }
         Expression::ConstantVariable {
             contract_no: None,
             var_no,
             ..
         } => {
-            let expr = ns.constants[*var_no].initializer.as_ref().unwrap().clone();
+            let var = &ns.constants[*var_no];
 
-            eval_const_number(&expr, ns)
+            if let Some(init) = &var.initializer {
+                eval_const_number(init, ns, diagnostics)
+            } else {
+                // we should have errored about this already
+                Err(())
+            }
+        }
+        _ => {
+            diagnostics.push(Diagnostic::error(
+                expr.loc(),
+                "expression not allowed in constant number expression".to_string(),
+            ));
+
+            Err(())
         }
-        _ => Err(Diagnostic::error(
-            expr.loc(),
-            "expression not allowed in constant number expression".to_string(),
-        )),
     }
 }
 

+ 5 - 2
src/sema/expression/mod.rs

@@ -71,7 +71,8 @@ pub struct ExprContext {
 impl Expression {
     /// Is this expression 0
     pub(super) fn const_zero(&self, ns: &Namespace) -> bool {
-        if let Ok((_, value)) = eval_const_number(self, ns) {
+        let mut diagnostics = Diagnostics::default();
+        if let Ok((_, value)) = eval_const_number(self, ns, &mut diagnostics) {
             value == BigInt::zero()
         } else {
             false
@@ -393,7 +394,9 @@ impl Expression {
                 let enum_ty = &ns.enums[*enum_no];
 
                 // TODO would be help to have current contract to resolve contract constants
-                if let Ok((_, big_number)) = eval_const_number(self, ns) {
+                let mut temp_diagnostics = Diagnostics::default();
+
+                if let Ok((_, big_number)) = eval_const_number(self, ns, &mut temp_diagnostics) {
                     if let Some(number) = big_number.to_usize() {
                         if enum_ty.values.len() > number {
                             return Ok(Expression::NumberLiteral {

+ 2 - 7
src/sema/namespace.rs

@@ -1520,14 +1520,9 @@ impl Namespace {
             }
         }
 
-        match eval_const_number(&size_expr, self) {
-            Ok(n) => Ok(Some(n)),
-            Err(d) => {
-                diagnostics.push(d);
+        let n = eval_const_number(&size_expr, self, diagnostics)?;
 
-                Err(())
-            }
-        }
+        Ok(Some(n))
     }
 
     /// Generate the signature for the given name and parameters; can be used for events and functions.

+ 1 - 1
src/sema/yul/tests/expression.rs

@@ -1059,7 +1059,7 @@ contract testTypes {
 
     let ns = parse(file);
     assert!(ns.diagnostics.contains_message(
-        r#"unrecognised token ':=', expected ")", ",", "address", "bool", "break", "byte", "case", "continue", "default", "for", "function", "if", "leave", "let", "return", "revert", "switch", "{", "}", identifier"#
+        r#"unrecognised token ':=', expected "address", "bool", "break", "byte", "continue", "for", "function", "if", "leave", "let", "return", "revert", "switch", "{", "}", identifier"#
     ));
 
     let file = r#"

+ 12 - 0
tests/contract_testcases/evm/unresolved_constants.dot

@@ -0,0 +1,12 @@
+strict digraph "tests/contract_testcases/evm/unresolved_constants.sol" {
+	contract [label="contract c\ntests/contract_testcases/evm/unresolved_constants.sol:3:1-8:2"]
+	var [label="variable C2\nvisibility internal\nconstant\nint256\ntests/contract_testcases/evm/unresolved_constants.sol:4:2-24"]
+	diagnostic [label="'LEN1' not found\nlevel Error\ntests/contract_testcases/evm/unresolved_constants.sol:1:19-23"]
+	diagnostic_5 [label="found contract 'c'\nlevel Debug\ntests/contract_testcases/evm/unresolved_constants.sol:3:1-8:2"]
+	diagnostic_6 [label="'LEN1' not found\nlevel Error\ntests/contract_testcases/evm/unresolved_constants.sol:4:20-24"]
+	contracts -> contract
+	contract -> var [label="variable"]
+	diagnostics -> diagnostic [label="Error"]
+	diagnostics -> diagnostic_5 [label="Debug"]
+	diagnostics -> diagnostic_6 [label="Error"]
+}

+ 9 - 0
tests/contract_testcases/evm/unresolved_constants.sol

@@ -0,0 +1,9 @@
+int constant C1 = LEN1;
+
+contract c {
+	int constant C2 = LEN1;
+
+	bool[C1] var1;
+	bool[C2] var22;
+}
+

+ 1 - 1
tests/contract_testcases/substrate/events/emit.dot

@@ -1,4 +1,4 @@
 strict digraph "tests/contract_testcases/substrate/events/emit.sol" {
-	diagnostic [label="unrecognised token '(', expected \"!=\", \"%\", \"%=\", \"&\", \"&&\", \"&=\", \")\", \"*\", \"**\", \"*=\", \"+\", \"++\", \"+=\", \",\", \"-\", \"--\", \"-=\", \".\", \"/\", \"/=\", \":\", \";\", \"<\", \"<<\", \"<<=\", \"<=\", \"=\", \"==\", \">\", \">=\", \">>\", \">>=\", \"?\", \"[\", \"]\", \"^\", \"^=\", \"case\", \"default\", \"leave\", \"switch\", \"|\", \"|=\", \"||\", \"}\", identifier\nlevel Error\ntests/contract_testcases/substrate/events/emit.sol:4:24-25"]
+	diagnostic [label="unrecognised token '(', expected \"++\", \"--\", \".\", \"[\", \"case\", \"default\", \"leave\", \"switch\", identifier\nlevel Error\ntests/contract_testcases/substrate/events/emit.sol:4:24-25"]
 	diagnostics -> diagnostic [label="Error"]
 }

+ 1 - 1
tests/contract_testcases/substrate/primitives/units_02.dot

@@ -1,4 +1,4 @@
 strict digraph "tests/contract_testcases/substrate/primitives/units_02.sol" {
-	diagnostic [label="unrecognised token 'days', expected \"!=\", \"%\", \"%=\", \"&\", \"&&\", \"&=\", \")\", \"*\", \"**\", \"*=\", \"+\", \"++\", \"+=\", \",\", \"-\", \"--\", \"-=\", \".\", \"/\", \"/=\", \":\", \";\", \"<\", \"<<\", \"<<=\", \"<=\", \"=\", \"==\", \">\", \">=\", \">>\", \">>=\", \"?\", \"[\", \"]\", \"^\", \"^=\", \"|\", \"|=\", \"||\", \"}\"\nlevel Error\ntests/contract_testcases/substrate/primitives/units_02.sol:4:35-39"]
+	diagnostic [label="unrecognised token 'days', expected \"!=\", \"%\", \"%=\", \"&\", \"&&\", \"&=\", \"*\", \"**\", \"*=\", \"+\", \"++\", \"+=\", \"-\", \"--\", \"-=\", \".\", \"/\", \"/=\", \";\", \"<\", \"<<\", \"<<=\", \"<=\", \"=\", \"==\", \">\", \">=\", \">>\", \">>=\", \"?\", \"[\", \"^\", \"^=\", \"|\", \"|=\", \"||\"\nlevel Error\ntests/contract_testcases/substrate/primitives/units_02.sol:4:35-39"]
 	diagnostics -> diagnostic [label="Error"]
 }

+ 0 - 5
tests/evm.rs

@@ -198,11 +198,6 @@ fn ethereum_solidity_tests() {
                 && !file_name.ends_with("invalid_utf8_sequence.sol")
                 && !file_name.ends_with("basefee_berlin_function.sol")
                 && !file_name.ends_with("inline_assembly_embedded_function_call.sol")
-                && !file_name.ends_with("cannot_be_function_call.sol")
-                && !file_name.ends_with("complex_cyclic_constant.sol")
-                && !file_name.ends_with("cyclic_constant.sol")
-                && !file_name.ends_with("pure_functions.sol")
-                && !file_name.ends_with("pure_non_rational.sol")
                 && !file_name.ends_with("linkersymbol_function.sol")
                 && !file_name.ends_with("370_shift_constant_left_excessive_rvalue.sol")
                 && file_name.ends_with(".sol")