Skip to content

Fix overload oscillation for generic type arguments, tuples, and hashes#401

Merged
mame merged 1 commit intoruby:masterfrom
mame:fix-generic-overload-oscillation
Feb 26, 2026
Merged

Fix overload oscillation for generic type arguments, tuples, and hashes#401
mame merged 1 commit intoruby:masterfrom
mame:fix-generic-overload-oscillation

Conversation

@mame
Copy link
Member

@mame mame commented Feb 26, 2026

Extend the uninformative-args bail-out in resolve_overloads to recursively check type parameter vertices (e.g., Array[T], Hash[K,V], tuples). Previously only top-level empty vertices and splat array element vertices were checked, missing cases like Foo.f([@x]) where @x is empty and overloads differ in the element type.

To avoid false bail-outs for legitimate empty containers (e.g., {} passed to Hash#merge!), the recursive check is only applied when overloads actually differ in their positional parameter types. Overloads that differ only in blocks or keywords use the simpler top-level empty check.

Extend the uninformative-args bail-out in resolve_overloads to
recursively check type parameter vertices (e.g., Array[T], Hash[K,V],
tuples). Previously only top-level empty vertices and splat array
element vertices were checked, missing cases like Foo.f([@x]) where
@x is empty and overloads differ in the element type.

To avoid false bail-outs for legitimate empty containers (e.g., {}
passed to Hash#merge!), the recursive check is only applied when
overloads actually differ in their positional parameter types.
Overloads that differ only in blocks or keywords use the simpler
top-level empty check.
@mame mame merged commit 9adda8f into ruby:master Feb 26, 2026
7 checks passed
@mame mame deleted the fix-generic-overload-oscillation branch February 26, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant