Update dependencies version

This commit is contained in:
Shunsuke Shibayama 2023-01-04 13:08:33 +09:00
parent b8fc7b9778
commit 058dd01d5e
7 changed files with 42 additions and 25 deletions

View File

@ -21,7 +21,7 @@ jobs:
- name: Build - name: Build
run: | run: |
rustup update stable rustup update stable
cargo install --path . cargo install --debug --path .
# Removed because it caused a segmentation fault and would not stop executing. Testing should be done locally. # Removed because it caused a segmentation fault and would not stop executing. Testing should be done locally.
- name: Run tests - name: Run tests
run: cargo test --verbose run: cargo test --verbose

20
Cargo.lock generated
View File

@ -252,8 +252,8 @@ checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
[[package]] [[package]]
name = "els" name = "els"
version = "0.1.13-nightly.1" version = "0.1.13"
source = "git+https://github.com/erg-lang/erg-language-server?branch=main#e92f3aa0bae74b9b4d7c1d4335e1a776edf307e9" source = "git+https://github.com/erg-lang/erg?branch=main#754fb2da1374613f50da5ded05c95399dc76d798"
dependencies = [ dependencies = [
"erg_common", "erg_common",
"erg_compiler", "erg_compiler",
@ -273,8 +273,8 @@ dependencies = [
[[package]] [[package]]
name = "erg_common" name = "erg_common"
version = "0.6.1-nightly.1" version = "0.6.1"
source = "git+https://github.com/erg-lang/erg?branch=main#8353e811ed20ba55a87d05e91c1a2456b03928b0" source = "git+https://github.com/erg-lang/erg?branch=main#754fb2da1374613f50da5ded05c95399dc76d798"
dependencies = [ dependencies = [
"backtrace-on-stack-overflow", "backtrace-on-stack-overflow",
"hermit-abi", "hermit-abi",
@ -284,8 +284,8 @@ dependencies = [
[[package]] [[package]]
name = "erg_compiler" name = "erg_compiler"
version = "0.6.1-nightly.1" version = "0.6.1"
source = "git+https://github.com/erg-lang/erg?branch=main#8353e811ed20ba55a87d05e91c1a2456b03928b0" source = "git+https://github.com/erg-lang/erg?branch=main#754fb2da1374613f50da5ded05c95399dc76d798"
dependencies = [ dependencies = [
"erg_common", "erg_common",
"erg_parser", "erg_parser",
@ -293,8 +293,8 @@ dependencies = [
[[package]] [[package]]
name = "erg_parser" name = "erg_parser"
version = "0.6.1-nightly.1" version = "0.6.1"
source = "git+https://github.com/erg-lang/erg?branch=main#8353e811ed20ba55a87d05e91c1a2456b03928b0" source = "git+https://github.com/erg-lang/erg?branch=main#754fb2da1374613f50da5ded05c95399dc76d798"
dependencies = [ dependencies = [
"erg_common", "erg_common",
"unicode-xid 0.2.4", "unicode-xid 0.2.4",
@ -598,7 +598,7 @@ dependencies = [
[[package]] [[package]]
name = "py2erg" name = "py2erg"
version = "0.0.3" version = "0.0.4"
dependencies = [ dependencies = [
"erg_common", "erg_common",
"erg_compiler", "erg_compiler",
@ -607,7 +607,7 @@ dependencies = [
[[package]] [[package]]
name = "pylyzer" name = "pylyzer"
version = "0.0.3" version = "0.0.4"
dependencies = [ dependencies = [
"els", "els",
"erg_common", "erg_common",

View File

@ -15,20 +15,20 @@ members = [
] ]
[workspace.package] [workspace.package]
version = "0.0.3" version = "0.0.4"
authors = ["Shunsuke Shibayama <sbym1346@gmail.com>"] authors = ["Shunsuke Shibayama <sbym1346@gmail.com>"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
edition = "2021" edition = "2021"
repository = "https://github.com/mtshiba/pylyzer" repository = "https://github.com/mtshiba/pylyzer"
[workspace.dependencies] [workspace.dependencies]
# erg_common = "0.6.1-nightly.1" # erg_common = "0.6.1"
# erg_compiler = "0.6.1-nightly.1" # erg_compiler = "0.6.1"
# els = "0.1.13-nightly.1" # els = "0.1.13"
rustpython-parser = "0.1.2" rustpython-parser = "0.1.2"
erg_compiler = { git = "https://github.com/erg-lang/erg", branch = "main", features = ["py_compatible"] } erg_compiler = { git = "https://github.com/erg-lang/erg", branch = "main", features = ["py_compatible", "els"] }
erg_common = { git = "https://github.com/erg-lang/erg", branch = "main" } erg_common = { git = "https://github.com/erg-lang/erg", branch = "main", features = ["py_compatible", "els"] }
els = { git = "https://github.com/erg-lang/erg-language-server", branch = "main", features = ["py_compatible"] } els = { git = "https://github.com/erg-lang/erg", branch = "main", features = ["py_compatible"] }
[features] [features]
debug = ["erg_compiler/debug", "erg_common/debug", "py2erg/debug"] debug = ["erg_compiler/debug", "erg_common/debug", "py2erg/debug"]
@ -38,7 +38,7 @@ erg_compiler = { workspace = true }
erg_common = { workspace = true } erg_common = { workspace = true }
els = { workspace = true } els = { workspace = true }
rustpython-parser = { workspace = true } rustpython-parser = { workspace = true }
py2erg = { version = "0.0.3", path = "./crates/py2erg" } py2erg = { version = "0.0.4", path = "./crates/py2erg" }
[lib] [lib]
path = "src/lib.rs" path = "src/lib.rs"

View File

@ -3,7 +3,7 @@ use erg_common::error::{ErrorCore, ErrorKind, MultiErrorDisplay};
use erg_common::style::{BLUE, GREEN, RED, RESET, YELLOW}; use erg_common::style::{BLUE, GREEN, RED, RESET, YELLOW};
use erg_common::traits::{Runnable, Stream}; use erg_common::traits::{Runnable, Stream};
use erg_compiler::artifact::{BuildRunnable, Buildable, CompleteArtifact, IncompleteArtifact}; use erg_compiler::artifact::{BuildRunnable, Buildable, CompleteArtifact, IncompleteArtifact};
use erg_compiler::context::Context; use erg_compiler::context::ModuleContext;
use erg_compiler::erg_parser::ast::AST; use erg_compiler::erg_parser::ast::AST;
use erg_compiler::error::{CompileError, CompileErrors}; use erg_compiler::error::{CompileError, CompileErrors};
use erg_compiler::lower::ASTLowerer; use erg_compiler::lower::ASTLowerer;
@ -56,10 +56,10 @@ impl Buildable for PythonAnalyzer {
fn build(&mut self, code: String, mode: &str) -> Result<CompleteArtifact, IncompleteArtifact> { fn build(&mut self, code: String, mode: &str) -> Result<CompleteArtifact, IncompleteArtifact> {
self.analyze(code, mode) self.analyze(code, mode)
} }
fn pop_context(&mut self) -> Option<Context> { fn pop_context(&mut self) -> Option<ModuleContext> {
self.checker.pop_mod_ctx() self.checker.pop_mod_ctx()
} }
fn get_context(&self) -> Option<&Context> { fn get_context(&self) -> Option<&ModuleContext> {
Some(self.checker.get_mod_ctx()) Some(self.checker.get_mod_ctx())
} }
} }

View File

@ -1,17 +1,17 @@
use erg_common::error::ErrorKind; use erg_common::error::ErrorKind;
use erg_common::log; use erg_common::log;
// use erg_common::style::{remove_style, StyledString, Color}; // use erg_common::style::{remove_style, StyledString, Color};
use erg_compiler::context::Context; use erg_compiler::context::ModuleContext;
use erg_compiler::error::{CompileError, CompileErrors}; use erg_compiler::error::{CompileError, CompileErrors};
pub(crate) fn filter_errors(ctx: &Context, errors: CompileErrors) -> CompileErrors { pub(crate) fn filter_errors(ctx: &ModuleContext, errors: CompileErrors) -> CompileErrors {
errors errors
.into_iter() .into_iter()
.filter_map(|error| filter_error(ctx, error)) .filter_map(|error| filter_error(ctx, error))
.collect() .collect()
} }
fn filter_error(_ctx: &Context, error: CompileError) -> Option<CompileError> { fn filter_error(_ctx: &ModuleContext, error: CompileError) -> Option<CompileError> {
match error.core.kind { match error.core.kind {
ErrorKind::FeatureError => { ErrorKind::FeatureError => {
log!(err "this error is ignored:"); log!(err "this error is ignored:");

12
tests/func.py Normal file
View File

@ -0,0 +1,12 @@
def f(x: int):
for i in [1, 2, 3]:
x += i
print(x)
return x
i: int = f(1)
def g(x: int):
if True:
x = "a" # ERR
return x

View File

@ -43,6 +43,11 @@ fn exec_export() {
expect("tests/export.py", 0, 0); expect("tests/export.py", 0, 0);
} }
#[test]
fn exec_func() {
expect("tests/func.py", 0, 1);
}
#[test] #[test]
fn exec_class() { fn exec_class() {
expect("tests/class.py", 0, 1); expect("tests/class.py", 0, 1);