[red-knot] don't include Unknown in the type for a conditionally-defined import (#13563)

## Summary

Fixes the bug described in #13514 where an unbound public type defaulted
to the type or `Unknown`, whereas it should only be the type if unbound.

## Test Plan

Added a new test case

---------

Co-authored-by: Carl Meyer <carl@astral.sh>
This commit is contained in:
aditya pillai
2024-10-16 16:46:03 -04:00
committed by GitHub
parent 2095ea8372
commit ed4a0b34ba
10 changed files with 126 additions and 91 deletions

View File

@@ -28,6 +28,7 @@ else:
y = 5
s = y
x = y
reveal_type(x) # revealed: Literal[3, 4, 5]
reveal_type(r) # revealed: Unbound | Literal[2]
reveal_type(s) # revealed: Unbound | Literal[5]