diff --git a/CHANGELOG.md b/CHANGELOG.md index d763e55..adeb6c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,56 @@ # Changelog +## 0.0.1-alpha.13 + +### Bug fixes + +- Fix stack overflows related to mutually recursive protocols ([#19003](https://github.com/astral-sh/ruff/pull/19003)) +- Don't add incorrect subdiagnostic for `unresolved-reference` in `staticmethod`s and `classmethod`s ([#18487](https://github.com/astral-sh/ruff/pull/18487)) +- Fix rendering of long lines in diagnostic messages that are indented with tabs ([#18962](https://github.com/astral-sh/ruff/pull/18962)) +- Fix reachability of star import definitions for nonlocal lookups ([#19066](https://github.com/astral-sh/ruff/pull/19066)) + +### Typing semantics and features + +- Support variable-length tuples in unpacking assignments ([#18948](https://github.com/astral-sh/ruff/pull/18948)) +- Allow declared-only class-level attributes to be accessed on the class ([#19071](https://github.com/astral-sh/ruff/pull/19071)) +- Infer nonlocal types as unions of all reachable bindings ([#18750](https://github.com/astral-sh/ruff/pull/18750)) +- Use all reachable bindings for instance attributes and deferred lookups ([#18955](https://github.com/astral-sh/ruff/pull/18955)) +- Improve protocol member type checking and relation handling ([#18847](https://github.com/astral-sh/ruff/pull/18847)) +- Rework disjointness of protocol instances vs types with possibly unbound attributes, preventing some false instances of `Never` in `hasattr` narrowing ([#19043](https://github.com/astral-sh/ruff/pull/19043)) +- Make tuple instantiations sound ([#18987](https://github.com/astral-sh/ruff/pull/18987)) +- Add subdiagnostic about empty bodies in more cases ([#18942](https://github.com/astral-sh/ruff/pull/18942)) +- Improve type-inference for `__import__(name)` and `importlib.import_module(name)` ([#19008](https://github.com/astral-sh/ruff/pull/19008)) +- Eagerly evaluate certain constraints when analyzing control flow ([#18998](https://github.com/astral-sh/ruff/pull/18998), [#19044](https://github.com/astral-sh/ruff/pull/19044), [#19068](https://github.com/astral-sh/ruff/pull/19068)) +- Update typeshed stubs ([#19060](https://github.com/astral-sh/ruff/pull/19060)): [typeshed diff](https://github.com/python/typeshed/compare/ecd5141cc036366cc9e3ca371096d6a14b0ccd13...3f727b0cd6620b7fca45318dd34542b1e1c7dbfb) + +### Server + +- Add `builtins` to completions ([#18982](https://github.com/astral-sh/ruff/pull/18982)) +- Support LSP go-to with vendored typeshed stubs ([#19057](https://github.com/astral-sh/ruff/pull/19057)) + +### Documentation + +- The ty documentation is now available at [docs.astral.sh/ty](https://docs.astral.sh/ty) ([#744](https://github.com/astral-sh/ty/pull/744)) + +### Performance + +- Remove `ScopedExpressionId` ([#19019](https://github.com/astral-sh/ruff/pull/19019)) + +### Contributors + +- [@InSyncWithFoo](https://github.com/InSyncWithFoo) +- [@MatthewMckee4](https://github.com/MatthewMckee4) +- [@dcreager](https://github.com/dcreager) +- [@mtshiba](https://github.com/mtshiba) +- [@BurntSushi](https://github.com/BurntSushi) +- [@sharkdp](https://github.com/sharkdp) +- [@ibraheemdev](https://github.com/ibraheemdev) +- [@github-actions](https://github.com/github-actions) +- [@carljm](https://github.com/carljm) +- [@AlexWaygood](https://github.com/AlexWaygood) +- [@MichaReiser](https://github.com/MichaReiser) +- [@zanieb](https://github.com/zanieb) + ## 0.0.1-alpha.12 ### Bug fixes diff --git a/dist-workspace.toml b/dist-workspace.toml index f076c30..ace0a22 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -1,7 +1,7 @@ [workspace] members = ["cargo:./ruff"] packages = ["ty"] -version = "0.0.1-alpha.12" +version = "0.0.1-alpha.13" # Config for 'dist' [dist] diff --git a/docs/reference/rules.md b/docs/reference/rules.md index 3bc95ad..39e6065 100644 --- a/docs/reference/rules.md +++ b/docs/reference/rules.md @@ -138,8 +138,7 @@ class M2(type): ... class A(metaclass=M1): ... class B(metaclass=M2): ... -**TypeError: metaclass conflict** - +# TypeError: metaclass conflict class C(A, B): ... ``` @@ -166,8 +165,7 @@ inherits from itself. **Examples** ```python -**foo.pyi** - +# foo.pyi class A(B): ... class B(A): ... ``` @@ -195,8 +193,7 @@ Class definitions with duplicate bases raise `TypeError` at runtime. ```python class A: ... -**TypeError: duplicate base class** - +# TypeError: duplicate base class class B(A, A): ... ``` @@ -326,8 +323,7 @@ Classes with an inconsistent MRO will raise a `TypeError` at runtime. class A: ... class B(A): ... -**TypeError: Cannot create a consistent method resolution order** - +# TypeError: Cannot create a consistent method resolution order class C(A, B): ... ``` @@ -397,8 +393,7 @@ class A: class B: __slots__ = ("a", "b") # Even if the values are the same -**TypeError: multiple bases have instance lay-out conflict** - +# TypeError: multiple bases have instance lay-out conflict class C(A, B): ... ``` @@ -420,8 +415,7 @@ class B: class C: __slots__ = ("a", "b") -**fine** - +# fine class D(A, B, C): ... ``` @@ -571,8 +565,7 @@ Such a statement will raise `TypeError` at runtime. **Examples** ```python -**TypeError: 'int' object does not support the context manager protocol** - +# TypeError: 'int' object does not support the context manager protocol with 1: print(2) ``` @@ -669,8 +662,7 @@ from typing import Generic, TypeVar T = TypeVar("T") # okay -**error: class uses both PEP-695 syntax and legacy syntax** - +# error: class uses both PEP-695 syntax and legacy syntax class C[U](Generic[T]): ... ``` @@ -703,8 +695,7 @@ T = TypeVar("T") # okay Q = TypeVar("S") # error: TypeVar name must match the variable it's assigned to T = TypeVar("T") # error: TypeVars should not be redefined -**error: TypeVar must be immediately assigned to a variable** - +# error: TypeVar must be immediately assigned to a variable def f(t: TypeVar("U")): ... ``` @@ -736,8 +727,7 @@ as `type.__new__`. ```python def f(): ... -**TypeError: f() takes 0 positional arguments but 3 were given** - +# TypeError: f() takes 0 positional arguments but 3 were given class B(metaclass=f): ... ``` @@ -1145,8 +1135,7 @@ T = TypeVar('T', str) # invalid constrained TypeVar Use instead: ```python T = TypeVar('T', str, int) # valid constrained TypeVar -**or** - +# or T = TypeVar('T', bound=str) # valid bound TypeVar ``` @@ -1737,15 +1726,13 @@ or `ImportError` at runtime. **Examples** ```python -**module.py** - +# module.py import datetime if datetime.date.today().weekday() != 6: a = 1 -**main.py** - +# main.py from module import a # ImportError: cannot import name 'a' from 'module' ``` diff --git a/pyproject.toml b/pyproject.toml index 32140f6..f3653a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ty" -version = "0.0.1a12" +version = "0.0.1a13" requires-python = ">=3.8" dependencies = [] description = "An extremely fast Python type checker, written in Rust." diff --git a/ruff b/ruff index 4e4e428..f76d3f8 160000 --- a/ruff +++ b/ruff @@ -1 +1 @@ -Subproject commit 4e4e428a95cde7c47bb8437b98db2541e6fd9625 +Subproject commit f76d3f87cfbfd8953087c521f36533f94f3b7304 diff --git a/uv.lock b/uv.lock index d42646e..9502a15 100644 --- a/uv.lock +++ b/uv.lock @@ -762,7 +762,7 @@ wheels = [ [[package]] name = "ty" -version = "0.0.1a12" +version = "0.0.1a13" source = { editable = "." } [package.dev-dependencies]