Skip to content

Fix comp/proto.t test failures#92

Merged
fglock merged 2 commits intomasterfrom
fix/comp-proto-test
Nov 28, 2025
Merged

Fix comp/proto.t test failures#92
fglock merged 2 commits intomasterfrom
fix/comp-proto-test

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Nov 28, 2025

Summary

This PR fixes two issues that were causing the comp/proto.t test to fail:

1. Fix % and @ prototypes with +() disambiguation

When calling a function with \% or \@ prototype using +(%hash) or +(@array) syntax (commonly used for disambiguation), the prototype handler now correctly unwraps the unary + to find the underlying hash/array variable.

Before: a_hash_ref +(%hash) would create a SCALAR reference instead of a HASH reference because the parser treated the entire +() expression as the argument.

After: The new unwrapUnaryPlus() helper method extracts the hash/array variable from inside the +() construct.

2. Handle string assignment to stash entries for setting prototypes

When a string is assigned to a stash entry like $::{foo} = '$$', it now correctly sets the prototype for that subroutine. This is used by code that manipulates the symbol table directly.

Test Results

  • Before: 166 pass, 26 fail (test aborted at line 412 with "Not a HASH reference")
  • After: 187 pass, 28 fail (test runs to completion)

The remaining failures are for other unimplemented features (bad prototype warnings, %_ variable support, etc.).

When calling a function with \% or \@ prototype using +(%hash) or
+(@array) syntax (commonly used for disambiguation), the prototype
handler now correctly unwraps the unary + to find the underlying
hash/array variable.

Previously, +(%hash) would create a SCALAR reference instead of a
HASH reference because the parser treated the entire +() expression
as the argument instead of recognizing the hash variable inside.

The new unwrapUnaryPlus() helper method checks for this pattern and
extracts the hash/array variable from inside the +() construct.
When a string is assigned to a stash entry like $::{foo} = '$$',
it sets the prototype for that subroutine. This is used by code that
manipulates the symbol table directly.

Added STRING and BYTE_STRING cases to RuntimeStashEntry.set() that
create or update the RuntimeCode's prototype field.
@fglock fglock merged commit f09a84e into master Nov 28, 2025
2 checks passed
@fglock fglock deleted the fix/comp-proto-test branch November 28, 2025 15:15
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.

1 participant