ruff/crates/ty_python_semantic/resources/mdtest
David Peter f76d3f87cf
Some checks are pending
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks-instrumented (push) Blocked by required conditions
CI / benchmarks-walltime (push) Blocked by required conditions
[ty Playground] Release / publish (push) Waiting to run
[ty] Allow declared-only class-level attributes to be accessed on the class (#19071)
## Summary

Allow declared-only class-level attributes to be accessed on the class:
```py
class C:
    attr: int

C.attr  # this is now allowed
``` 

closes https://github.com/astral-sh/ty/issues/384
closes https://github.com/astral-sh/ty/issues/553

## Ecosystem analysis


* We see many removed `unresolved-attribute` false-positives for code
that makes use of sqlalchemy, as expected (see changes for `prefect`)
* We see many removed `call-non-callable` false-positives for uses of
`pytest.skip` and similar, as expected
* Most new diagnostics seem to be related to cases like the following,
where we previously inferred `int` for `Derived().x`, but now we infer
`int | None`. I think this should be a
conflicting-declarations/bad-override error anyway? The new behavior may
even be preferred here?
  ```py
  class Base:
      x: int | None
  
  
  class Derived(Base):
      def __init__(self):
          self.x: int = 1
  ```
2025-07-02 18:03:56 +02:00
..
annotations [ty] Emit error for invalid binary operations in type expressions (#18991) 2025-06-30 10:06:01 +02:00
assignment [ty] Homogeneous and mixed tuples (#18600) 2025-06-20 18:23:54 -04:00
binary [ty] Homogeneous and mixed tuples (#18600) 2025-06-20 18:23:54 -04:00
boolean Revert "[ty] Better control flow for boolean expressions that are inside if (#18010)" (#18150) 2025-05-17 08:27:32 -04:00
boundness_declaredness Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
call [ty] Allow declared-only class-level attributes to be accessed on the class (#19071) 2025-07-02 18:03:56 +02:00
class Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
comparison [ty] Fix binary intersection comparison inference logic (#18266) 2025-05-23 12:55:17 +02:00
comprehensions
conditional [ty] Improve disjointness inference for NominalInstanceTypes and SubclassOfTypes (#18864) 2025-06-24 20:27:37 +00:00
declaration [ty] Format conflicting types as an enumeration (#18956) 2025-06-26 14:29:33 +02:00
diagnostics [ty] Surface matched overload diagnostic directly (#18452) 2025-06-20 08:36:49 +05:30
directives [ty] Fix normalization of unions containing instances parameterized with unions (#18112) 2025-05-14 22:48:33 -04:00
doc ty_python_semantic: add union type context to function call type errors 2025-05-09 13:40:51 -04:00
exception [ty] support del statement and deletion of except handler names (#18593) 2025-06-12 07:44:42 -07:00
expression [ty] Make tuple instantiations sound (#18987) 2025-06-27 19:37:16 +01:00
function [ty] Add diagnosis for function with no return statement but with return type annotation (#18359) 2025-05-29 23:17:18 +00:00
generics [ty] Improve protocol member type checking and relation handling (#18847) 2025-06-29 10:46:33 +00:00
ide_support [ty] Minor tweaks to "list all members" docs and tests (#18388) 2025-05-30 13:36:57 -04:00
import [ty] Model reachability of star import definitions for nonlocal lookups (#19066) 2025-07-01 11:06:37 +02:00
literal [ty] Understand classes that inherit from subscripted Protocol[] as generic (#17832) 2025-05-09 17:39:15 +01:00
loops
narrow [ty] Eagerly simplify 'True' and 'False' constraints (#18998) 2025-06-30 13:11:52 +02:00
regression
scopes [ty] Infer nonlocal types as unions of all reachable bindings (#18750) 2025-06-26 12:24:40 +02:00
shadowing
snapshots [ty] Update docs links (#19092) 2025-07-02 17:34:56 +02:00
stubs [ty] Do not carry the generic context of Protocol or Generic in the ClassBase enum (#17989) 2025-05-22 21:37:03 -04:00
subscript [ty] Fix false positives when subscripting an object inferred as having an Intersection type (#18920) 2025-06-24 18:39:02 +00:00
suppressions
type_compendium [ty] Make tuple instantiations sound (#18987) 2025-06-27 19:37:16 +01:00
type_of Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
type_properties [ty] Emit error for invalid binary operations in type expressions (#18991) 2025-06-30 10:06:01 +02:00
type_qualifiers [ty] Allow declared-only class-level attributes to be accessed on the class (#19071) 2025-07-02 18:03:56 +02:00
unary Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
with [ty] Add hint if async context manager is used in non-async with statement (#18299) 2025-05-26 21:34:47 +02:00
.mdformat.toml
attributes.md [ty] Allow declared-only class-level attributes to be accessed on the class (#19071) 2025-07-02 18:03:56 +02:00
cycle.md [ty] Add cycle handling for unpacking targets (#18078) 2025-05-13 21:27:48 +00:00
dataclass_transform.md [ty] Detect overloads decorated with @dataclass_transform (#17835) 2025-05-07 15:51:13 +02:00
dataclasses.md [ty] Allow declared-only class-level attributes to be accessed on the class (#19071) 2025-07-02 18:03:56 +02:00
decorators.md ty_python_semantic: add union type context to function call type errors 2025-05-09 13:40:51 -04:00
del.md [ty] support del statement and deletion of except handler names (#18593) 2025-06-12 07:44:42 -07:00
descriptor_protocol.md [ty] Add support for @staticmethods (#18809) 2025-06-20 10:38:17 +02:00
final.md
instance_layout_conflict.md [ty] Improve disjointness inference for NominalInstanceTypes and SubclassOfTypes (#18864) 2025-06-24 20:27:37 +00:00
intersection_types.md [ty] eliminate is_fully_static (#18799) 2025-06-24 18:02:05 -07:00
invalid_syntax.md
known_constants.md
mdtest_config.md
mdtest_custom_typeshed.md [ty] Fix duplicate diagnostics for unresolved module when an import from statement imports multiple members (#17886) 2025-05-06 12:37:10 +01:00
metaclass.md Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
mro.md [ty] Implement implicit inheritance from Generic[] for PEP-695 generic classes (#18283) 2025-05-26 20:40:16 +01:00
named_tuple.md [ty] Add generic inference for dataclasses (#18443) 2025-06-03 09:59:43 -07:00
overloads.md [ty] Add support for @staticmethods (#18809) 2025-06-20 10:38:17 +02:00
pep695_type_aliases.md [ty] Support typing.TypeAliasType (#18156) 2025-05-19 16:36:49 +02:00
properties.md ty_python_semantic: add union type context to function call type errors 2025-05-09 13:40:51 -04:00
protocols.md [ty] Allow declared-only class-level attributes to be accessed on the class (#19071) 2025-07-02 18:03:56 +02:00
public_types.md [ty] Infer nonlocal types as unions of all reachable bindings (#18750) 2025-06-26 12:24:40 +02:00
statically_known_branches.md [ty] Infer nonlocal types as unions of all reachable bindings (#18750) 2025-06-26 12:24:40 +02:00
sys_platform.md
sys_version_info.md
terminal_statements.md [ty] Model reachability of star import definitions for nonlocal lookups (#19066) 2025-07-01 11:06:37 +02:00
type_api.md [ty] eliminate is_fully_static (#18799) 2025-06-24 18:02:05 -07:00
typed_dict.md
union_types.md [ty] eliminate is_fully_static (#18799) 2025-06-24 18:02:05 -07:00
unpacking.md [ty] Support variable-length tuples in unpacking assignments (#18948) 2025-06-27 15:29:04 -04:00
unreachable.md [ty] Infer nonlocal types as unions of all reachable bindings (#18750) 2025-06-26 12:24:40 +02:00