You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This program is found in cinder/3.8/Lib/test/test_compiler/test_static/tests.py. This test is labeled test_compile_checked_dict_with_annotation_wrong_key_type. There is a similar test labeled test_compile_checked_dict_with_annotation_wrong_value_type.
What happened?
compiler.errors.TypedSyntaxError: type mismatch: Exact[chkdict[object, Literal[42]]] cannot be assigned to Exact[chkdict[__main__.B, int]]
What should have happened?
We expected a compile-time error complaining that object cannot be assigned to B. In general, we expect that everytime the type checker sees x: CheckedDict[T1, T2] = { e1: e2, ... }, it checks every key expression e1 against T1, and every e2 against T2.
The text was updated successfully, but these errors were encountered:
carljm
changed the title
initialize CheckedDict variables with dictionary literals
better static checks on initializing CheckedDict variables with dictionary literals
Apr 7, 2022
a4a71ae
2021-12-20
What program did you run?
This program is found in
cinder/3.8/Lib/test/test_compiler/test_static/tests.py
. This test is labeledtest_compile_checked_dict_with_annotation_wrong_key_type
. There is a similar test labeledtest_compile_checked_dict_with_annotation_wrong_value_type
.What happened?
What should have happened?
We expected a compile-time error complaining that
object
cannot be assigned toB
. In general, we expect that everytime the type checker seesx: CheckedDict[T1, T2] = { e1: e2, ... }
, it checks every key expressione1
againstT1
, and everye2
againstT2
.The text was updated successfully, but these errors were encountered: