Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in reduce(&:merge) #1289

Open
pvcresin opened this issue Oct 24, 2024 · 0 comments
Open

error in reduce(&:merge) #1289

pvcresin opened this issue Oct 24, 2024 · 0 comments

Comments

@pvcresin
Copy link

pvcresin commented Oct 24, 2024

Repro

  • Ruby version: ruby 3.3.3 (2024-06-12 revision f1c7b6f435) [arm64-darwin23]
  • Steep version: 1.8.1
  • Passing multiple args through Symbol#to_proc is not supported yet
# sample.rbs
class Sample
end
# sample.rb
class Sample
  def ng
    merged1 = [{ a: 1 }, { b: 2 }].reduce(&:merge)
    p merged1 # => {:a=>1, :b=>2}
  end

  def ok
    merged2 = [{ a: 1 }, { b: 2 }].reduce { |acc, hash| acc.merge(hash) }
    p merged2 # => {:a=>1, :b=>2}
  end
end

Sample.new.ng
Sample.new.ok
$ ruby lib/sample.rb
{:a=>1, :b=>2}
{:a=>1, :b=>2}
$ bundle exec steep check
$ bundle exec steep check
# Type checking files:

...............................................................................2024-10-24 13:18:15.548: ERROR: [Steep 1.8.1] [typecheck:typecheck@0] [background] [#typecheck_source(path=lib/sample.rb)] [#type_check_file(lib/sample.rb@lib)] [synthesize:(1:1)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(2:3)] [synthesize:(3:5)] [synthesize:(3:5)] [synthesize:(3:14)] [[A] (A) { (A, ::Hash[::Symbol, ::Integer]) -> A } -> A] [synthesize:(3:42)] Passing multiple args through Symbol#to_proc is not supported yet
2024-10-24 13:18:15.550: ERROR: [Steep 1.8.1] [typecheck:typecheck@0] [background] [#typecheck_source(path=lib/sample.rb)] [#type_check_file(lib/sample.rb@lib)] [synthesize:(1:1)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(2:3)] [synthesize:(3:5)] [synthesize:(3:5)] [synthesize:(3:14)] [() { (::Hash[::Symbol, ::Integer], ::Hash[::Symbol, ::Integer]) -> ::Hash[::Symbol, ::Integer] } -> ::Hash[::Symbol, ::Integer]] [synthesize:(3:42)] Passing multiple args through Symbol#to_proc is not supported yet
......

No type error detected. 🫖
@pvcresin pvcresin changed the title Unexpected error in reduce(&:merge) error in reduce(&:merge) Oct 24, 2024
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

No branches or pull requests

1 participant