Commit 4f544d48

4f544d489843Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 7 months ago · 2 files · ~2 modified

Description

fix: unary minus (-@) type inference preserves receiver type

The -@ operator now propagates the receiver's inferred type (float, int, etc.) instead of always defaulting to int. Fixes d = -obj.method where method returns float being truncated to int.

Revert ao_render workaround (0.0 - expr back to -expr).

Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]

Details

Commit
4f544d489843
Parent
f319ed41b554

spinel_codegen.rbmodifiedView file

@@ -1233,6 +1233,12 @@
12331233 if mname == "%"
12341234 return "int"
12351235 end
1236+ if mname == "-@"
1237+ if recv >= 0
1238+ return infer_type(recv)
1239+ end
1240+ return "int"
1241+ end
12361242 ""
12371243 end
12381244