diff --git a/Cargo.lock b/Cargo.lock index 09b89a0..26415a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,18 +10,18 @@ checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "ahash" @@ -37,9 +37,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" [[package]] name = "autocfg" @@ -49,17 +49,17 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets", ] [[package]] @@ -99,9 +99,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cc" -version = "1.1.12" +version = "1.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68064e60dbf1f17005c2fde4d07c16d8baa506fd7ffed8ccab702d93617975c7" +checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" dependencies = [ "shlex", ] @@ -134,7 +134,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -145,9 +145,9 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "els" -version = "0.1.55-nightly.3" +version = "0.1.57-nightly.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63f9e25ff43d73683b69143e5c9c8486860825c90a424a90decb37f19786a131" +checksum = "98756af66882a065224c97f2fdc5194488743202edd74dd237b16702f826d1de" dependencies = [ "erg_common", "erg_compiler", @@ -159,21 +159,22 @@ dependencies = [ [[package]] name = "erg_common" -version = "0.6.43-nightly.3" +version = "0.6.45-nightly.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e92896ebee6654ec131218c5e00f403c760e7fb62604507933baa010f02b2dae" +checksum = "219046e2b30f4e0b74089d95acfb49c4b5591ccc2d4d0a7e60c3616d0ed59fcb" dependencies = [ "backtrace-on-stack-overflow", "erg_proc_macros", "parking_lot", "thread_local", + "w-boson", ] [[package]] name = "erg_compiler" -version = "0.6.43-nightly.3" +version = "0.6.45-nightly.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a877f47335f2fdeea096aae57215997d29b49f94ba8cbc35168f1d39f0495a6" +checksum = "5e58d1703e885cbf39337d087eb864f93aee1b8d327a222a6b7dd3cc5a26e6e4" dependencies = [ "erg_common", "erg_parser", @@ -181,9 +182,9 @@ dependencies = [ [[package]] name = "erg_parser" -version = "0.6.43-nightly.3" +version = "0.6.45-nightly.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4971122d6b522a55c07a8bf087a40daa44a16f5dcd85e613821547aa5e1af015" +checksum = "3103c4b8049db34a0ef3598c9603d3113d072f258d44d33715d3ba8d98ae2328" dependencies = [ "erg_common", "erg_proc_macros", @@ -192,9 +193,9 @@ dependencies = [ [[package]] name = "erg_proc_macros" -version = "0.6.43-nightly.3" +version = "0.6.45-nightly.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb0470efceef91637cf66a63df4586bdae9b1379be00d1a36c63909097d3cc0b" +checksum = "afe652e09673d3abbfc272472d9f6f89fdace58238bcaf21f6f6abd397bd8583" dependencies = [ "quote", "syn 1.0.109", @@ -231,9 +232,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" [[package]] name = "hashbrown" @@ -263,7 +264,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -289,9 +290,9 @@ checksum = "507460a910eb7b32ee961886ff48539633b788a36b65692b95f225b844c82553" [[package]] name = "libc" -version = "0.2.156" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5f43f184355eefb8d17fc948dbecf6c13be3c141f20d834ae842193a448c72a" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libm" @@ -330,9 +331,9 @@ dependencies = [ [[package]] name = "malachite" -version = "0.4.14" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6ea071913d15f7e0566bc4768aae3918906ea77f0abbb387ca7c0dc9303f90" +checksum = "5616515d632967cd329b6f6db96be9a03ea0b3a49cdbc45b0016803dad8a77b7" dependencies = [ "malachite-base", "malachite-nz", @@ -341,9 +342,9 @@ dependencies = [ [[package]] name = "malachite-base" -version = "0.4.14" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c817c713ff9f16e06cfdc23baa3fecf1b71eaaac714816a98a560f4e350aa6" +checksum = "46059721011b0458b7bd6d9179be5d0b60294281c23320c207adceaecc54d13b" dependencies = [ "hashbrown", "itertools", @@ -366,9 +367,9 @@ dependencies = [ [[package]] name = "malachite-nz" -version = "0.4.14" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "603729facf62429736ac17a9fc9fe1bf7e0eb8bde3da3b18cc2b6153150464d5" +checksum = "1503b27e825cabd1c3d0ff1e95a39fb2ec9eab6fd3da6cfa41aec7091d273e78" dependencies = [ "itertools", "libm", @@ -377,9 +378,9 @@ dependencies = [ [[package]] name = "malachite-q" -version = "0.4.14" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c73844ccbf0e9baaf34d4a6d187f0d6a925ce8e74ef37a67d238e7d65529b38c" +checksum = "a475503a70a3679dbe3b9b230a23622516742528ba614a7b2490f180ea9cb514" dependencies = [ "itertools", "malachite-base", @@ -403,11 +404,11 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.7.4" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "adler", + "adler2", ] [[package]] @@ -454,9 +455,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.3" +version = "0.36.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" +checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" dependencies = [ "memchr", ] @@ -601,9 +602,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -640,9 +641,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" dependencies = [ "bitflags 2.6.0", ] @@ -661,9 +662,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] @@ -741,29 +742,29 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.208" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.208" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] name = "serde_json" -version = "1.0.125" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", @@ -779,7 +780,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -819,9 +820,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.74" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -922,15 +923,15 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] @@ -943,15 +944,15 @@ checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" [[package]] name = "unicode-xid" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" [[package]] name = "unicode_names2" -version = "1.2.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "addeebf294df7922a1164f729fb27ebbbcea99cc32b3bf08afab62757f707677" +checksum = "d1673eca9782c84de5f81b82e4109dcfb3611c8ba0d52930ec4a9478f547b2dd" dependencies = [ "phf", "unicode_names2_generator", @@ -959,9 +960,9 @@ dependencies = [ [[package]] name = "unicode_names2_generator" -version = "1.2.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f444b8bba042fe3c1251ffaca35c603f2dc2ccc08d595c65a8c4f76f3e8426c0" +checksum = "b91e5b84611016120197efd7dc93ef76774f4e084cd73c9fb3ea4a86c570c56e" dependencies = [ "getopts", "log", @@ -987,6 +988,15 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "w-boson" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df84793b18c52e3ee62d71ba13278004205c84641c1646f367fb583ef5f3510a" +dependencies = [ + "windows", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -1015,7 +1025,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", "wasm-bindgen-shared", ] @@ -1037,7 +1047,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1048,6 +1058,70 @@ version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +[[package]] +name = "windows" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" +dependencies = [ + "windows-core", + "windows-targets", +] + +[[package]] +name = "windows-core" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-result", + "windows-strings", + "windows-targets", +] + +[[package]] +name = "windows-implement" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "windows-interface" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets", +] + [[package]] name = "windows-targets" version = "0.52.6" @@ -1130,5 +1204,5 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] diff --git a/Cargo.toml b/Cargo.toml index 89c21b8..b69e500 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,9 +24,9 @@ edition = "2021" repository = "https://github.com/mtshiba/pylyzer" [workspace.dependencies] -erg_common = { version = "0.6.43-nightly.3", features = ["py_compat", "els"] } -erg_compiler = { version = "0.6.43-nightly.3", features = ["py_compat", "els"] } -els = { version = "0.1.55-nightly.3", features = ["py_compat"] } +erg_common = { version = "0.6.45-nightly.0", features = ["py_compat", "els"] } +erg_compiler = { version = "0.6.45-nightly.0", features = ["py_compat", "els"] } +els = { version = "0.1.57-nightly.0", features = ["py_compat"] } # rustpython-parser = { version = "0.3.0", features = ["all-nodes-with-ranges", "location"] } # rustpython-ast = { version = "0.3.0", features = ["all-nodes-with-ranges", "location"] } rustpython-parser = { git = "https://github.com/RustPython/Parser", version = "0.4.0", features = ["all-nodes-with-ranges", "location"] } @@ -43,7 +43,8 @@ debug = ["erg_common/debug", "pylyzer_core/debug"] large_thread = ["erg_common/large_thread", "els/large_thread", "pylyzer_core/large_thread"] pretty = ["erg_common/pretty", "pylyzer_core/pretty"] backtrace = ["erg_common/backtrace", "els/backtrace", "pylyzer_core/backtrace"] -experimental = ["erg_common/experimental", "els/experimental", "pylyzer_core/experimental"] +experimental = ["erg_common/experimental", "els/experimental", "pylyzer_core/experimental", "parallel"] +parallel = ["erg_common/parallel", "pylyzer_core/parallel"] [dependencies] pylyzer_core = { version = "0.0.61", path = "./crates/pylyzer_core" } diff --git a/README.md b/README.md index f0f0341..da0e830 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,7 @@ pylyzer converts Python ASTs to Erg ASTs and passes them to Erg's type checker. * [x] type narrowing (`is`, `isinstance`) * [ ] `pyi` (stub) files support * [ ] glob pattern file check +* [ ] `# type: ignore` directive ## Join us! diff --git a/crates/pylyzer_core/Cargo.toml b/crates/pylyzer_core/Cargo.toml index a9a315f..da6874e 100644 --- a/crates/pylyzer_core/Cargo.toml +++ b/crates/pylyzer_core/Cargo.toml @@ -11,7 +11,8 @@ debug = ["erg_compiler/debug", "erg_common/debug", "py2erg/debug"] large_thread = ["erg_compiler/large_thread", "erg_common/large_thread"] pretty = ["erg_compiler/pretty", "erg_common/pretty"] backtrace = ["erg_common/backtrace"] -experimental = ["erg_compiler/experimental", "erg_common/experimental"] +experimental = ["erg_compiler/experimental", "erg_common/experimental", "parallel"] +parallel = ["erg_compiler/parallel", "erg_common/parallel"] [dependencies] erg_common = { workspace = true } diff --git a/tests/casting.py b/tests/casting.py index 3173a35..2c71216 100644 --- a/tests/casting.py +++ b/tests/casting.py @@ -7,3 +7,12 @@ # force cast to int i = typing.cast(int, s) print(i + 1) # OK + +l = typing.cast(list[str], [1, 2, 3]) +_ = map(lambda x: x + "a", l) # OK + +d = typing.cast(dict[str, int], [1, 2, 3]) +_ = map(lambda x: d["a"] + 1, d) # OK + +t = typing.cast(tuple[str, str], [1, 2, 3]) +_ = map(lambda x: x + "a", t) # OK diff --git a/tests/test.rs b/tests/test.rs index a91c124..b6ee1e4 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -119,7 +119,7 @@ fn exec_narrowing() -> Result<(), String> { #[test] fn exec_casting() -> Result<(), String> { - expect("tests/casting.py", 1, 1) + expect("tests/casting.py", 4, 1) } #[test]