Fix typeglob CODE slot access for filehandle.t #67
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.
Summary
This PR completes the fix for
t/op/filehandle.tby properly implementing typeglob CODE slot access.Root Cause
The previous PR #66 only added the missing DESTROY method, but the real issue was that
*{name}{CODE}wasn't working properly. When FileHandle.pm checked for method existence using*{"IO::Handle::method"}{CODE}, it was callingRuntimeScalar.hashDerefGetNonStrict()instead of accessing the typeglob's CODE slot.Changes
hashDerefGetNonStrict()inRuntimeGlobto properly handle typeglob slot access (CODE, SCALAR, ARRAY, HASH, IO, FORMAT)RuntimeCode.defined()before returning CODE slot to match Perl behavior where undefined subs return undefIO::Handle:gets(),_open_mode_string()IO::Seekable:getpos(),setpos()IO::File:new_tmpfile()(stub for now)Test Results
✅
t/op/filehandle.t: 4/4 tests pass (was 0/4 before PR #66)Bonus Improvements
This fix also improved other tests:
t/op/undef.t: +23 tests (15 → 38 tests passing, previously crashed)t/uni/select.t: +3 tests (0 → 3/5 tests passing)Technical Details
Used
--disassembleto confirm that*{name}{CODE}compiles tohashDerefGetNonStrict, which was missing the override inRuntimeGlob.