Skip to content

Stubs: wrong types for *ItemColors params, missing object functions, Any-typed object constants #53

Closed

Description

@b-re-w

Found by pythonx-compose while converting the Compose 1.11.1 Kotlin-name stubs (thisisthepy/pythonx-compose#12, PR #40):

  1. colors: <...>ItemColors parameters are annotated bool (10 sites: 9 in material3, 1 in foundation.layout _RowScope_NavigationBarItem) while the docstring says NavigationBarItemColors — a type-mapping defect.
  2. Kotlin object stubs carry constants but not functions (e.g. Arrangement.spacedBy), although the runtime serves them; mypy rejects what the runtime accepts.
  3. Object constants are all Any (Alignment.*, Arrangement.*); their declared return types are known (the same information Binder: describe() for named constants (STATIC_GETTER) without reading the value #36's describe(module, name) returns).
    (Python-keyword names such as None were fixed in Fix: Stub paths are case-unique; Python-keyword Kotlin names left out #49.)

Completion: unit tests for each; regenerated Compose stubs: no bool for a *Colors-typed parameter, Arrangement.spacedBy present on the Arrangement stub, Alignment.End annotated Alignment.Horizontal; tools/stubs/check-stubs.sh passes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions