Skip to content

Conversation

sinsoku
Copy link
Contributor

@sinsoku sinsoku commented Sep 15, 2025

I encountered the following error:

/Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/ast/sig_type.rb:10:in `block in typecheck_for_module': undefined method `args' for an instance of TypeProf::Core::Type::Singleton (NoMethodError)

            f_args.zip(ty.args) do |f_arg_node, a_arg_ty|
                         ^^^^^
        from /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/graph/vertex.rb:11:in `each_key'
        from /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/graph/vertex.rb:11:in `each_type'
        from /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/ast/sig_type.rb:5:in `typecheck_for_module'
        from /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/ast/sig_type.rb:669:in `typecheck'
        from /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/ast/sig_type.rb:483:in `block in typecheck'
        from /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/ast/sig_type.rb:482:in `each'
        from /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/ast/sig_type.rb:482:in `typecheck'

The args method is only defined on Type::Instance, so it adds a conditional expression to avoid the error.

I encountered the following error:

```
/Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/ast/sig_type.rb:10:in `block in typecheck_for_module': undefined method `args' for an instance of TypeProf::Core::Type::Singleton (NoMethodError)

            f_args.zip(ty.args) do |f_arg_node, a_arg_ty|
                         ^^^^^
        from /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/graph/vertex.rb:11:in `each_key'
        from /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/graph/vertex.rb:11:in `each_type'
        from /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/ast/sig_type.rb:5:in `typecheck_for_module'
        from /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/ast/sig_type.rb:669:in `typecheck'
        from /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/ast/sig_type.rb:483:in `block in typecheck'
        from /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/ast/sig_type.rb:482:in `each'
        from /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/ast/sig_type.rb:482:in `typecheck'
```

The `args` method is only defined on `Type::Instance`, so it
adds a conditional expression to avoid the error.
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