1: ---
2: title: "Example"
3: ---
4:
5: This file contains some issues for the linter (static type checker) to identify.
6:
7: ```{python}
8: def add_numbers(a: int, b: int) -> int:
9: return a + b
10:
11: add_numbers(3, "5")
12: ```
13:
14: There's some more issues below...
15:
16: ```{python}
17: add_numbers(1, 4)
18:
19: add_numbers("apples", 8)
20: ```
pyrefly
Meta’s Rust-based static type checker (successor to Pyre).
Example Quarto .qmd
file:
Run pyrefly using lintquarto
lintquarto -l pyrefly -p typecheck_example.qmd
============================================================= Running pyrefly... ============================================================= ERROR Argument `Literal['5']` is not assignable to parameter `b` with type `int` in function `add_numbers` [bad-argument-type] --> /home/runner/work/lintquarto/lintquarto/docs/pages/tools/examples/typecheck_example.qmd:11:16 | 11 | add_numbers(3, "5") | ^^^ | ERROR Argument `Literal['apples']` is not assignable to parameter `a` with type `int` in function `add_numbers` [bad-argument-type] --> /home/runner/work/lintquarto/lintquarto/docs/pages/tools/examples/typecheck_example.qmd:19:13 | 19 | add_numbers("apples", 8) | ^^^^^^^^ |