You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: account for Solc inexplicably not formatting the message (#85)
Apparently it's not just old solc versions, some errors just are not
formatted on the latest versions too.
Edit: if the file name does not end in .sol, the source locations are
not formatted. Lol
let error = r#"{"component":"general","errorCode":"6553","formattedMessage":"SyntaxError: The msize instruction cannot be used when the Yul optimizer is activated because it can change its semantics. Either disable the Yul optimizer or do not use the instruction.\n\n","message":"The msize instruction cannot be used when the Yul optimizer is activated because it can change its semantics. Either disable the Yul optimizer or do not use the instruction.","severity":"error","sourceLocation":{"end":173,"file":"","start":114},"type":"SyntaxError"}"#;
407
+
let error = serde_json::from_str::<Error>(error).unwrap();
408
+
let s = error.to_string();
409
+
eprintln!("{s}");
410
+
assert!(s.contains("Error (6553)"),"\n{s}");
411
+
assert!(s.contains("The msize instruction cannot be used"),"\n{s}");
412
+
}
413
+
414
+
#[test]
415
+
fnsolc_not_formatting_the_message2(){
416
+
let error = r#"{"component":"general","errorCode":"5667","formattedMessage":"Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.\n\n","message":"Unused function parameter. Remove or comment out the variable name to silence this warning.","severity":"warning","sourceLocation":{"end":104,"file":"","start":95},"type":"Warning"}"#;
417
+
let error = serde_json::from_str::<Error>(error).unwrap();
418
+
let s = error.to_string();
419
+
eprintln!("{s}");
420
+
assert!(s.contains("Warning (5667)"),"\n{s}");
421
+
assert!(s.contains("Unused function parameter. Remove or comment out the variable name to silence this warning."),"\n{s}");
0 commit comments