diff --git a/Makefile b/Makefile index dc07094..ac1bf09 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ typecheck: venv/.done venv/bin/mypy --strict phasm tests/integration/runners.py venv/.done: requirements.txt - python3.8 -m venv venv + python3.10 -m venv venv venv/bin/python3 -m pip install wheel pip --upgrade venv/bin/python3 -m pip install -r $^ touch $@ diff --git a/README.md b/README.md index c9cb056..a5af8d8 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This is a hobby project for now. Use at your own risk. How to run ---------- -You should only need make and python3. Currently, we're working with python3.8, +You should only need make and python3. Currently, we're working with python3.10, since we're using the python ast parser, it might not work on other versions. To run the examples: @@ -32,7 +32,7 @@ make lint typecheck To compile a Phasm file: ```sh -python3.8 -m phasm source.py output.wat +python3.10 -m phasm source.py output.wat ``` Additional required tools diff --git a/phasm/parser.py b/phasm/parser.py index ae02172..81ddbe8 100644 --- a/phasm/parser.py +++ b/phasm/parser.py @@ -539,7 +539,7 @@ class OurVisitor: if not isinstance(node.value, ast.Name): _raise_static_error(node, 'Must reference a name') - if not isinstance(node.slice, ast.Index): + if isinstance(node.slice, ast.Slice): _raise_static_error(node, 'Must subscript using an index') if not isinstance(node.ctx, ast.Load): @@ -556,7 +556,7 @@ class OurVisitor: _raise_static_error(node, f'Undefined variable {node.value.id}') slice_expr = self.visit_Module_FunctionDef_expr( - module, function, our_locals, node.slice.value, + module, function, our_locals, node.slice, ) return Subscript(varref, slice_expr) @@ -593,11 +593,11 @@ class OurVisitor: if isinstance(node, ast.Subscript): if not isinstance(node.value, ast.Name): _raise_static_error(node, 'Must be name') - if not isinstance(node.slice, ast.Index): + if isinstance(node.slice, ast.Slice): _raise_static_error(node, 'Must subscript using an index') # FIXME: Do we use type level length? - if not isinstance(node.slice.value, ast.Constant): + if not isinstance(node.slice, ast.Constant): _raise_static_error(node, 'Must subscript using a constant index') - if not isinstance(node.slice.value.value, int): + if not isinstance(node.slice.value, int): _raise_static_error(node, 'Must subscript using a constant integer index') if not isinstance(node.ctx, ast.Load): _raise_static_error(node, 'Must be load context') diff --git a/requirements.txt b/requirements.txt index d29e53c..64dce30 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,10 @@ -mypy==0.812 +mypy==0.991 pygments==2.12.0 -pylint==2.7.4 -pytest==6.2.2 +pylint==2.15.9 +pytest==7.2.0 pytest-integration==0.2.2 pywasm==1.0.7 pywasm3==0.5.0 wasmer==1.1.0 wasmer_compiler_cranelift==1.1.0 -wasmtime==0.36.0 +wasmtime==3.0.0 diff --git a/tests/integration/runners.py b/tests/integration/runners.py index c87942f..91a29fd 100644 --- a/tests/integration/runners.py +++ b/tests/integration/runners.py @@ -162,7 +162,7 @@ class RunnerPywasm3(RunnerBase): memory = self.rtime.get_memory(0) for idx, byt in enumerate(data): - memory[offset + idx] = byt # type: ignore + memory[offset + idx] = byt def interpreter_read_memory(self, offset: int, length: int) -> bytes: memory = self.rtime.get_memory(0)