Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forbid newindex for non-tables without __newindex #99

Merged
merged 1 commit into from
Feb 15, 2023

Conversation

TheCount
Copy link
Contributor

Previously, a newindex event on a non-table without a suitable __newindex entry in its metatable would be silently ignored. This commit causes an error to be raised.

From the spec:

Like with indexing, the metavalue for this event can be either a function, a table, or any value with an __newindex metavalue.

If none of these conditions applies, an error should be raised.

Previously, a newindex event on a non-table without a suitable
__newindex entry in its metatable would be silently ignored. This commit
causes an error to be raised.
@codecov
Copy link

codecov bot commented Feb 11, 2023

Codecov Report

Base: 87.72% // Head: 87.72% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (fdf607a) compared to base (35f260b).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           lua5.4      #99      +/-   ##
==========================================
- Coverage   87.72%   87.72%   -0.01%     
==========================================
  Files         107      106       -1     
  Lines       11475    11470       -5     
==========================================
- Hits        10067    10062       -5     
+ Misses       1088     1086       -2     
- Partials      320      322       +2     
Impacted Files Coverage Δ
runtime/lib.go 79.83% <100.00%> (+0.11%) ⬆️
lib/iolib/file.go 78.85% <0.00%> (-1.33%) ⬇️
lib/iolib/iolib.go 87.03% <0.00%> (-0.40%) ⬇️
lib/oslib/clock_windows.go

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@arnodel
Copy link
Owner

arnodel commented Feb 13, 2023

This looks good - it causes the Lua test suite to fail though (see https://github.com/arnodel/golua/actions/runs/4152159172/jobs/7191272897#step:8:188). The line that fails is here: https://github.com/arnodel/golua-tests/blob/golua-5.4/coroutine.lua#L384. I didn't have time to find out why.

@TheCount
Copy link
Contributor Author

Yes, I'll look into it later. On my local machine, the tests are successful.

@TheCount
Copy link
Contributor Author

At first glance, it just seems like something should have been commented out but wasn't:

-- No weak tables in Golua, so removing this check
-- local C = {}; setmetatable(C, {__mode = "kv"})

(https://github.com/arnodel/golua-tests/blob/golua-5.4/coroutine.lua#L373)

The question is, why does this not fail everywhere. But as I said, I'll look into it in more detail later.

@arnodel
Copy link
Owner

arnodel commented Feb 13, 2023 via email

@arnodel
Copy link
Owner

arnodel commented Feb 15, 2023

Thanks @TheCount for fixing the issue in golua-tests. All tests now green!

@arnodel arnodel merged commit e0b5347 into arnodel:lua5.4 Feb 15, 2023
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