Skip to content

Commit f4f2952

Browse files
Conformance: annotate module protocol globals (#2318)
conformance: annotate module protocol globals The module protocol test should exercise structural compatibility without prescribing how type checkers infer unannotated module globals. Give the mutable attributes explicit public types so their protocol compatibility is unambiguous.
1 parent f051625 commit f4f2952

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

‎conformance/results/ty/protocols_modules.toml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ notes = """
44
Never considers a module as satisfying a protocol with a method member due to the fact that the method will never exist on the class `types.ModuleType`, only on a given specific module instance.
55
"""
66
errors_diff = """
7-
Line 25: Unexpected errors ["protocols_modules.py:25:17: error[invalid-assignment] Object of type `<module '_protocols_modules1'>` is not assignable to `Options1`"]
87
Line 47: Unexpected errors ["protocols_modules.py:47:18: error[invalid-assignment] Object of type `<module '_protocols_modules2'>` is not assignable to `Reporter1`"]
98
"""
109
output = """
11-
protocols_modules.py:25:17: error[invalid-assignment] Object of type `<module '_protocols_modules1'>` is not assignable to `Options1`
1210
protocols_modules.py:26:17: error[invalid-assignment] Object of type `<module '_protocols_modules1'>` is not assignable to `Options2`
1311
protocols_modules.py:47:18: error[invalid-assignment] Object of type `<module '_protocols_modules2'>` is not assignable to `Reporter1`
1412
protocols_modules.py:48:18: error[invalid-assignment] Object of type `<module '_protocols_modules2'>` is not assignable to `Reporter2`

‎conformance/tests/_protocols_modules1.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
Support file for protocols_modules.py test.
33
"""
44

5-
timeout = 100
6-
one_flag = True
7-
other_flag = False
5+
timeout: int = 100
6+
one_flag: bool = True
7+
other_flag: bool = False

0 commit comments

Comments
 (0)