Parser rejects our self-reference in its initializer under strict vars

Offen
#1,979 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
48/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
java, perl
Bereich
backend

Rechercherichtung

Start by tracing how our declarations are handled and how strict 'vars' resolves initializer references in both the JVM and interpreter backends. Reproduce with our $V = $V = 119; under strict vars and compare with system Perl. Done when both backends compile the case and leave $V equal to 119.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

area:parser bug

Summary

The parser rejects a valid our declaration when its initializer reads the variable being declared under strict 'vars'. This breaks CPAN distribution Text-Template 1.61: t/delimiters.t stops at compile time with Global symbol "$V" requires explicit package name, before running its assertions. System Perl 5.42.2 accepts the source, and the complete upstream distribution suite passes there (22 files, 184 tests). Both PerlOnJava backends reject it.

Root cause

The declaration's initializer is resolved before the our variable is entered into the current lexical symbol table. Perl makes the our alias visible in the declaration's initializer, so the self-assignment in this valid initializer must resolve to the package variable. The package glob being materialized during declaration handling is not sufficient: strict-variable resolution uses the lexical symbol table and reports the RHS $V as undeclared.

This was independently reproduced with the one-line case in the comment. It fails under both the JVM and interpreter backends and succeeds under system Perl. The failure is included in archived CPAN run 20261104-151051-20617.

Expected behavior

our $V = $V = 119; compiles under use strict and leaves $V equal to 119, as it does in system Perl.

Vorherrschende Sprache
Perl
Sterne
65
Forks
8
Ø Merge
5 Std. 45 Min.
Gemergte PRs (30 T.)
184

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus fglock/PerlOnJava

Alle Issues in fglock/PerlOnJava

Ähnliche Issues

Weitere Issues zu Perl

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.