Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inline type narrowing #1873

Open
HoneyryderChuck opened this issue Jun 7, 2024 · 1 comment
Open

inline type narrowing #1873

HoneyryderChuck opened this issue Jun 7, 2024 · 1 comment

Comments

@HoneyryderChuck
Copy link
Contributor

Not sure, but I think some variations with case-statement of this work, but this does not:

# considering a @io typed as TCPSocket | SSLSocket

if @io.is_a?(SSLSocket) && @io.verify_hostname(host)
# the last statement fails because `TCPSocket | SSLSocket` does not define verify_hostname, only the latter
@ParadoxV5
Copy link
Contributor

Type checker limitation?

We can aid this for all checkers with

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants