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

オープン
#1,979 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
java, perl
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Perl
スター
65
フォーク
8
平均マージ
5時間 45分
マージ済み PR(30日)
184

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fglock/PerlOnJava のほかの issue

fglock/PerlOnJava の issue をすべて見る

似ている issue

Perl の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。