Skip to content

fix(stubgen): regenerate type_checking_or_guard snapshot for Literal import#4173

Closed
samwgoldman wants to merge 1 commit into
mainfrom
fix-stubgen-type-checking-guard
Closed

fix(stubgen): regenerate type_checking_or_guard snapshot for Literal import#4173
samwgoldman wants to merge 1 commit into
mainfrom
fix-stubgen-type-checking-guard

Conversation

@samwgoldman

Copy link
Copy Markdown
Member

Problem

stubgen::tests::test_stubgen_type_checking_or_guard panics on main. The type_checking_or_guard snapshot referenced Literal[True] without importing Literal (an invalid stub). Once #4144 made stubgen emit from typing import Literal when it adds a Literal[...] annotation, this fixture went stale and the snapshot assertion started failing.

Fix

Regenerate the type_checking_or_guard expected.pyi to include the now-emitted from typing import Literal, keeping the # @generated header used by the other fixtures. This is a pure test-fixture update — no stubgen logic change.

Testing

cargo test --lib -p pyrefly stubgen:: → all 24 stubgen tests pass (was 1 failing).

🤖 Generated with Claude Code

…import

#4144 made stubgen emit `from typing import Literal` whenever it adds a
`Literal[...]` annotation, but the `type_checking_or_guard` fixture was not
regenerated. Its `expected.pyi` used `Literal[True]` without importing
`Literal` (an invalid stub), so the snapshot test panicked on trunk.

Update the fixture to the now-correct output, which includes the emitted
`from typing import Literal`, keeping the `# @generated` header used by the
other fixtures.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@meta-codesync

meta-codesync Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@samwgoldman has imported this pull request. If you are a Meta employee, you can view this in D112434885.

@github-actions

Copy link
Copy Markdown

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@kinto0 kinto0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

@meta-codesync meta-codesync Bot closed this in 2935171 Jul 16, 2026
@meta-codesync meta-codesync Bot added the Merged label Jul 17, 2026
@meta-codesync

meta-codesync Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@samwgoldman merged this pull request in 2935171.

@kinto0
kinto0 deleted the fix-stubgen-type-checking-guard branch July 17, 2026 16:48
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.

2 participants