-
Couldn't load subscription status.
- Fork 163
Open
Copy link
Labels
Description
Describe the Bug
I have the following minimal reproducer:
import typing_extensions as te
class InheritFromMe(te.TypedDict):
foo: bool
class TestBadUnpackingError(InheritFromMe):
bar: bool
unpack_this: InheritFromMe = {"foo": True}
test1: TestBadUnpackingError = {"bar": True, **unpack_this}
test2: TestBadUnpackingError = {"bar": True, "foo": True}
print(f"{ test1 = }")
print(f"{ test2 = }")The output of the program is:
$ python test.py
test1 = {'bar': True, 'foo': True}
test2 = {'bar': True, 'foo': True}They're functionally equivalent, as far as I can tell. However, pyrefly reports the first as a bad-unpacking error:
$ pyrefly check test.py
ERROR Unpacked `TypedDict[InheritFromMe]` is not assignable to `TypedDict[TestBadUnpackingError]` [bad-unpacking]
--> /Users/macinburrito/GitLocal/Work/semaphore/test.py:13:48
|
13 | test1: TestBadUnpackingError = {"bar": True, **unpack_this}
| ^^^^^^^^^^^
|
INFO 1 errorI think that this shouldn't be a bad-unpacking error, but perhaps I'm missing some nuance of the type system here?
Sandbox Link
(Only applicable for extension issues) IDE Information
No response