diff --git a/Cargo.lock b/Cargo.lock index 537e613e..872b8cfe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,21 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "addr2line" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "ahash" version = "0.8.11" @@ -71,49 +56,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" -[[package]] -name = "async-trait" -version = "0.1.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "auto_impl" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - [[package]] name = "autocfg" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" -[[package]] -name = "backtrace" -version = "0.3.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - [[package]] name = "bit-set" version = "0.5.3" @@ -178,16 +126,10 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" -[[package]] -name = "bytes" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" - [[package]] name = "cairo-lang-casm" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-utils", "indoc", @@ -199,8 +141,8 @@ dependencies = [ [[package]] name = "cairo-lang-compiler" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "anyhow", "cairo-lang-defs", @@ -216,23 +158,24 @@ dependencies = [ "cairo-lang-utils", "indoc", "rayon", - "salsa", + "rust-analyzer-salsa", + "semver", "smol_str", "thiserror", ] [[package]] name = "cairo-lang-debug" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-utils", ] [[package]] name = "cairo-lang-defs" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-debug", "cairo-lang-diagnostics", @@ -241,14 +184,14 @@ dependencies = [ "cairo-lang-syntax", "cairo-lang-utils", "itertools 0.12.1", - "salsa", + "rust-analyzer-salsa", "smol_str", ] [[package]] name = "cairo-lang-diagnostics" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-debug", "cairo-lang-filesystem", @@ -256,24 +199,10 @@ dependencies = [ "itertools 0.12.1", ] -[[package]] -name = "cairo-lang-doc" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" -dependencies = [ - "cairo-lang-defs", - "cairo-lang-formatter", - "cairo-lang-parser", - "cairo-lang-syntax", - "cairo-lang-utils", - "itertools 0.12.1", - "salsa", -] - [[package]] name = "cairo-lang-eq-solver" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-utils", "good_lp", @@ -281,21 +210,22 @@ dependencies = [ [[package]] name = "cairo-lang-filesystem" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-debug", "cairo-lang-utils", "path-clean", - "salsa", + "rust-analyzer-salsa", + "semver", "serde", "smol_str", ] [[package]] name = "cairo-lang-formatter" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "anyhow", "cairo-lang-diagnostics", @@ -306,51 +236,16 @@ dependencies = [ "diffy", "ignore", "itertools 0.12.1", - "salsa", + "rust-analyzer-salsa", "serde", "smol_str", "thiserror", ] -[[package]] -name = "cairo-lang-language-server" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" -dependencies = [ - "anyhow", - "cairo-lang-compiler", - "cairo-lang-defs", - "cairo-lang-diagnostics", - "cairo-lang-doc", - "cairo-lang-filesystem", - "cairo-lang-formatter", - "cairo-lang-lowering", - "cairo-lang-parser", - "cairo-lang-project", - "cairo-lang-semantic", - "cairo-lang-starknet", - "cairo-lang-syntax", - "cairo-lang-test-plugin", - "cairo-lang-utils", - "indent", - "indoc", - "itertools 0.12.1", - "salsa", - "scarb-metadata", - "serde", - "serde_json", - "smol_str", - "tokio", - "tower-lsp", - "tracing", - "tracing-chrome", - "tracing-subscriber", -] - [[package]] name = "cairo-lang-lowering" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -366,14 +261,14 @@ dependencies = [ "log", "num-bigint", "num-traits 0.2.19", - "salsa", + "rust-analyzer-salsa", "smol_str", ] [[package]] name = "cairo-lang-parser" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-diagnostics", "cairo-lang-filesystem", @@ -384,15 +279,15 @@ dependencies = [ "itertools 0.12.1", "num-bigint", "num-traits 0.2.19", - "salsa", + "rust-analyzer-salsa", "smol_str", "unescaper", ] [[package]] name = "cairo-lang-plugins" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-defs", "cairo-lang-diagnostics", @@ -403,14 +298,14 @@ dependencies = [ "indent", "indoc", "itertools 0.12.1", - "salsa", + "rust-analyzer-salsa", "smol_str", ] [[package]] name = "cairo-lang-proc-macros" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-debug", "quote", @@ -419,8 +314,8 @@ dependencies = [ [[package]] name = "cairo-lang-project" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-filesystem", "cairo-lang-utils", @@ -432,8 +327,8 @@ dependencies = [ [[package]] name = "cairo-lang-semantic" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -450,15 +345,15 @@ dependencies = [ "itertools 0.12.1", "num-bigint", "num-traits 0.2.19", - "salsa", + "rust-analyzer-salsa", "smol_str", "toml", ] [[package]] name = "cairo-lang-sierra" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "anyhow", "cairo-lang-utils", @@ -472,7 +367,7 @@ dependencies = [ "num-integer", "num-traits 0.2.19", "regex", - "salsa", + "rust-analyzer-salsa", "serde", "serde_json", "sha3", @@ -483,8 +378,8 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-ap-change" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-eq-solver", "cairo-lang-sierra", @@ -498,8 +393,8 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-gas" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-eq-solver", "cairo-lang-sierra", @@ -513,8 +408,8 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-generator" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -528,7 +423,7 @@ dependencies = [ "cairo-lang-utils", "itertools 0.12.1", "num-traits 0.2.19", - "salsa", + "rust-analyzer-salsa", "serde", "serde_json", "smol_str", @@ -536,8 +431,8 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-to-casm" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "assert_matches", "cairo-lang-casm", @@ -556,8 +451,8 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-type-size" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-sierra", "cairo-lang-utils", @@ -565,8 +460,8 @@ dependencies = [ [[package]] name = "cairo-lang-starknet" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "anyhow", "cairo-lang-compiler", @@ -594,8 +489,8 @@ dependencies = [ [[package]] name = "cairo-lang-starknet-classes" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-casm", "cairo-lang-sierra", @@ -616,23 +511,23 @@ dependencies = [ [[package]] name = "cairo-lang-syntax" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-debug", "cairo-lang-filesystem", "cairo-lang-utils", "num-bigint", "num-traits 0.2.19", - "salsa", + "rust-analyzer-salsa", "smol_str", "unescaper", ] [[package]] name = "cairo-lang-syntax-codegen" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "genco", "xshell", @@ -640,8 +535,8 @@ dependencies = [ [[package]] name = "cairo-lang-test-plugin" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "anyhow", "cairo-lang-compiler", @@ -666,8 +561,8 @@ dependencies = [ [[package]] name = "cairo-lang-test-utils" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "cairo-lang-formatter", "cairo-lang-utils", @@ -678,8 +573,8 @@ dependencies = [ [[package]] name = "cairo-lang-utils" -version = "2.7.0" -source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#4c361d62a002b48c75175083d3d75bae540bb95f" +version = "2.7.1" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#a83cae9aaab5ad815db17bc1901218383c34c1df" dependencies = [ "hashbrown 0.14.5", "indexmap 2.4.0", @@ -698,7 +593,6 @@ dependencies = [ "cairo-lang-defs", "cairo-lang-diagnostics", "cairo-lang-filesystem", - "cairo-lang-language-server", "cairo-lang-lowering", "cairo-lang-parser", "cairo-lang-semantic", @@ -716,7 +610,6 @@ dependencies = [ "cairo-lang-defs", "cairo-lang-diagnostics", "cairo-lang-filesystem", - "cairo-lang-language-server", "cairo-lang-lowering", "cairo-lang-parser", "cairo-lang-semantic", @@ -743,6 +636,7 @@ version = "0.1.0" name = "cairo-lint-test-utils" version = "0.1.0" dependencies = [ + "cairo-lang-compiler", "cairo-lang-defs", "cairo-lang-diagnostics", "cairo-lang-filesystem", @@ -753,24 +647,6 @@ dependencies = [ "paste", ] -[[package]] -name = "camino" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" -dependencies = [ - "serde", -] - -[[package]] -name = "cc" -version = "1.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72db2f7947ecee9b03b510377e8bb9077afa27176fdbff55c51027e976fdcc48" -dependencies = [ - "shlex", -] - [[package]] name = "cfg-if" version = "1.0.0" @@ -882,19 +758,6 @@ dependencies = [ "syn 2.0.75", ] -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core 0.9.10", -] - [[package]] name = "derivative" version = "2.2.0" @@ -991,98 +854,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "form_urlencoded" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] - [[package]] name = "funty" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" -[[package]] -name = "futures" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" - -[[package]] -name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-macro" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "futures-sink" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" - -[[package]] -name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-util" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - [[package]] name = "genco" version = "0.17.9" @@ -1126,12 +903,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "gimli" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" - [[package]] name = "globset" version = "0.4.14" @@ -1141,8 +912,8 @@ dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", + "regex-automata", + "regex-syntax", ] [[package]] @@ -1182,16 +953,10 @@ dependencies = [ ] [[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - -[[package]] -name = "httparse" -version = "1.9.4" +name = "heck" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "id-arena" @@ -1199,16 +964,6 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" -[[package]] -name = "idna" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "ignore" version = "0.4.22" @@ -1219,7 +974,7 @@ dependencies = [ "globset", "log", "memchr", - "regex-automata 0.4.7", + "regex-automata", "same-file", "walkdir", "winapi-util", @@ -1335,7 +1090,7 @@ dependencies = [ "petgraph", "pico-args", "regex", - "regex-syntax 0.8.4", + "regex-syntax", "string_cache", "term", "tiny-keccak", @@ -1349,7 +1104,7 @@ version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "507460a910eb7b32ee961886ff48539633b788a36b65692b95f225b844c82553" dependencies = [ - "regex-automata 0.4.7", + "regex-automata", ] [[package]] @@ -1412,28 +1167,6 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" -[[package]] -name = "lsp-types" -version = "0.94.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66bfd44a06ae10647fe3f8214762e9369fd4248df1350924b4ef9e770a85ea1" -dependencies = [ - "bitflags 1.3.2", - "serde", - "serde_json", - "serde_repr", - "url", -] - -[[package]] -name = "matchers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata 0.1.10", -] - [[package]] name = "matrixmultiply" version = "0.2.4" @@ -1459,27 +1192,6 @@ dependencies = [ "sprs", ] -[[package]] -name = "miniz_oxide" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" -dependencies = [ - "hermit-abi", - "libc", - "wasi", - "windows-sys 0.52.0", -] - [[package]] name = "ndarray" version = "0.13.1" @@ -1557,15 +1269,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "object" -version = "0.36.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.19.0" @@ -1670,12 +1373,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17359afc20d7ab31fdb42bb844c8b3bb1dabd7dcf7e68428492da7f16966fcef" -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - [[package]] name = "petgraph" version = "0.6.5" @@ -1701,38 +1398,12 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" -[[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - [[package]] name = "pin-project-lite" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - [[package]] name = "precomputed-hash" version = "0.1.1" @@ -1845,17 +1516,8 @@ checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", + "regex-automata", + "regex-syntax", ] [[package]] @@ -1866,15 +1528,9 @@ checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.4", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.8.4" @@ -1888,10 +1544,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2" [[package]] -name = "rustc-demangle" -version = "0.1.24" +name = "rust-analyzer-salsa" +version = "0.17.0-pre.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +checksum = "719825638c59fd26a55412a24561c7c5bcf54364c88b9a7a04ba08a6eafaba8d" +dependencies = [ + "indexmap 2.4.0", + "lock_api", + "oorandom", + "parking_lot 0.12.3", + "rust-analyzer-salsa-macros", + "rustc-hash", + "smallvec", + "tracing", + "triomphe", +] + +[[package]] +name = "rust-analyzer-salsa-macros" +version = "0.17.0-pre.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d96498e9684848c6676c399032ebc37c52da95ecbefa83d71ccc53b9f8a4a8e" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 2.0.75", +] [[package]] name = "rustc-hash" @@ -1934,7 +1613,7 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd3904a4ba0a9d0211816177fd34b04c7095443f8cdacd11175064fe541c8fe2" dependencies = [ - "heck", + "heck 0.3.3", "proc-macro2", "quote", "syn 1.0.109", @@ -1949,19 +1628,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "scarb-metadata" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170ebce1774a85568646ba4096827f898306665187eebd9282fee313e316518d" -dependencies = [ - "camino", - "semver", - "serde", - "serde_json", - "thiserror", -] - [[package]] name = "schemars" version = "0.8.21" @@ -2045,17 +1711,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_repr" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - [[package]] name = "serde_spanned" version = "0.6.7" @@ -2086,45 +1741,12 @@ dependencies = [ "keccak", ] -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "signal-hook-registry" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" -dependencies = [ - "libc", -] - [[package]] name = "siphasher" version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - [[package]] name = "smallvec" version = "1.13.2" @@ -2140,16 +1762,6 @@ dependencies = [ "serde", ] -[[package]] -name = "socket2" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "sprs" version = "0.7.1" @@ -2161,6 +1773,12 @@ dependencies = [ "num-traits 0.1.43", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "starknet-types-core" version = "0.1.5" @@ -2281,16 +1899,6 @@ dependencies = [ "syn 2.0.75", ] -[[package]] -name = "thread_local" -version = "1.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" -dependencies = [ - "cfg-if", - "once_cell", -] - [[package]] name = "tiny-keccak" version = "2.0.2" @@ -2300,63 +1908,6 @@ dependencies = [ "crunchy", ] -[[package]] -name = "tinyvec" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.39.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "parking_lot 0.12.3", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys 0.52.0", -] - -[[package]] -name = "tokio-macros" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "tokio-util" -version = "0.7.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", -] - [[package]] name = "toml" version = "0.8.19" @@ -2402,66 +1953,6 @@ dependencies = [ "winnow 0.6.18", ] -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "pin-project-lite", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" - -[[package]] -name = "tower-lsp" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4ba052b54a6627628d9b3c34c176e7eda8359b7da9acd497b9f20998d118508" -dependencies = [ - "async-trait", - "auto_impl", - "bytes", - "dashmap", - "futures", - "httparse", - "lsp-types", - "memchr", - "serde", - "serde_json", - "tokio", - "tokio-util", - "tower", - "tower-lsp-macros", - "tracing", -] - -[[package]] -name = "tower-lsp-macros" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84fd902d4e0b9a4b27f2f440108dc034e1758628a9b702f8ec61ad66355422fa" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "tower-service" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" - [[package]] name = "tracing" version = "0.1.40" @@ -2484,17 +1975,6 @@ dependencies = [ "syn 2.0.75", ] -[[package]] -name = "tracing-chrome" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf0a738ed5d6450a9fb96e86a23ad808de2b727fd1394585da5cdd6788ffe724" -dependencies = [ - "serde_json", - "tracing-core", - "tracing-subscriber", -] - [[package]] name = "tracing-core" version = "0.1.32" @@ -2502,36 +1982,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", ] [[package]] -name = "tracing-subscriber" -version = "0.3.18" +name = "triomphe" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e6631e42e10b40c0690bf92f404ebcfe6e1fdb480391d15f17cc8e96eeed5369" dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", + "serde", + "stable_deref_trait", ] [[package]] @@ -2549,27 +2009,12 @@ dependencies = [ "thiserror", ] -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "unicode-normalization" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" -dependencies = [ - "tinyvec", -] - [[package]] name = "unicode-segmentation" version = "1.11.0" @@ -2582,24 +2027,6 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" -[[package]] -name = "url" -version = "2.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", -] - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - [[package]] name = "version_check" version = "0.9.5" @@ -2662,15 +2089,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - [[package]] name = "windows-sys" version = "0.59.0" diff --git a/Cargo.toml b/Cargo.toml index a358ee3c..7f9be016 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,11 @@ [workspace] resolver = "2" -members = ["crates/cairo-lint-cli", "crates/cairo-lint-core", "crates/cairo-lint-dev", "crates/cairo-lint-test-utils"] +members = [ + "crates/cairo-lint-cli", + "crates/cairo-lint-core", + "crates/cairo-lint-dev", + "crates/cairo-lint-test-utils", +] [workspace.package] version = "0.1.0" @@ -30,3 +35,7 @@ ctor = "0.2.8" paste = "1.0.15" itertools = "0.13.0" log = "0.4.22" +clap = "4.5.16" +anyhow = "1.0.86" +smol_str = "0.2.2" +annotate-snippets = "0.11.4" diff --git a/crates/cairo-lint-cli/Cargo.toml b/crates/cairo-lint-cli/Cargo.toml index b2acb5e4..bcdeb1e1 100644 --- a/crates/cairo-lint-cli/Cargo.toml +++ b/crates/cairo-lint-cli/Cargo.toml @@ -16,5 +16,4 @@ cairo-lang-test-plugin.workspace = true cairo-lang-lowering.workspace = true cairo-lang-syntax.workspace = true cairo-lang-defs.workspace = true -cairo-lang-language-server.workspace = true salsa.workspace = true diff --git a/crates/cairo-lint-core/Cargo.toml b/crates/cairo-lint-core/Cargo.toml index 2c8bda36..2f840c60 100644 --- a/crates/cairo-lint-core/Cargo.toml +++ b/crates/cairo-lint-core/Cargo.toml @@ -17,7 +17,6 @@ cairo-lang-test-plugin.workspace = true cairo-lang-lowering.workspace = true cairo-lang-syntax.workspace = true cairo-lang-defs.workspace = true -cairo-lang-language-server.workspace = true salsa.workspace = true log.workspace = true diff --git a/crates/cairo-lint-core/src/db.rs b/crates/cairo-lint-core/src/db.rs deleted file mode 100644 index b82a8ab0..00000000 --- a/crates/cairo-lint-core/src/db.rs +++ /dev/null @@ -1,103 +0,0 @@ -use cairo_lang_defs::db::{DefsDatabase, DefsGroup}; -use cairo_lang_filesystem::cfg::{Cfg, CfgSet}; -use cairo_lang_filesystem::db::{init_files_group, AsFilesGroupMut, FilesDatabase, FilesGroup}; -use cairo_lang_lowering::db::{init_lowering_group, LoweringDatabase, LoweringGroup}; -use cairo_lang_lowering::utils::InliningStrategy; -use cairo_lang_parser::db::{ParserDatabase, ParserGroup}; -use cairo_lang_semantic::db::{SemanticDatabase, SemanticGroup}; -use cairo_lang_semantic::inline_macros::get_default_plugin_suite; -use cairo_lang_semantic::plugin::PluginSuite; -use cairo_lang_syntax::node::db::{SyntaxDatabase, SyntaxGroup}; -use cairo_lang_test_plugin::test_plugin_suite; -use cairo_lang_utils::Upcast; - -use crate::plugin::cairo_lint_plugin_suite; - -/// The Cairo compiler Salsa database tailored for language server usage. -#[salsa::database(DefsDatabase, FilesDatabase, LoweringDatabase, ParserDatabase, SemanticDatabase, SyntaxDatabase)] -pub struct AnalysisDatabase { - storage: salsa::Storage, -} -impl AnalysisDatabase { - pub fn new() -> Self { - let mut db = Self { storage: Default::default() }; - - let plugin_suite = [get_default_plugin_suite(), test_plugin_suite(), cairo_lint_plugin_suite()] - .into_iter() - .fold(PluginSuite::default(), |mut acc, suite| { - acc.add(suite); - acc - }); - db.apply_plugin_suite(plugin_suite); - init_files_group(&mut db); - init_lowering_group(&mut db, InliningStrategy::Default); - - db.set_cfg_set(Self::initial_cfg_set().into()); - - db - } - /// Returns the [`CfgSet`] that should be assumed in the initial database state. - fn initial_cfg_set() -> CfgSet { - CfgSet::from_iter([Cfg::name("test"), Cfg::kv("target", "test")]) - } - /// Shortcut for settings compiler plugins from a [`PluginSuite`]. - fn apply_plugin_suite(&mut self, plugin_suite: PluginSuite) { - self.set_macro_plugins(plugin_suite.plugins); - self.set_inline_macro_plugins(plugin_suite.inline_macro_plugins.into()); - self.set_analyzer_plugins(plugin_suite.analyzer_plugins); - } -} - -impl Default for AnalysisDatabase { - fn default() -> Self { - Self::new() - } -} - -impl salsa::Database for AnalysisDatabase {} -impl salsa::ParallelDatabase for AnalysisDatabase { - fn snapshot(&self) -> salsa::Snapshot { - salsa::Snapshot::new(AnalysisDatabase { storage: self.storage.snapshot() }) - } -} -impl AsFilesGroupMut for AnalysisDatabase { - fn as_files_group_mut(&mut self) -> &mut (dyn FilesGroup + 'static) { - self - } -} - -impl Upcast for AnalysisDatabase { - fn upcast(&self) -> &(dyn FilesGroup + 'static) { - self - } -} - -impl Upcast for AnalysisDatabase { - fn upcast(&self) -> &(dyn SyntaxGroup + 'static) { - self - } -} - -impl Upcast for AnalysisDatabase { - fn upcast(&self) -> &(dyn DefsGroup + 'static) { - self - } -} - -impl Upcast for AnalysisDatabase { - fn upcast(&self) -> &(dyn SemanticGroup + 'static) { - self - } -} - -impl Upcast for AnalysisDatabase { - fn upcast(&self) -> &(dyn LoweringGroup + 'static) { - self - } -} - -impl Upcast for AnalysisDatabase { - fn upcast(&self) -> &(dyn ParserGroup + 'static) { - self - } -} diff --git a/crates/cairo-lint-core/src/fix.rs b/crates/cairo-lint-core/src/fix.rs index bae880b4..3a85b57b 100644 --- a/crates/cairo-lint-core/src/fix.rs +++ b/crates/cairo-lint-core/src/fix.rs @@ -1,3 +1,4 @@ +use cairo_lang_compiler::db::RootDatabase; use cairo_lang_defs::ids::UseId; use cairo_lang_defs::plugin::PluginDiagnostic; use cairo_lang_filesystem::span::TextSpan; @@ -10,7 +11,6 @@ use cairo_lang_syntax::node::{SyntaxNode, TypedStablePtr, TypedSyntaxNode}; use cairo_lang_utils::Upcast; use log::{debug, warn}; -use crate::db::AnalysisDatabase; use crate::lints::single_match::is_expr_unit; use crate::plugin::{diagnostic_kind_from_message, CairoLintKind}; @@ -29,7 +29,7 @@ pub struct Fix { /// /// # Arguments /// -/// * `db` - A reference to the AnalysisDatabase +/// * `db` - A reference to the RootDatabase /// * `diag` - A reference to the SemanticDiagnostic to be fixed /// /// # Returns @@ -37,7 +37,7 @@ pub struct Fix { /// An `Option<(SyntaxNode, String)>` where the `SyntaxNode` represents the node to be /// replaced, and the `String` is the suggested replacement. Returns `None` if no fix /// is available for the given diagnostic. -pub fn fix_semantic_diagnostic(db: &AnalysisDatabase, diag: &SemanticDiagnostic) -> Option<(SyntaxNode, String)> { +pub fn fix_semantic_diagnostic(db: &RootDatabase, diag: &SemanticDiagnostic) -> Option<(SyntaxNode, String)> { match diag.kind { SemanticDiagnosticKind::UnusedVariable => Fixer.fix_unused_variable(db, diag), SemanticDiagnosticKind::PluginDiagnostic(ref plugin_diag) => Fixer.fix_plugin_diagnostic(db, diag, plugin_diag), @@ -56,18 +56,14 @@ impl Fixer { /// /// # Arguments /// - /// * `db` - A reference to the AnalysisDatabase + /// * `db` - A reference to the RootDatabase /// * `diag` - A reference to the SemanticDiagnostic for the unused variable /// /// # Returns /// /// An `Option<(SyntaxNode, String)>` containing the node to be replaced and the /// suggested replacement (the variable name prefixed with an underscore). - pub fn fix_unused_variable( - &self, - db: &AnalysisDatabase, - diag: &SemanticDiagnostic, - ) -> Option<(SyntaxNode, String)> { + pub fn fix_unused_variable(&self, db: &RootDatabase, diag: &SemanticDiagnostic) -> Option<(SyntaxNode, String)> { let node = diag.stable_location.syntax_node(db.upcast()); let suggestion = format!("_{}", node.get_text(db.upcast())); Some((node, suggestion)) @@ -127,7 +123,7 @@ impl Fixer { /// /// # Arguments /// - /// * `db` - A reference to the AnalysisDatabase + /// * `db` - A reference to the RootDatabase /// * `diag` - A reference to the SemanticDiagnostic /// * `plugin_diag` - A reference to the PluginDiagnostic /// @@ -137,7 +133,7 @@ impl Fixer { /// suggested replacement. pub fn fix_plugin_diagnostic( &self, - db: &AnalysisDatabase, + db: &RootDatabase, semantic_diag: &SemanticDiagnostic, plugin_diag: &PluginDiagnostic, ) -> Option<(SyntaxNode, String)> { @@ -146,7 +142,7 @@ impl Fixer { self.fix_double_parens(db.upcast(), plugin_diag.stable_ptr.lookup(db.upcast())) } CairoLintKind::DestructMatch => self.fix_destruct_match(db, plugin_diag.stable_ptr.lookup(db.upcast())), - _ => "".to_owned(), + _ => return None, }; Some((semantic_diag.stable_location.syntax_node(db.upcast()), new_text)) @@ -191,7 +187,7 @@ impl Fixer { /// /// # Arguments /// - /// * `db` - A reference to the AnalysisDatabase + /// * `db` - A reference to the RootDatabase /// * `diag` - A reference to the SemanticDiagnostic /// * `id` - A reference to the UseId of the unused import /// @@ -199,7 +195,7 @@ impl Fixer { /// /// An `Option<(SyntaxNode, String)>` containing the node to be removed and an empty string /// (indicating removal). Returns `None` for multi-import paths. - pub fn fix_unused_import(&self, db: &AnalysisDatabase, id: &UseId) -> Option<(SyntaxNode, String)> { + pub fn fix_unused_import(&self, db: &RootDatabase, id: &UseId) -> Option<(SyntaxNode, String)> { let mut current_node = id.stable_ptr(db).lookup(db.upcast()).as_syntax_node(); let mut path_to_remove = vec![current_node.clone()]; let mut remove_entire_statement = true; diff --git a/crates/cairo-lint-core/src/lib.rs b/crates/cairo-lint-core/src/lib.rs index 9a87dbbf..3dfcda3c 100644 --- a/crates/cairo-lint-core/src/lib.rs +++ b/crates/cairo-lint-core/src/lib.rs @@ -1,5 +1,4 @@ #![feature(let_chains)] -pub mod db; pub mod fix; pub mod lints; pub mod plugin; diff --git a/crates/cairo-lint-core/src/lints/loops.rs b/crates/cairo-lint-core/src/lints/loops.rs new file mode 100644 index 00000000..af39a68e --- /dev/null +++ b/crates/cairo-lint-core/src/lints/loops.rs @@ -0,0 +1,48 @@ +use cairo_lang_defs::plugin::PluginDiagnostic; +use cairo_lang_diagnostics::Severity; +use cairo_lang_semantic::db::SemanticGroup; +use cairo_lang_semantic::{Arenas, Expr, ExprLoop, Statement}; + +pub const LOOP_MATCH_POP_FRONT: &str = + "you seem to be trying to use `loop` for iterating over a span. Consider using `for in`"; + +const SPAN_MATCH_POP_FRONT: &str = "\"SpanImpl::pop_front\""; + +pub fn check_loop_match_pop_front( + db: &dyn SemanticGroup, + loop_expr: &ExprLoop, + diagnostics: &mut Vec, + arenas: &Arenas, +) { + let Expr::Block(expr_block) = &arenas.exprs[loop_expr.body] else { + return; + }; + if let Some(tail) = &expr_block.tail + && let Expr::Match(expr_match) = &arenas.exprs[*tail] + && let Expr::FunctionCall(func_call) = &arenas.exprs[expr_match.matched_expr] + && func_call.function.name(db) == SPAN_MATCH_POP_FRONT + { + diagnostics.push(PluginDiagnostic { + stable_ptr: loop_expr.stable_ptr.into(), + message: LOOP_MATCH_POP_FRONT.to_owned(), + severity: Severity::Warning, + }); + return; + } + for statement in &expr_block.statements { + if let Statement::Expr(stmt_expr) = &arenas.statements[*statement] + && let Expr::Match(expr_match) = &arenas.exprs[stmt_expr.expr] + { + let Expr::FunctionCall(func_call) = &arenas.exprs[expr_match.matched_expr] else { + continue; + }; + if func_call.function.name(db) == SPAN_MATCH_POP_FRONT { + diagnostics.push(PluginDiagnostic { + stable_ptr: loop_expr.stable_ptr.into(), + message: LOOP_MATCH_POP_FRONT.to_owned(), + severity: Severity::Warning, + }) + } + } + } +} diff --git a/crates/cairo-lint-core/src/lints/mod.rs b/crates/cairo-lint-core/src/lints/mod.rs index 2e396ead..8b320677 100644 --- a/crates/cairo-lint-core/src/lints/mod.rs +++ b/crates/cairo-lint-core/src/lints/mod.rs @@ -1,2 +1,3 @@ pub mod double_parens; +pub mod loops; pub mod single_match; diff --git a/crates/cairo-lint-core/src/lints/single_match.rs b/crates/cairo-lint-core/src/lints/single_match.rs index 33671413..d871ccc5 100644 --- a/crates/cairo-lint-core/src/lints/single_match.rs +++ b/crates/cairo-lint-core/src/lints/single_match.rs @@ -1,14 +1,11 @@ -use cairo_lang_defs::ids::{FileIndex, ModuleFileId, ModuleId}; use cairo_lang_defs::plugin::PluginDiagnostic; -use cairo_lang_diagnostics::{DiagnosticsBuilder, Severity}; +use cairo_lang_diagnostics::Severity; +use cairo_lang_semantic::corelib::unit_ty; use cairo_lang_semantic::db::SemanticGroup; -use cairo_lang_semantic::diagnostic::NotFoundItemType; -use cairo_lang_semantic::expr::inference::InferenceId; -use cairo_lang_semantic::resolve::{AsSegments, ResolvedGenericItem, Resolver}; -use cairo_lang_syntax::node::ast::{Expr, ExprBlock, ExprListParenthesized, ExprMatch, Pattern, Statement}; +use cairo_lang_semantic::{Arenas, ExprMatch, Pattern}; +use cairo_lang_syntax::node::ast::{Expr as AstExpr, ExprBlock, ExprListParenthesized, Statement}; use cairo_lang_syntax::node::db::SyntaxGroup; use cairo_lang_syntax::node::{TypedStablePtr, TypedSyntaxNode}; -use cairo_lang_utils::try_extract_matches; pub const DESTRUCT_MATCH: &str = "you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`"; @@ -25,7 +22,7 @@ fn is_block_expr_unit_without_comment(block_expr: &ExprBlock, db: &dyn SyntaxGro } if statements.len() == 1 && let Statement::Expr(statement_expr) = &statements[0] - && let Expr::Tuple(tuple_expr) = statement_expr.expr(db) + && let AstExpr::Tuple(tuple_expr) = statement_expr.expr(db) { let tuple_node = tuple_expr.as_syntax_node(); if tuple_node.span(db).start != tuple_node.span_start_without_trivia(db) { @@ -37,10 +34,10 @@ fn is_block_expr_unit_without_comment(block_expr: &ExprBlock, db: &dyn SyntaxGro } } -pub fn is_expr_unit(expr: Expr, db: &dyn SyntaxGroup) -> bool { +pub fn is_expr_unit(expr: AstExpr, db: &dyn SyntaxGroup) -> bool { match expr { - Expr::Block(block_expr) => is_block_expr_unit_without_comment(&block_expr, db), - Expr::Tuple(tuple_expr) => is_expr_list_parenthesised_unit(&tuple_expr, db), + AstExpr::Block(block_expr) => is_block_expr_unit_without_comment(&block_expr, db), + AstExpr::Tuple(tuple_expr) => is_expr_list_parenthesised_unit(&tuple_expr, db), _ => false, } } @@ -49,62 +46,57 @@ pub fn check_single_match( db: &dyn SemanticGroup, match_expr: &ExprMatch, diagnostics: &mut Vec, - module_id: &ModuleId, + arenas: &Arenas, ) { - let syntax_db = db.upcast(); - let arms = match_expr.arms(syntax_db).elements(syntax_db); + let arms = &match_expr.arms; let mut is_single_armed = false; let mut is_complete = false; let mut is_destructuring = false; - if arms.len() == 2 { + + if arms.len() == 2 && match_expr.ty == unit_ty(db) { let first_arm = &arms[0]; let second_arm = &arms[1]; let mut enum_len = None; - let mut is_first_arm_unit = false; - if let Some(pattern) = first_arm.patterns(syntax_db).elements(syntax_db).first() { - match pattern { - Pattern::Underscore(_) => return, - Pattern::Enum(pat) => { - let mut diagnostics = DiagnosticsBuilder::default(); - let path = pat.path(syntax_db).to_segments(syntax_db); - let item = Resolver::new(db, ModuleFileId(*module_id, FileIndex(0)), InferenceId::NoContext) - .resolve_generic_path(&mut diagnostics, path, NotFoundItemType::Identifier) - .unwrap(); - let generic_variant = try_extract_matches!(item, ResolvedGenericItem::Variant).unwrap(); - enum_len = Some(db.enum_variants(generic_variant.enum_id).unwrap().len()); + if let Some(pattern) = first_arm.patterns.first() { + match &arenas.patterns[*pattern] { + Pattern::Otherwise(_) => return, + Pattern::EnumVariant(enum_pat) => { + enum_len = Some(db.enum_variants(enum_pat.variant.concrete_enum_id.enum_id(db)).unwrap().len()); is_destructuring = true; } Pattern::Struct(_) => { is_destructuring = true; } _ => (), - } - is_first_arm_unit = is_expr_unit(first_arm.expression(syntax_db), syntax_db) + }; }; - if let Some(pattern) = second_arm.patterns(syntax_db).elements(syntax_db).first() { - match pattern { - Pattern::Underscore(_) => { + if let Some(pattern) = second_arm.patterns.first() { + match &arenas.patterns[*pattern] { + Pattern::Otherwise(_) => { is_complete = true; } - Pattern::Enum(_) => { + Pattern::EnumVariant(_) => { if enum_len == Some(2) { is_complete = true; } } _ => (), - } + }; + is_single_armed = - is_expr_unit(second_arm.expression(syntax_db), syntax_db) && is_complete || is_first_arm_unit; + is_expr_unit(arenas.exprs[second_arm.expression].stable_ptr().lookup(db.upcast()), db.upcast()) + && is_complete; }; }; + match (is_single_armed, is_destructuring) { (true, false) => diagnostics.push(PluginDiagnostic { - stable_ptr: match_expr.stable_ptr().untyped(), + stable_ptr: match_expr.stable_ptr.into(), message: MATCH_FOR_EQUALITY.to_string(), severity: Severity::Warning, }), (true, true) => diagnostics.push(PluginDiagnostic { - stable_ptr: match_expr.stable_ptr().untyped(), + stable_ptr: match_expr.stable_ptr.into(), message: DESTRUCT_MATCH.to_string(), severity: Severity::Warning, }), diff --git a/crates/cairo-lint-core/src/plugin.rs b/crates/cairo-lint-core/src/plugin.rs index d951bb56..b64d53ce 100644 --- a/crates/cairo-lint-core/src/plugin.rs +++ b/crates/cairo-lint-core/src/plugin.rs @@ -1,12 +1,13 @@ -use cairo_lang_defs::ids::{ModuleId, ModuleItemId}; +use cairo_lang_defs::ids::{FunctionWithBodyId, ModuleId, ModuleItemId}; use cairo_lang_defs::plugin::PluginDiagnostic; use cairo_lang_semantic::db::SemanticGroup; use cairo_lang_semantic::plugin::{AnalyzerPlugin, PluginSuite}; -use cairo_lang_syntax::node::ast::{Expr, ExprMatch}; +use cairo_lang_semantic::Expr; +use cairo_lang_syntax::node::ast::Expr as AstExpr; use cairo_lang_syntax::node::kind::SyntaxKind; -use cairo_lang_syntax::node::TypedSyntaxNode; +use cairo_lang_syntax::node::{TypedStablePtr, TypedSyntaxNode}; -use crate::lints::{double_parens, single_match}; +use crate::lints::{double_parens, loops, single_match}; pub fn cairo_lint_plugin_suite() -> PluginSuite { let mut suite = PluginSuite::default(); @@ -36,35 +37,50 @@ pub fn diagnostic_kind_from_message(message: &str) -> CairoLintKind { impl AnalyzerPlugin for CairoLint { fn diagnostics(&self, db: &dyn SemanticGroup, module_id: ModuleId) -> Vec { let mut diags = Vec::new(); - let Ok(items) = db.module_items(module_id) else { + let Ok(free_functions_ids) = db.module_free_functions_ids(module_id) else { return diags; }; - for item in items.iter() { - match item { - ModuleItemId::FreeFunction(func_id) => { - // - let func = db.module_free_function_by_id(*func_id).unwrap().unwrap(); - let descendants = func.as_syntax_node().descendants(db.upcast()); - for descendant in descendants.into_iter() { - match descendant.kind(db.upcast()) { - SyntaxKind::ExprMatch => single_match::check_single_match( - db.upcast(), - &ExprMatch::from_syntax_node(db.upcast(), descendant), - &mut diags, - &module_id, - ), - SyntaxKind::ExprParenthesized => double_parens::check_double_parens( - db.upcast(), - &Expr::from_syntax_node(db.upcast(), descendant), - &mut diags, - ), - SyntaxKind::ItemExternFunction => (), - _ => (), - } + for free_func_id in free_functions_ids.iter() { + let Ok(function_body) = db.function_body(FunctionWithBodyId::Free(*free_func_id)) else { + return diags; + }; + for (_expression_id, expression) in &function_body.arenas.exprs { + match &expression { + Expr::Match(expr_match) => { + single_match::check_single_match(db, expr_match, &mut diags, &function_body.arenas) + } + Expr::Loop(expr_loop) => { + loops::check_loop_match_pop_front(db, expr_loop, &mut diags, &function_body.arenas) } + _ => (), + }; + } + } + let syntax_db = db.upcast(); + let Ok(items) = db.module_items(module_id) else { + return diags; + }; + for item in &*items { + let function_nodes = match item { + ModuleItemId::Constant(constant_id) => { + constant_id.stable_ptr(db.upcast()).lookup(syntax_db).as_syntax_node() + } + ModuleItemId::FreeFunction(free_function_id) => { + free_function_id.stable_ptr(db.upcast()).lookup(syntax_db).as_syntax_node() + } + _ => continue, + } + .descendants(syntax_db); + + for node in function_nodes { + match node.kind(syntax_db) { + SyntaxKind::ExprParenthesized => double_parens::check_double_parens( + db.upcast(), + &AstExpr::from_syntax_node(db.upcast(), node), + &mut diags, + ), + _ => continue, } - ModuleItemId::ExternFunction(_) => (), - _ => (), } } diags diff --git a/crates/cairo-lint-core/tests/test_files/double_parens/double_parens b/crates/cairo-lint-core/tests/test_files/double_parens/double_parens index 086d4721..96074479 100644 --- a/crates/cairo-lint-core/tests/test_files/double_parens/double_parens +++ b/crates/cairo-lint-core/tests/test_files/double_parens/double_parens @@ -2,18 +2,18 @@ //! > cairo_code fn main() { - assert_eq!(((4)), 4); + assert!(((4)) == 4); } //! > diagnostics warning: Plugin diagnostic: unnecessary double parentheses found. Consider removing them. - --> lib.cairo:2:16 - assert_eq!(((4)), 4); - ^***^ + --> lib.cairo:2:13 + assert!(((4)) == 4); + ^***^ //! > fixed fn main() { - assert_eq!(4, 4); + assert!(4== 4); } //! > ========================================================================== diff --git a/crates/cairo-lint-core/tests/test_files/loops/loop_match_pop_front b/crates/cairo-lint-core/tests/test_files/loops/loop_match_pop_front new file mode 100644 index 00000000..c4908f31 --- /dev/null +++ b/crates/cairo-lint-core/tests/test_files/loops/loop_match_pop_front @@ -0,0 +1,34 @@ +//! > simple loop match pop front + +//! > cairo_code +fn main() { + let mut a: Span = array![1, 2, 3, 4, 5].span(); + loop { + match a.pop_front() { + Option::Some(val) => println!("{val}"), + Option::None => { break; }, + } + } +} + +//! > diagnostics +warning: Plugin diagnostic: you seem to be trying to use `loop` for iterating over a span. Consider using `for in` + --> lib.cairo:3:5 +\ loop { +| match a.pop_front() { +| Option::Some(val) => println!("{val}"), +| Option::None => { break; }, +| } +| } +|___^ + +//! > fixed +fn main() { + let mut a: Span = array![1, 2, 3, 4, 5].span(); + loop { + match a.pop_front() { + Option::Some(val) => println!("{val}"), + Option::None => { break; }, + } + } +} diff --git a/crates/cairo-lint-core/tests/test_files/single_match/destructuring_match b/crates/cairo-lint-core/tests/test_files/single_match/destructuring_match index 03dc0209..bc7c8991 100644 --- a/crates/cairo-lint-core/tests/test_files/single_match/destructuring_match +++ b/crates/cairo-lint-core/tests/test_files/single_match/destructuring_match @@ -152,6 +152,14 @@ fn main() { } //! > diagnostics +warning: Plugin diagnostic: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` + --> lib.cairo:5:22 +\ Option::Some(a) => match a { +| Option::Some(b) => println!("{b}"), +| _ => (), +| } +|___^ + warning: Plugin diagnostic: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> lib.cairo:4:2 \ match variable { @@ -163,14 +171,6 @@ warning: Plugin diagnostic: you seem to be trying to use `match` for destructuri | } |___^ -warning: Plugin diagnostic: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> lib.cairo:5:22 -\ Option::Some(a) => match a { -| Option::Some(b) => println!("{b}"), -| _ => (), -| } -|___^ - //! > fixed Contains nested diagnostics can't fix it @@ -188,18 +188,14 @@ fn main() { } //! > diagnostics -warning: Plugin diagnostic: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> lib.cairo:3:2 -\ match variable { -| Option::None => (), -| Option::Some(a) => println!("{a}"), -| } -|___^ //! > fixed fn main() { let variable = Option::Some(1_felt252); - if let Option::Some(a) = variable { println!("{a}") }; + match variable { + Option::None => (), + Option::Some(a) => println!("{a}"), + }; } //! > ========================================================================== diff --git a/crates/cairo-lint-core/tests/tests.rs b/crates/cairo-lint-core/tests/tests.rs index ca0cf3c7..31be46f9 100644 --- a/crates/cairo-lint-core/tests/tests.rs +++ b/crates/cairo-lint-core/tests/tests.rs @@ -2,12 +2,15 @@ use std::cmp::Reverse; use std::path::Path; use std::sync::{LazyLock, Mutex}; +use cairo_lang_compiler::db::RootDatabase; +use cairo_lang_semantic::inline_macros::get_default_plugin_suite; use cairo_lang_semantic::test_utils::setup_test_crate_ex; +use cairo_lang_test_plugin::test_plugin_suite; use cairo_lang_test_utils::parse_test_file::{dump_to_test_file, parse_test_file, Test}; use cairo_lang_utils::ordered_hash_map::OrderedHashMap; use cairo_lang_utils::Upcast; -use cairo_lint_core::db::AnalysisDatabase; use cairo_lint_core::fix::{fix_semantic_diagnostic, Fix}; +use cairo_lint_core::plugin::cairo_lint_plugin_suite; use cairo_lint_test_utils::{get_diags, test_file, Tests}; use ctor::dtor; use itertools::Itertools; @@ -65,3 +68,4 @@ test_file!( "double parens in struct field access", "double parens in match arm" ); +test_file!(loops, loop_match_pop_front, "simple loop match pop front"); diff --git a/crates/cairo-lint-test-utils/Cargo.toml b/crates/cairo-lint-test-utils/Cargo.toml index 0344cacc..79a36367 100644 --- a/crates/cairo-lint-test-utils/Cargo.toml +++ b/crates/cairo-lint-test-utils/Cargo.toml @@ -13,5 +13,6 @@ cairo-lang-filesystem.workspace = true cairo-lang-diagnostics.workspace = true cairo-lang-semantic.workspace = true cairo-lang-defs.workspace = true +cairo-lang-compiler.workspace = true cairo-lint-core = { path = "../cairo-lint-core" } paste.workspace = true diff --git a/crates/cairo-lint-test-utils/src/lib.rs b/crates/cairo-lint-test-utils/src/lib.rs index 68a5b8e2..e6633308 100644 --- a/crates/cairo-lint-test-utils/src/lib.rs +++ b/crates/cairo-lint-test-utils/src/lib.rs @@ -1,5 +1,6 @@ use std::path::PathBuf; +use cairo_lang_compiler::db::RootDatabase; use cairo_lang_defs::db::DefsGroup; use cairo_lang_defs::ids::ModuleId; use cairo_lang_diagnostics::Diagnostics; @@ -10,13 +11,12 @@ use cairo_lang_semantic::SemanticDiagnostic; use cairo_lang_test_utils::parse_test_file::Test; use cairo_lang_utils::ordered_hash_map::OrderedHashMap; use cairo_lang_utils::LookupIntern; -use cairo_lint_core::db::AnalysisDatabase; pub struct Tests { pub tests: OrderedHashMap, pub should_fix: bool, } -pub fn get_diags(crate_id: CrateId, db: &mut AnalysisDatabase) -> Vec> { +pub fn get_diags(crate_id: CrateId, db: &mut RootDatabase) -> Vec> { init_dev_corelib(db, PathBuf::from(std::env::var("CORELIB_PATH").unwrap())); let mut diagnostics = Vec::new(); let module_file = db.module_main_file(ModuleId::CrateRoot(crate_id)).unwrap(); @@ -24,6 +24,7 @@ pub fn get_diags(crate_id: CrateId, db: &mut AnalysisDatabase) -> Vec {} FileLongId::Virtual(_) => panic!("Missing virtual file."), + FileLongId::External(_) => (), } } @@ -59,7 +60,12 @@ macro_rules! test_file { let test = & [][test_name]; let is_fix_mode = std::env::var("FIX_TESTS") == Ok("1".into()); let mut file = test.attributes["cairo_code"].clone(); - let mut db = AnalysisDatabase::new(); + let mut db = RootDatabase::builder() + .with_plugin_suite(get_default_plugin_suite()) + .with_plugin_suite(test_plugin_suite()) + .with_plugin_suite(cairo_lint_plugin_suite()) + .build() + .unwrap(); let mut fixes = Vec::new(); let diags = get_diags(setup_test_crate_ex(db.upcast(), &file, Some(CRATE_CONFIG)), &mut db);