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
# error: [invalid-argument-type] "Invalid argument to `reveal_protocol_interface`: Only protocol classes can be passed to `reveal_protocol_interface`"
408
424
reveal_protocol_interface(int)
409
425
# error: [invalid-argument-type] "Argument to function `reveal_protocol_interface` is incorrect: Expected `type`, found `Literal["foo"]`"
410
426
reveal_protocol_interface("foo")
427
+
```
411
428
412
-
#TODO: this should be a `revealed-type` diagnostic rather than `invalid-argument-type`, and it should reveal `{"__abs__": MethodMember(`(self) -> int`)}` for the protocol interface
413
-
#
414
-
# error: [invalid-argument-type] "Invalid argument to `reveal_protocol_interface`: Only protocol classes can be passed to `reveal_protocol_interface`"
429
+
Similar to the way that `typing.is_protocol` returns `False` at runtime for all generic aliases,
430
+
`typing.get_protocol_members` raises an exception at runtime if you pass it a generic alias, so we
431
+
do not implement any special handling for generic aliases passed to the function.
432
+
`ty_extensions.reveal_protocol_interface` can be used on both, however:
433
+
434
+
```py
435
+
#TODO: these fail at runtime, but we don't emit `[invalid-argument-type]` diagnostics
436
+
# currently due to https://github.com/astral-sh/ty/issues/116
0 commit comments