Skip to content

Add experimental warnings for defer, class, field, method#311

Merged
fglock merged 3 commits into
masterfrom
fix/experimental-warnings
Mar 13, 2026
Merged

Add experimental warnings for defer, class, field, method#311
fglock merged 3 commits into
masterfrom
fix/experimental-warnings

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Mar 13, 2026

Summary

Added experimental warnings that match system Perl's format for:

  • defer - "defer is experimental at filename line N."
  • class - "class is experimental at filename line N."
  • field - "field is experimental at filename line N."
  • method - "method is experimental at filename line N."

Also updated the existing declared_refs warning to use the same format.

Before (no warnings emitted)

$ ./jperl -we 'use feature "defer"; defer { } print "hi"'
hi

After

$ ./jperl -we 'use feature "defer"; defer { } print "hi"'
defer is experimental at -e line 2.
hi

Warnings can be disabled

use feature 'defer';
no warnings 'experimental::defer';
defer { ... }  # No warning

Implementation

  • Added warningLocation() method to ErrorMessageUtil that returns " at filename line N" (matching system Perl's format without the ", near" suffix)
  • Added warning emission in parser for each experimental feature

Test Plan

  • All 163 unit tests pass
  • Verified output matches system Perl format
  • Verified no warnings properly disables the warnings

Generated with Devin

fglock and others added 3 commits March 13, 2026 16:23
- Added "defer is experimental" warning when using defer blocks
- Added "class is experimental" warning when using class keyword
- Added "field is experimental" warning when using field keyword
- Added "method is experimental" warning when using method keyword
- Added warningLocation() method to ErrorMessageUtil for Perl-style location format
- Updated declared_refs warning to use the same format
- All warnings can be disabled with no warnings 'experimental::...'

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <noreply@cognition.ai>
- Emits warning when using \$x = \$y syntax with refaliasing feature
- Warning can be disabled with no warnings 'experimental::refaliasing'
- Or by using: use experimental 'refaliasing'

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <noreply@cognition.ai>
- `our` variables now show "redeclared" instead of "masks earlier declaration"
- `my` variables now show "masks earlier declaration in same scope"
- Removed "Warning:" prefix to match system Perl format
- Fixed typo "ctx.symbolTable" to "scope" in warning message

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <noreply@cognition.ai>
@fglock fglock merged commit 64b7ac7 into master Mar 13, 2026
2 checks passed
@fglock fglock deleted the fix/experimental-warnings branch March 13, 2026 15:42
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