Skip to content

Commit 305dfc9

Browse files
migeed-zmeta-codesync[bot]
authored andcommitted
Mark forwarded Any assignment test as bug
Summary: We should preserve the declared annotation when reassigning from Any GitHub Issue: #2227 Reviewed By: ndmitchell Differential Revision: D99931585 fbshipit-source-id: 6a77e7203fcf374ab297728d6abe3338b34c3f10
1 parent 0b74efb commit 305dfc9

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

pyrefly/lib/test/assign.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,7 @@ assert_type(x, int)
991991
);
992992

993993
testcase!(
994+
bug = "Any assignment should not erase declared annotation",
994995
test_reassigned_var_does_not_preserve_annotation_over_any,
995996
r#"
996997
from typing import Any, assert_type
@@ -999,7 +1000,7 @@ def f() -> Any: ...
9991000
10001001
x: str = "hello"
10011002
x = f()
1002-
assert_type(x, Any)
1003+
assert_type(x, str) # E: assert_type(Any, str) failed
10031004
"#,
10041005
);
10051006

0 commit comments

Comments
 (0)