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
{{ message }}
Repository navigation
Commit a2e6356
Browse filesBrowse the repository at this point in the historyBrowse files
Update typeddicts_class_syntax.py test to use a custom metaclass. (#2327)
The TypedDict chapter of the spec says:
> It is also invalid to specify a custom metaclass.
It looks like most type checkers interpret this to mean that the
appearance of `metaclass=...` is illegal in a TypedDict definition.
Pyrefly interprets this to mean that a non-`type` metaclass is
illegal, so a redundant `metaclass=type` is fine.
IMO either interpretation is defensible, but the conformance test
currently uses `metaclass=type`, which only accommodates the first.
This PR changes the test to use a non-`type` metaclass, which is
unambiguously an error.
This doesn't actually change pyrefly's conformance results because
pyrefly has a bug that causes it to emit a different, nonsensical
error on the `metaclass=type` line, which was mistakenly taken as
pyrefly passing the test. I'm in the process of fixing that bug,
which is how I discovered that pyrefly behaves slightly differently
from the other checkers here.
Copy file name to clipboardExpand all lines: conformance/results/pyrefly/typeddicts_class_syntax.toml
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ output = """
6
6
ERROR typeddicts_class_syntax.py:30:9-16: TypedDict members must be declared in the form `field: Annotation` with no assignment [bad-class-definition]
7
7
ERROR typeddicts_class_syntax.py:35:9-16: TypedDict members must be declared in the form `field: Annotation` with no assignment [bad-class-definition]
8
8
ERROR typeddicts_class_syntax.py:40:9-16: TypedDict members must be declared in the form `field: Annotation` with no assignment [bad-class-definition]
9
-
ERROR typeddicts_class_syntax.py:45:7-20: Metaclass of `BadTypedDict2` has type `type[Any]` that is not a simple class type [invalid-inheritance]
10
-
ERROR typeddicts_class_syntax.py:50:7-20: TypedDict does not support keyword argument `other` [bad-typed-dict]
11
-
ERROR typeddicts_class_syntax.py:65:17-32: No matching overload found for function `ConditionalField.__init__` called with arguments: (x=Literal[1], y=Literal[2], z=Literal[3]) [no-matching-overload]
9
+
ERROR typeddicts_class_syntax.py:49:7-20: Typed dictionary definitions may not specify a metaclass [invalid-inheritance]
10
+
ERROR typeddicts_class_syntax.py:54:7-20: TypedDict does not support keyword argument `other` [bad-typed-dict]
11
+
ERROR typeddicts_class_syntax.py:69:17-32: No matching overload found for function `ConditionalField.__init__` called with arguments: (x=Literal[1], y=Literal[2], z=Literal[3]) [no-matching-overload]
0 commit comments