Skip to content

Commit 4278e0d

Browse files
authored
Fix type checking errors from MyPy 1.11 (#910)
MyPy 1.11 seems to have greatly improved its ability to type check, but that also revealed a huge number of issues in the type hints used in the compiler. This PR fixes those type hints (hopefully).
1 parent 0d15dff commit 4278e0d

File tree

7 files changed

+173
-139
lines changed

7 files changed

+173
-139
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
### Added
99
* Added `:end-line` and `:end-col` metadata to forms during compilation (#903)
1010

11+
### Changed
12+
* Updated dozens of type annotations in the compiler to satisfy MyPy 1.11 (#910)
13+
1114
### Fixed
1215
* Fix a bug where `.` characters were not allowed in keyword names (#899)
1316
* Fix a bug where nested quotation marks were not escaped properly by various print functions and at the REPL (#894)

src/basilisp/lang/compiler/analyzer.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# pylint: disable=too-many-branches,too-many-lines,too-many-return-statements
2-
import ast
32
import builtins
43
import collections
54
import contextlib
@@ -616,7 +615,6 @@ def AnalyzerException(
616615
msg: str,
617616
form: Union[LispForm, None, ISeq] = None,
618617
lisp_ast: Optional[Node] = None,
619-
py_ast: Optional[ast.AST] = None,
620618
) -> CompilerException:
621619
"""Return a CompilerException annotated with the current filename and
622620
:analyzer compiler phase set. The remaining keyword arguments are passed
@@ -627,7 +625,6 @@ def AnalyzerException(
627625
filename=self.filename,
628626
form=form,
629627
lisp_ast=lisp_ast,
630-
py_ast=py_ast,
631628
)
632629

633630

src/basilisp/lang/compiler/exception.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class CompilerException(IExceptionInfo):
6363
filename: str
6464
form: Union[LispForm, None, ISeq] = None
6565
lisp_ast: Optional[Node] = None
66-
py_ast: Optional[ast.AST] = None
66+
py_ast: Optional[Union[ast.expr, ast.stmt]] = None
6767

6868
@property
6969
def data(self) -> IPersistentMap:

0 commit comments

Comments
 (0)