Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: ff131520c8780dc0c84fdad9ede7e0249739e519
      
https://github.com/Perl/perl5/commit/ff131520c8780dc0c84fdad9ede7e0249739e519
  Author: Tony Cook <[email protected]>
  Date:   2026-07-16 (Thu, 16 Jul 2026)

  Changed paths:
    M pad.c
    M t/lib/croak/class

  Log Message:
  -----------
  pad_findlex: propagate FIELD_OK recursively

Code like:

class Foo {
   field $message :param :reader;

   sub foo {
       return method () { $message }
   }
}

would fail to build because pad_findlex() didn't propagate the
padfind_FIELD_OK flag from the anonymous method scope through to the
class scope, and reported:

  Field $message is not accessible outside a method ...

so propagate the flag.

In the original test cases the scope was a BEGIN block, hidden in a
use:

  use overload '""' => method (@) { $message };

I thought this might allow code like:

use v5.40;
use experimental 'class';

class Outer {
    field $outer :param :reader;

    class Inner {
        field $inner :param :reader;
        method foo () { $outer }
    }
}

to compile, but this is already caught by a check of the field stash
against the method expected stash.

Fixes #24418, #23446


  Commit: f77fc4195ce2dfe89948469aedf34d108ca971d3
      
https://github.com/Perl/perl5/commit/f77fc4195ce2dfe89948469aedf34d108ca971d3
  Author: Tony Cook <[email protected]>
  Date:   2026-07-16 (Thu, 16 Jul 2026)

  Changed paths:
    M pod/perldelta.pod

  Log Message:
  -----------
  perldelta for pad_findlex: propagate FIELD_OK


Compare: https://github.com/Perl/perl5/compare/2cfd97a41895...f77fc4195ce2

To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to