Conversation
Typing conformance results improved 🎉The percentage of diagnostics emitted that were expected errors increased from 83.51% to 83.59%. The percentage of expected errors that received a diagnostic held steady at 74.33%. Summary
False positives removedDetails
|
|
Memory usage reportSummary
Significant changesClick to expand detailed breakdownflake8
trio
sphinx
prefect
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-argument-type |
0 | 0 | 19 |
unknown-argument |
0 | 0 | 15 |
type-assertion-failure |
0 | 0 | 11 |
unsupported-operator |
0 | 0 | 10 |
too-many-positional-arguments |
5 | 1 | 3 |
unresolved-attribute |
5 | 0 | 1 |
missing-argument |
0 | 4 | 0 |
| Total | 10 | 5 | 59 |
881d46c to
a670cf6
Compare
|
Does this fix astral-sh/ty#737 ? |
Hm, seems like this is already fixed on main? Like you wrote there:
|
|
astral-sh/ty#737 describes "incorrect descriptor lookup for types that are not disjoint from |
AlexWaygood
left a comment
There was a problem hiding this comment.
Nice! I think I remember @carljm saying that CPython itself does some similar special-casing deep in its internals to make method calls on None work (though I'm not familiar with it myself)
So ... But This is why |
* main: (209 commits) [ty] Defer base inference for functional `type(...)` classes (#22792) flake8-executable: allow global flags in uv shebangs (EXE003) (#22582) [ty] Add `replace-imports-with-any` option (#23122) Update html comments in mdtests (#23269) Apply ruff formatting to mdtests (#22935) [ty] Exclude test-related symbols from non-first-party packages in auto-import completions [ty] Refactor `CursorTest` helper to support site-packages [ty] Qualify inlay hint edit symbol when possibly referencing another variable (#23265) [ty] Avoid `UnionBuilder` overhead when creating a new union from the filtered elements of an existing union (#22352) [ty] Refactor TypedDict key assignment validation (#23262) [ty] Improve Python environment path documentation (#23256) [ty] loop control flow analysis using loop header definitions Prepare for 0.15.1 (#23253) Remove docker-run-action (#23254) [ty] Allow discovering dependencies in system Python environments (#22994) Ensure pending suppression diagnostics are reported (#23242) [`isort`] support for configurable import section heading comments (#23151) [ty] Fix method calls on subclasses of `Any` (#23248) [ty] Fix bound method access on `None` (#23246) Make range suppression test snapshot actually useful (#23251) ...
Summary
Just a small quick win that should fix the last remaining conformance test in
specialtypes_none.py.types.FunctionTypehas the following overloads for__get__to model accessing functions on a class vs. on an instance:The
instance: Nonesentinel of the descriptor protocol is problematic when we're actually accessing something on an instance of typeNone. Here, we simply add a special case to fix this. Also, instead of usingType::none(db)as a sentinel in the Rust code, we now useOptional<Type<…>>such that we can use the RustNoneif we want to call__get__on a non-instance.Fixes astral-sh/ty#737
Ecosystem
Looks good. Some strange-looking new diagnostics because symbols were inferred as
Nonewhere users did not intend that (but no wrong behavior of ty).Test Plan
Adapted existing tests.