Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
mtshiba committed Apr 29, 2024
1 parent 70c2390 commit b35a26b
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 29 deletions.
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ edition = "2021"
repository = "https://github.com/mtshiba/pylyzer"

[workspace.dependencies]
erg_common = { version = "0.6.33-nightly.2", features = ["py_compat", "els"] }
erg_compiler = { version = "0.6.33-nightly.2", features = ["py_compat", "els"] }
els = { version = "0.1.45-nightly.2", features = ["py_compat"] }
erg_common = { version = "0.6.36-nightly.0", features = ["py_compat", "els"] }
erg_compiler = { version = "0.6.36-nightly.0", features = ["py_compat", "els"] }
els = { version = "0.1.48-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.3.1", features = ["all-nodes-with-ranges", "location"] }
Expand Down
14 changes: 7 additions & 7 deletions crates/py2erg/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ use erg_common::traits::{Locational, Stream};
use erg_common::{log, set};
use erg_compiler::artifact::IncompleteArtifact;
use erg_compiler::erg_parser::ast::{
Accessor, Args, Array, BinOp, Block, ClassAttr, ClassAttrs, ClassDef, ConstAccessor, ConstArgs,
Accessor, Args, List, BinOp, Block, ClassAttr, ClassAttrs, ClassDef, ConstAccessor, ConstArgs,
ConstAttribute, ConstDict, ConstExpr, ConstKeyValue, ConstPosArg, Decorator, Def, DefBody,
DefId, DefaultParamSignature, Dict, Dummy, Expr, Identifier, KeyValue, KwArg, Lambda,
LambdaSignature, Literal, Methods, Module, NonDefaultParamSignature, NormalArray, NormalDict,
LambdaSignature, Literal, Methods, Module, NonDefaultParamSignature, NormalList, NormalDict,
NormalRecord, NormalSet, NormalTuple, ParamPattern, ParamTySpec, Params, PosArg,
PreDeclTypeSpec, ReDef, Record, RecordAttrs, Set, Signature, SubrSignature, SubrTypeSpec,
Tuple, TupleTypeSpec, TypeAscription, TypeBoundSpecs, TypeSpec, TypeSpecWithOp, UnaryOp,
VarName, VarPattern, VarRecordAttr, VarRecordAttrs, VarRecordPattern, VarSignature,
VisModifierSpec, ArrayComprehension, SetComprehension,
VisModifierSpec, ListComprehension, SetComprehension,
};
use erg_compiler::erg_parser::desugar::Desugarer;
use erg_compiler::erg_parser::token::{Token, TokenKind, COLON, DOT, EQUAL};
Expand Down Expand Up @@ -100,7 +100,7 @@ fn escape_name(name: String) -> String {
"complex" => "Complex".into(),
"str" => "Str".into(),
"bool" => "Bool".into(),
"list" => "GenericArray".into(),
"list" => "GenericList".into(),
"bytes" => "Bytes".into(),
// "range" => "GenericRange".into(),
"dict" => "GenericDict".into(),
Expand Down Expand Up @@ -794,7 +794,7 @@ impl ASTConverter {
ConstExpr::Accessor(ConstAccessor::Local(Identifier::private("global".into())));
let acc = ConstAccessor::Attr(ConstAttribute::new(
global,
Identifier::private("Array!".into()),
Identifier::private("List!".into()),
));
TypeSpec::poly(acc, ConstArgs::new(vec![elem_t, len], None, vec![], None, None))
}
Expand Down Expand Up @@ -1148,7 +1148,7 @@ impl ASTConverter {
.map(|ex| PosArg::new(self.convert_expr(ex)))
.collect::<Vec<_>>();
let elems = Args::pos_only(elements, None);
let arr = Expr::Array(Array::Normal(NormalArray::new(l_sqbr, r_sqbr, elems)));
let arr = Expr::List(List::Normal(NormalList::new(l_sqbr, r_sqbr, elems)));
Self::mutate_expr(arr)
}
py_ast::Expr::ListComp(comp) => {
Expand All @@ -1168,7 +1168,7 @@ impl ASTConverter {
.next()
.map(|ex| self.convert_expr(ex));
let generators = vec![(ident, iter)];
let arr = Expr::Array(Array::Comprehension(ArrayComprehension::new(l_sqbr, r_sqbr, Some(layout), generators, guard)));
let arr = Expr::List(List::Comprehension(ListComprehension::new(l_sqbr, r_sqbr, Some(layout), generators, guard)));
Self::mutate_expr(arr)
}
py_ast::Expr::Set(set) => {
Expand Down
2 changes: 1 addition & 1 deletion src/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use erg_common::traits::{New, ExitStatus, Runnable, Stream};
use erg_common::Str;
use erg_compiler::GenericHIRBuilder;
use erg_compiler::artifact::{BuildRunnable, Buildable, CompleteArtifact, IncompleteArtifact};
use erg_compiler::build_package::{GenericPackageBuilder, CheckStatus};
use erg_compiler::build_package::{CheckStatus, GenericPackageBuilder};
use erg_compiler::context::ModuleContext;
use erg_compiler::erg_parser::ast::{Module, AST};
use erg_compiler::erg_parser::build_ast::ASTBuildable;
Expand Down
6 changes: 4 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,12 @@ pub(crate) fn parse_args() -> ErgConfig {
ownership_check: false,
..ErgConfig::default()
};
let mut runtime_args: Vec<&'static str> = Vec::new();
while let Some(arg) = args.next() {
match &arg[..] {
"--" => {
for arg in args {
cfg.runtime_args.push(Box::leak(arg.into_boxed_str()));
runtime_args.push(Box::leak(arg.into_boxed_str()));
}
break;
}
Expand Down Expand Up @@ -131,12 +132,13 @@ For more information try `pylyzer --help`"
);
if let Some("--") = args.next().as_ref().map(|s| &s[..]) {
for arg in args {
cfg.runtime_args.push(Box::leak(arg.into_boxed_str()));
runtime_args.push(Box::leak(arg.into_boxed_str()));
}
}
break;
}
}
}
cfg.runtime_args = runtime_args.into();
cfg
}
File renamed without changes.
16 changes: 12 additions & 4 deletions tests/test.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use std::path::PathBuf;
use std::path::{Path, PathBuf};

use erg_common::config::ErgConfig;
use erg_common::io::Input;
use erg_common::spawn::exec_new_thread;
use erg_common::traits::Stream;
use erg_compiler::artifact::{CompleteArtifact, IncompleteArtifact};
use pylyzer::PythonAnalyzer;

Expand Down Expand Up @@ -61,6 +60,15 @@ fn exec_test() -> Result<(), String> {

#[test]
fn exec_import() -> Result<(), String> {
if Path::new("tests/__pycache__").exists() {
std::fs::remove_dir_all("tests/__pycache__").unwrap();
}
if Path::new("tests/foo/__pycache__").exists() {
std::fs::remove_dir_all("tests/foo/__pycache__").unwrap();
}
if Path::new("tests/bar/__pycache__").exists() {
std::fs::remove_dir_all("tests/bar/__pycache__").unwrap();
}
expect("tests/import.py", 1, 2)
}

Expand Down Expand Up @@ -110,8 +118,8 @@ fn exec_casting() -> Result<(), String> {
}

#[test]
fn exec_collections() -> Result<(), String> {
expect("tests/collections.py", 0, 4)
fn exec_collection() -> Result<(), String> {
expect("tests/collection.py", 0, 4)
}

#[test]
Expand Down

0 comments on commit b35a26b

Please sign in to comment.