Skip to content

Fix TSP None type encoding#4043

Open
WilliamK112 wants to merge 1 commit into
facebook:mainfrom
WilliamK112:codex/tsp-none-type-4035
Open

Fix TSP None type encoding#4043
WilliamK112 wants to merge 1 commit into
facebook:mainfrom
WilliamK112:codex/tsp-none-type-4035

Conversation

@WilliamK112

Copy link
Copy Markdown

Summary

Fixes #4035.

This changes Pyrefly's TSP conversion for None from an off-spec BuiltInType named none to a ClassType instance declared as types.NoneType. The protocol's BuiltInType.name contract only allows sentinel names such as unknown, any, ellipsis, never, and noreturn, so encoding None as a class keeps str | None and other unions reconstructable by TSP consumers.

The change also updates the TSP interaction coverage for x = None so the actual wire response is checked as a class declaration rather than a builtin sentinel.

Test Plan

  • cargo +stable-x86_64-pc-windows-gnu test -p pyrefly tsp::type_conversion::tests:: -- --nocapture
  • cargo +stable-x86_64-pc-windows-gnu test -p pyrefly test_get_computed_type_none_is_class -- --nocapture
  • cargo +stable-x86_64-pc-windows-gnu test -p pyrefly tsp::type_conversion::tests::test_function_declaration_resolves_special_function_via_export -- --exact --nocapture
  • RUSTUP_TOOLCHAIN=stable-x86_64-pc-windows-gnu python test.py --mode cargo --no-test --no-tensor-shapes --no-conformance --no-jsonschema
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TSP: None encoded as BuiltInType name:"none", violating the documented BuiltInType.name contract

2 participants