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
Line 8: Unexpected errors ['dataclasses_final.py:8:4 Incompatible attribute type [8]: Attribute `final_classvar` declared in class `D` has type `Final[int]` but is used as type `int`.', 'dataclasses_final.py:8:4 Invalid type [31]: Expression `Final[int]` is not a valid type. Final cannot be nested.']
8
+
Line 13: Unexpected errors ['dataclasses_final.py:13:0 Incompatible parameter type [6]: In call `assert_type`, for 1st positional argument, expected `int` but got `Final[int]`.']
9
+
"""
10
+
output = """
11
+
dataclasses_final.py:8:4 Incompatible attribute type [8]: Attribute `final_classvar` declared in class `D` has type `Final[int]` but is used as type `int`.
12
+
dataclasses_final.py:8:4 Invalid type [31]: Expression `Final[int]` is not a valid type. Final cannot be nested.
13
+
dataclasses_final.py:13:0 Incompatible parameter type [6]: In call `assert_type`, for 1st positional argument, expected `int` but got `Final[int]`.
14
+
dataclasses_final.py:16:0 Incompatible attribute type [8]: Attribute `final_classvar` declared in class `D` has type `Final[int]` but is used as type `int`.
15
+
dataclasses_final.py:24:0 Invalid assignment [41]: Cannot reassign final attribute `d.final_no_default`.
16
+
dataclasses_final.py:25:0 Invalid assignment [41]: Cannot reassign final attribute `d.final_with_default`.
17
+
dataclasses_final.py:26:0 Invalid assignment [41]: Cannot reassign final attribute `D.final_no_default`.
18
+
dataclasses_final.py:27:0 Invalid assignment [41]: Cannot reassign final attribute `D.final_with_default`.
Line 8: Unexpected errors ['dataclasses_final.py:8:30 - error: "Final" is not allowed in this context', 'dataclasses_final.py:8:44 - error: Expression of type "Literal[4]" is incompatible with declared type "Final"']
8
+
Line 13: Unexpected errors ['dataclasses_final.py:13:13 - error: "assert_type" mismatch: expected "int" but received "Final" (reportAssertTypeFailure)']
9
+
"""
10
+
output = """
11
+
dataclasses_final.py:8:30 - error: "Final" is not allowed in this context
12
+
dataclasses_final.py:8:44 - error: Expression of type "Literal[4]" is incompatible with declared type "Final"
13
+
"Literal[4]" is incompatible with "Final" (reportAssignmentType)
14
+
dataclasses_final.py:13:13 - error: "assert_type" mismatch: expected "int" but received "Final" (reportAssertTypeFailure)
15
+
dataclasses_final.py:16:20 - error: Cannot assign to attribute "final_classvar" for class "type[D]"
16
+
"Literal[10]" is incompatible with "Final" (reportAttributeAccessIssue)
17
+
dataclasses_final.py:24:3 - error: Cannot assign to attribute "final_no_default" for class "D"
18
+
"final_no_default" is declared as Final and cannot be reassigned
19
+
Attribute "__set__" is unknown (reportAttributeAccessIssue)
20
+
dataclasses_final.py:25:3 - error: Cannot assign to attribute "final_with_default" for class "D"
21
+
"final_with_default" is declared as Final and cannot be reassigned
22
+
Attribute "__set__" is unknown (reportAttributeAccessIssue)
23
+
dataclasses_final.py:26:3 - error: Cannot assign to attribute "final_no_default" for class "type[D]"
24
+
"final_no_default" is declared as Final and cannot be reassigned
25
+
Attribute "__set__" is unknown (reportAttributeAccessIssue)
26
+
dataclasses_final.py:27:3 - error: Cannot assign to attribute "final_with_default" for class "type[D]"
27
+
"final_with_default" is declared as Final and cannot be reassigned
28
+
Attribute "__set__" is unknown (reportAttributeAccessIssue)
Line 8: Unexpected errors ['File "dataclasses_final.py", line 8, in D: Invalid use of typing.Final [final-error]', 'File "dataclasses_final.py", line 8, in D: Invalid type annotation \\'ClassVar[Final[int]]\\' [invalid-annotation]']
10
+
"""
11
+
output = """
12
+
File "dataclasses_final.py", line 8, in D: Invalid use of typing.Final [final-error]
13
+
File "dataclasses_final.py", line 8, in D: Invalid type annotation 'ClassVar[Final[int]]' [invalid-annotation]
14
+
File "dataclasses_final.py", line 25, in <module>: Assigning to attribute final_with_default, which was annotated with Final [final-error]
15
+
File "dataclasses_final.py", line 27, in <module>: Assigning to attribute final_with_default, which was annotated with Final [final-error]
@@ -690,6 +690,12 @@ <h3>Python Type System Conformance Test Results</h3>
690
690
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Incorrectly generates error when calling constructor of dataclass with descriptor.</p></span></div></th>
691
691
<thclass="column col2 not-conformant"><divclass="hover-text">Unsupported<spanclass="tooltip-text" id="bottom"><p>Does not understand descriptor objects in dataclass.</p></span></div></th>
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Wrongly requires a Final dataclass field to be initialized at class level.</p><p>Doesn't support Final nested inside ClassVar.</p></span></div></th>
695
+
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Doesn't support Final nested inside ClassVar.</p></span></div></th>
696
+
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Mis-handles Final nested inside ClassVar.</p></span></div></th>
697
+
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Doesn't handle Final nested inside ClassVar.</p></span></div></th>
0 commit comments