Skip to content

Commit abc60c2

Browse files
sinsokumame
authored andcommitted
Fix NoMethodError in SigTyTupleNode#typecheck for instance types
`SigTyTupleNode#typecheck` was passing wrong parameter (ty instead of vtx) to `f_ty.typecheck` when handling `Type::Instance` objects, causing: "undefined method `each_type' for an instance of TypeProf::Core::Type::Instance". ``` /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/ast/sig_type.rb:5:in `typecheck_for_module': undefined method `each_type' for an instance of TypeProf::Core::Type::Instance (NoMethodError) a_vtx.each_type do |ty| ^^^^^^^^^^ 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:727:in `block (2 levels) in typecheck' from /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/ast/sig_type.rb:726:in `each' from /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/ast/sig_type.rb:726:in `block in typecheck' ```
1 parent 4859068 commit abc60c2

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

lib/typeprof/core/ast/sig_type.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ def typecheck(genv, changes, vtx, subst)
724724
return true
725725
when Type::Instance
726726
@types.each do |f_ty|
727-
return false unless f_ty.typecheck(genv, changes, ty, subst)
727+
return false unless f_ty.typecheck(genv, changes, vtx, subst)
728728
end
729729
return true
730730
end
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## update
2+
Regexp.union(["0"] + ["1"])

0 commit comments

Comments
 (0)