Skip to content

Commit b87c0d0

Browse files
committed
Check type arguments size
1 parent a9c02b3 commit b87c0d0

4 files changed

Lines changed: 6 additions & 3 deletions

File tree

lib/rbs/test/type_check.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ def value(val, type)
264264
klass = get_class(type.name) or return false
265265
if params = builder.env.normalized_module_class_entry(type.name.absolute!)&.type_params
266266
args = AST::TypeParam.normalize_args(params, type.args)
267+
if args.size != params.size
268+
return false
269+
end
267270
unless args == type.args
268271
type = Types::ClassInstance.new(name: type.name, args: args, location: type.location)
269272
end

test/stdlib/Array_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def test_at
162162
end
163163

164164
def test_bsearch
165-
assert_send_type "() -> Enumerable[String, Integer?]", [0,1,2,3,4],
165+
assert_send_type "() -> Enumerator[Integer]", [0,1,2,3,4],
166166
:bsearch
167167

168168
assert_send_type "() { (Integer) -> (true | false) } -> Integer",

test/stdlib/ObjectSpace_WeakKeyMap_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def test_clear
4040
map = ObjectSpace::WeakKeyMap.new()
4141

4242
assert_send_type(
43-
"() -> ::ObjectSpace::WeakKeyMap",
43+
"() -> ::ObjectSpace::WeakKeyMap[::String, ::Integer]",
4444
map, :clear
4545
)
4646
end

test/stdlib/ObjectSpace_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_garbage_collect
4949
def test_undefine_finalizer
5050
assert_send_type "(String) -> String",
5151
ObjectSpace, :undefine_finalizer, +"abc"
52-
assert_send_type "(Array) -> Array",
52+
assert_send_type "(Array[untyped]) -> Array[untyped]",
5353
ObjectSpace, :undefine_finalizer, []
5454
end
5555

0 commit comments

Comments
 (0)