From 1b92ca74b8f39b4313279e30adb99e35fd35c0e8 Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Thu, 21 May 2026 15:37:52 +0900 Subject: [PATCH 1/2] Split socket nonblock methods into exception: overloads The `exception:` keyword of the non-blocking socket methods selects the return value: the normal result when `exception: true` (the default), or a `:wait_readable` / `:wait_writable` symbol when `exception: false`. Express this with `true`/`false` literal overloads instead of a single `?exception: boolish` parameter with a union return type. --- stdlib/socket/0/basic_socket.rbs | 9 ++++++--- stdlib/socket/0/socket.rbs | 9 ++++++--- stdlib/socket/0/tcp_server.rbs | 3 ++- stdlib/socket/0/udp_socket.rbs | 3 ++- stdlib/socket/0/unix_server.rbs | 3 ++- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/stdlib/socket/0/basic_socket.rbs b/stdlib/socket/0/basic_socket.rbs index a69132467..ad51744b7 100644 --- a/stdlib/socket/0/basic_socket.rbs +++ b/stdlib/socket/0/basic_socket.rbs @@ -330,7 +330,8 @@ class BasicSocket < IO # ### See # * Socket#recvfrom # - def recv_nonblock: (Integer maxlen, ?Integer flags, ?String buf, ?exception: boolish) -> (String | :wait_readable) + def recv_nonblock: (Integer maxlen, ?Integer flags, ?String buf, ?exception: true) -> String + | (Integer maxlen, ?Integer flags, ?String buf, exception: false) -> (String | :wait_readable) #