Project

General

Profile

Actions

Bug #22663

open

Pattern matching local variables with invalid source encoding

Bug #22663: Pattern matching local variables with invalid source encoding

Added by kddnewton (Kevin Newton) about 2 hours ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:127776]

Description

Under parse.y, pattern matching can introduce local variables that are invalid in the encoding of the source, as in:

# encoding: binary

match = Object.new
def match.deconstruct_keys(k) = { "\u3042": 1 }

case match
in { "\u3042": }
end

under prism this results in a syntax error, because "\u3042" is not allowed in the binary encoding. Under parse.y this introduces a local variable only accessible through binding. This is very similar to https://bugs.ruby-lang.org/issues/22597, which fortunately we now also reject.

No data to display

Actions

Also available in: PDF Atom