Commit 8ec71921

8ec719212393Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 2 files · +1 added · ~1 modified

Description

Merge pull request #163 from mame/pr/class-body-no-recv-only

fix(codegen): scope class-body bare-call return inference to no-recv

Details

Commit
8ec719212393
Parent
a9ca40b38368
Merge parent
a9123df66e21

spinel_codegen.rbmodifiedView file

@@ -1906,8 +1906,12 @@
19061906 return @meth_return_types[mi]
19071907 end
19081908
1909- # Bare method call in class context
1910- if @current_class_idx >= 0
1909+ # Bare (no-receiver) method call resolved against the enclosing
1910+ # class's method table. Only for `recv < 0` — without that guard,
1911+ # a `Fiber.yield ...` (which has a receiver) inside a class body
1912+ # would short-circuit here returning the int default and never
1913+ # reach the Fiber.yield → poly branch further down.
1914+ if recv < 0 && @current_class_idx >= 0
19111915 mr = cls_method_return(@current_class_idx, mname)
19121916 return mr
19131917 end