[ty] Improve rendering of default values for function args (#22010)
## Summary We're actually quite good at computing this but the main issue is just that we compute it at the type-level and so wrap it in `Literal[...]`. So just special-case the rendering of these to omit `Literal[...]` and fallback to `...` in cases where the thing we'll show is probably useless (i.e. `x: str = str`). Fixes https://github.com/astral-sh/ty/issues/1882
This commit is contained in:
@@ -97,7 +97,7 @@ inside the module:
|
||||
import typing
|
||||
|
||||
reveal_type(typing.__name__) # revealed: str
|
||||
reveal_type(typing.__init__) # revealed: bound method ModuleType.__init__(name: str, doc: str | None = EllipsisType) -> None
|
||||
reveal_type(typing.__init__) # revealed: bound method ModuleType.__init__(name: str, doc: str | None = ...) -> None
|
||||
|
||||
# For a stub module, we don't know that `__file__` is a string (at runtime it may be entirely
|
||||
# unset, but we follow typeshed here):
|
||||
|
||||
Reference in New Issue
Block a user