Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions core/kernel.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ module Kernel : BasicObject
# Optionally you can pass a range, which will return an array containing the
# entries within the specified range.
#
def self?.caller_locations: (?Integer start_or_range, ?Integer length) -> ::Array[Thread::Backtrace::Location]?
| (?::Range[Integer] start_or_range) -> ::Array[Thread::Backtrace::Location]?
def self?.caller_locations: (Integer start_or_range, ?Integer length) -> ::Array[Thread::Backtrace::Location]?
| (::Range[Integer] start_or_range) -> ::Array[Thread::Backtrace::Location]?
| () -> ::Array[Thread::Backtrace::Location]

# <!--
# rdoc-file=vm_eval.c
Expand Down
14 changes: 14 additions & 0 deletions test/stdlib/Kernel_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ class KernelSingletonTest < Test::Unit::TestCase

testing "singleton(::Kernel)"

def test_caller_locations
assert_send_type "() -> Array[Thread::Backtrace::Location]",
Kernel, :caller_locations

assert_send_type "(Integer) -> Array[Thread::Backtrace::Location]?",
Kernel, :caller_locations, 1

assert_send_type "(Integer, Integer) -> Array[Thread::Backtrace::Location]?",
Kernel, :caller_locations, 1, 2

assert_send_type "(::Range[Integer]) -> Array[Thread::Backtrace::Location]?",
Kernel, :caller_locations, (1..3)
end

def test_Array
assert_send_type "(nil) -> []",
Kernel, :Array, nil
Expand Down