Skip to content

fix: match Lua unary minus, for-in multi-return, and native range checks - #18

Merged
esrrhs merged 2 commits into
masterfrom
fix/unary-minus-forin-native-bounds
Sep 19, 2026
Merged

esrrhs merged 2 commits into
masterfrom
fix/unary-minus-forin-native-bounds

Conversation

@esrrhs

@esrrhs esrrhs commented Sep 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Lexer keeps unary minus out of number tokens so 1-2, -1 table keys, and math.abs(mininteger) match Lua 5.4; expression values still treat 1.0/0.0 as floats.
  • Generic for-in preserves 1/2/3-value iterator factories, colon methods evaluate the prefix before args, and VmFunction::Merge takes the latest arity.
  • HTTP/WS, INI, YAML, Redis, MySQL pool, and net helpers reject out-of-range or unsafe input instead of wrapping or injecting.

Test plan

  • Targeted regressions: jitter.nan_float_for, test_math.test_math_boundary_integer, unary-minus/for-in/method-order/native bound tests
  • GitHub Actions CI on this PR (full unit_tests still re-running locally)

Made with Cursor

esrrhs and others added 2 commits September 19, 2026 00:26
Keep minus as a unary op so 1-2 and mininteger stay correct, preserve
1.0 as float, and fail closed on HTTP/INI/YAML/Redis/net bounds.

Co-authored-by: Cursor <cursoragent@cursor.com>
Float source tokens now stay float in generated C, so the string
checks must look for 1.0 and 0.0 instead of integer 1/0.

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 79.66102% with 60 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.80%. Comparing base (d1ba6a5) to head (31a4ab0).

Files with missing lines Patch % Lines
src/native/yaml/native_yaml.cpp 45.45% 18 Missing ⚠️
src/native/redis/native_redis.cpp 65.78% 13 Missing ⚠️
src/interp/codegen.cpp 73.33% 12 Missing ⚠️
src/native/net/net_event.cpp 74.07% 7 Missing ⚠️
src/compile/compile_common.h 88.37% 5 Missing ⚠️
src/compile/c_gen.cpp 94.54% 3 Missing ⚠️
src/native/http/native_http.cpp 83.33% 1 Missing ⚠️
src/native/mysql/native_mysql_pool.cpp 0.00% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #18      +/-   ##
==========================================
- Coverage   87.89%   87.80%   -0.10%     
==========================================
  Files         119      119              
  Lines       23842    24042     +200     
==========================================
+ Hits        20955    21109     +154     
- Misses       2887     2933      +46     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@esrrhs
esrrhs merged commit e12a951 into master Sep 19, 2026
9 checks passed
@esrrhs
esrrhs deleted the fix/unary-minus-forin-native-bounds branch September 19, 2026 01:00
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.

2 participants