Repository navigation
Fix __index dispatch for string.gsub replacement tables - #360
Merged
Merged
Conversation
Collaborator
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #359.
string.gsubcurrently uses the raw C# indexer for replacement tables, so a missing key never reaches__index. Use the existingGetTableAsynclookup with the cancellation token. Raw hits keep their precedence; function handlers, table chains and asynchronous handlers follow the existing language-level lookup path.Adds 11 regression cases: 9 fail on the original implementation and all pass with this change. They cover capture keys, replacement limits, nil/false/numeric results, protected errors and state reuse as well as synchronous/asynchronous handlers. The reproducer's fixed output matches PUC-Rio Lua 5.2.3 byte-for-byte in two repetitions.
Validation on Linux x64, SDK 10.0.401 / runtime 8.0.32:
DOTNET_GCHeapHardLimit=0x40000000 dotnet test tests/Lua.Tests/Lua.Tests.csproj -c Release --filter "TestCategory!=ExpectedFailure": 567 passed (unchanged baseline: 556 passed).dotnet build src/Lua/Lua.csproj -c Release: all four target frameworks build.dotnet csharpier check .andgit diff --check: pass.The heap limit is needed on this server for the existing large-allocation tests; without it the unmodified suite was killed by the OS. The project-defined
ExpectedFailurefilter is unchanged. No host-indexer behavior changes are included.