← Open Source & Engineering Work
Meta Open Source · facebook/pyreflyMerged · Meta Pyrefly

Fix descriptor semantics for initialized annotations

Sole Author: Patrick Ribbsaeter · Immutable Commit SHA: 8387bfded3736532e1b6c1c124264711ea0c50bc

Rust static type-inference fix in Meta Pyrefly preserving __get__ and __set__ descriptor protocol binding when class attributes carry both type annotations and descriptor initializers.

Fix descriptor semantics for initialized annotations

Commit 8387bfd

Merged Mainline

8387bfd

Immutable Git SHA

Rust

Compiler

52/52 CI Green

CI & Test Matrix

01 · Engineering problem

The failure mode

Meta Pyrefly classified an annotated instance attribute as a class-installed descriptor whenever its type implemented __get__, even when the attribute was explicitly initialized on self in __init__.

02 · Technical response

What changed

  1. 01Used DeclaredByAnnotation's initialized_in_recognized_method signal in Rust to skip descriptor synthesis for method-initialized instance fields.
  2. 02Added conformance tests for annotated + __init__-assigned fields while preserving class-descriptor behavior.

03 · Verified outcome

Evidence-backed result

  • ✓Shipped upstream in meta/pyrefly at commit 8387bfded3736532e1b6c1c124264711ea0c50bc with zero mypy_primer regressions.

04 · Cryptographic Git record

Immutable source evidence

RustMeta PyreflyPython Type CheckerDescriptor SemanticsStatic Analysis

Independent open-source engineering authored solely by Patrick Ribbsaeter. Company and project names identify the public repository context only under nominative fair use. No employment, client, vendor, or partnership relationship is implied unless explicitly stated.