Skip to content

Commit 4273e08

Browse files
committed
Fix type signatures.
1 parent 330c6a7 commit 4273e08

File tree

6 files changed

+9
-4
lines changed

6 files changed

+9
-4
lines changed

lib/async/condition.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def waiting?
5353
end
5454

5555
# Signal to a given task that it should resume operations.
56-
# @parameter value [Object | Nil] The value to return to the waiting fibers.
56+
# @parameter value [::Object | Nil] The value to return to the waiting fibers.
5757
def signal(value = nil)
5858
return if @waiting.empty?
5959

lib/async/node.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def description
171171

172172
# Provides a backtrace for nodes that have an active execution context.
173173
#
174-
# @returns [Array(Thread::Backtrace::Locations) | Nil] The backtrace of the node, if available.
174+
# @returns [Array(::Thread::Backtrace::Locations) | Nil] The backtrace of the node, if available.
175175
def backtrace(*arguments)
176176
nil
177177
end

lib/async/scheduler.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def blocking_operation_wait(work)
7272
#
7373
# @public Since *Async v1*.
7474
# @parameter parent [Node | Nil] The parent node to use for task hierarchy.
75-
# @parameter selector [IO::Event::Selector] The selector to use for event handling.
75+
# @parameter selector [::IO::Event::Selector] The selector to use for event handling.
7676
def initialize(parent = nil, selector: nil, profiler: Profiler&.default, worker_pool: WORKER_POOL)
7777
super(parent)
7878

@@ -197,7 +197,7 @@ def yield
197197
end
198198

199199
# Schedule a fiber (or equivalent object) to be resumed on the next loop through the reactor.
200-
# @parameter fiber [Fiber | Object] The object to be resumed on the next iteration of the run-loop.
200+
# @parameter fiber [Any(Fiber, Object)] The object to be resumed on the next iteration of the run-loop.
201201
def push(fiber)
202202
@selector.push(fiber)
203203
end

lib/async/task.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def initialize(message = "execution expired")
5252
end
5353

5454
# @public Since *Async v1*.
55+
# @rbs generic ResultType
5556
class Task < Node
5657
# Raised when a child task is created within a task that has finished execution.
5758
class FinishedError < RuntimeError
@@ -224,6 +225,7 @@ def run(*arguments)
224225
# @yields {|task| ...} in the context of the new task.
225226
# @raises [FinishedError] If the task has already finished.
226227
# @returns [Task] The child task.
228+
# @rbs [ResultType] (*untyped, **untyped) { () -> ResultType } -> Task[ResultType]
227229
def async(*arguments, **options, &block)
228230
raise FinishedError if self.finished?
229231

@@ -247,6 +249,7 @@ def async(*arguments, **options, &block)
247249
#
248250
# @raises [RuntimeError] If the task's fiber is the current fiber.
249251
# @returns [Object] The final expression/result of the task's block.
252+
# @rbs () -> ResultType
250253
def wait
251254
raise "Cannot wait on own fiber!" if Fiber.current.equal?(@fiber)
252255

lib/kernel/async.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module Kernel
2121
#
2222
# @public Since *Async v1*.
2323
# @asynchronous May block until given block completes executing.
24+
# @rbs [ResultType] (*untyped, **untyped) { (Task) -> ResultType } -> Task[ResultType]
2425
def Async(...)
2526
if current = ::Async::Task.current?
2627
return current.async(...)

lib/kernel/sync.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module Kernel
1616
#
1717
# @public Since *Async v1*.
1818
# @asynchronous Will block until given block completes executing.
19+
# @rbs [ResultType] (**untyped) { (Task) -> ResultType } -> ResultType
1920
def Sync(annotation: nil, &block)
2021
if task = ::Async::Task.current?
2122
if annotation

0 commit comments

Comments
 (0)