rbs icon indicating copy to clipboard operation
rbs copied to clipboard

inline type narrowing

Open HoneyryderChuck opened this issue 1 year ago • 1 comments

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

HoneyryderChuck avatar Jun 07 '24 15:06 HoneyryderChuck

Type checker limitation?

We can aid this for all checkers with

  • #1822

ParadoxV5 avatar Jun 07 '24 19:06 ParadoxV5