Skip to content

Commit a5e4dc5

Browse files
committed
Feedback
1 parent 761a69e commit a5e4dc5

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

conformance/results/pyre/classes_classvar.toml

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ notes = """
33
Does not reject use of TypeVar in ClassVar.
44
Does not reject use of ParamSpec in ClassVar.
55
Does not reject use of ClassVar as a generic type argument.
6-
Does not allow ClassVar to be used without an assigned value.
76
Does not reject use of ClassVar in parameter type annotation.
87
Does not reject use of ClassVar in local variable annotation.
98
Does not reject use of ClassVar in instance variable annotation.

conformance/tests/classes_classvar.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class ClassA(Generic[T, P]):
6363
good4: ClassVar = 3.1
6464
# > If the `ClassVar` qualifier is used without any assigned value, the type
6565
# > should be inferred as `Any`:
66-
good5: ClassVar
66+
good5: ClassVar #E? Type checkers may error on uninitialized ClassVar
6767
good6: Annotated[ClassVar[list[int]], ""] = []
6868

6969
def method1(self, a: ClassVar[int]): # E: ClassVar not allowed here

docs/spec/class-compat.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ is enforced by static checkers, but not at runtime.
3131
inferred as some type to which this value is :term:`assignable` (for example,
3232
``int``, ``Literal[2]``, or ``Any``).
3333

34-
If the ``ClassVar`` qualifier is used without any assigned value, the type
35-
should be inferred as :ref:`any`.
34+
If the bare ``ClassVar`` qualifier is used without any assigned value, the type
35+
should be inferred as :ref:`Any <any>`. Type checkers may error if no assigned
36+
value is present.
3637

3738
Type annotations can be used to annotate class and instance variables
3839
in class bodies and methods. In particular, the value-less notation ``a: int``

0 commit comments

Comments
 (0)