Skip to content

Types::Const fails due incomplete readonly reference/hash semantics #1108

Description

@fglock

Summary

The CPAN tester regression for Types::Const v0.5.0 fails because PerlOnJava does not correctly implement the read-only reference/hash semantics required by Const::Fast and Types::Const.

Archived CPAN tester run: 20260824-171428-41866 (Types-Const regression record)

Reproduction

The bounded CPAN run completed in 19 seconds:

! REGRESS Types::Const PASS -> FAIL (7/12)

Failures:

  • t/10-basic.t: 3/3 subtests failed
  • t/11-parameterized.t: 2/3 subtests failed

The failures are the checks that writable array/hash references are rejected by Const, and that coercion makes nested references read-only while leaving the original value unchanged.

Evidence and suspected cause

The target and its Const::Fast dependency configured and built successfully. The failure is not a timeout or missing-prerequisite failure.

Types::Const calls Const::Fast::_make_readonly, which relies on Internals::SvREADONLY to recursively mark reference values read-only. The relevant runtime gaps are:

  1. The SvREADONLY setter for a scalar reference marks the referent/target instead of the reference scalar itself, preventing correct recursive traversal.
  2. Hash references have no read-only state: the HASHREFERENCE setter is still a TODO and RuntimeHash has no READONLY_HASH type or mutation guards.

This explains both the failed read-only checks and the failed original-unchanged checks. The regression was observed on the JVM backend; interpreter parity is still unverified.

System Perl passes the complete upstream suite after installing the distribution and prerequisites into an isolated temporary library: 17 files, 12 tests, all successful. The internal cause is therefore attributable to PerlOnJava.

Suggested follow-up

  • Add focused project-owned tests for scalar-reference and hash-reference SvREADONLY semantics, including recursive/cyclic structures.
  • Implement correct reference-slot readonly marking.
  • Add readonly hash state and mutation enforcement.
  • Run the Types::Const focused suite on both JVM and interpreter backends.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions