Skip to content

Commit 0ddf214

Browse files
authored
Merge pull request #2264 from pocke/Fix_UNIXSocket_send_io_and_recv_io_types
Fix UNIXSocket#send_io and recv_io types
2 parents 831a7db + 40fcae4 commit 0ddf214

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

core/io.rbs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3251,6 +3251,10 @@ class IO < Object
32513251
# f.close
32523252
#
32533253
alias to_i fileno
3254+
3255+
interface _ForFd[RET]
3256+
def for_fd: (?) -> RET
3257+
end
32543258
end
32553259

32563260
IO::APPEND: Integer

stdlib/socket/0/unix_socket.rbs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ class UNIXSocket < BasicSocket
104104
#
105105
# *mode* is the same as the argument passed to IO.for_fd
106106
#
107-
def recv_io: (?singleton(BasicSocket), ?String mode) -> BasicSocket
107+
def recv_io: () -> IO
108+
| (singleton(Integer)?) -> Integer
109+
| [T] (IO::_ForFd[T], ?untyped mode) -> T
108110

109111
# <!--
110112
# rdoc-file=ext/socket/unixsocket.c
@@ -151,7 +153,7 @@ class UNIXSocket < BasicSocket
151153
#
152154
# *io* may be any kind of IO object or integer file descriptor.
153155
#
154-
def send_io: (BasicSocket | Integer) -> void
156+
def send_io: (IO | Integer) -> void
155157

156158
private
157159

0 commit comments

Comments
 (0)