sorear/niecza — Issue #74: Regex literals used as default sub parameters cause fatal error
Author: flussence
Created: 2011-10-21 12:42:38+00:00
State: open

Command line example -

niecza> sub explode($a = rx/a/) { say 'alive' }; explode()
Potential difficulties:
$a is declared but not used at (eval) line 1:
------> sub explode(⏏$a = rx/a/) { say 'alive' }; explode()

System.Exception: Improper null return from sub default for $a = rx/a/ in MAIN_2 explode
at Niecza.SubInfo.Binder (Niecza.Frame caller, Niecza.Frame outer, Niecza.P6any sub, Niecza.Variable[] pos, Niecza.VarHash named, Boolean quiet, Niecza.DispatchEnt de) [0x00000] in :0
at Niecza.InvokeSub.Invoke (Niecza.P6any th, Niecza.Frame caller, Niecza.Variable[] pos, Niecza.VarHash named) [0x00000] in :0
at Niecza.P6any.Invoke (Niecza.Frame c, Niecza.Variable[] p, Niecza.VarHash n) [0x00000] in :0
at MAIN_2.C0_mainline (Niecza.Frame ) [0x00000] in :0
at Niecza.Kernel.RunCore (Niecza.Frame& cur) [0x00000] in :0
at (eval) line 0 (MAIN_2 explode @ 0)
at (eval) line 1 (MAIN_2 mainline @ 1)
at line 0 ( @ 1)
at line 0 (ExitRunloop @ 0)