More simplified code producing the same error;

$_ = 'some message';
my Hash $h = {
  f1 => $_,
}

greetings
Marcel

# New Ticket Created by  mt1957
# Please include the string:  [perl #128036]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=128036 >


Hi,

Had some strange problem to solve... Could golf it down to the following;

*class A {**
**  method message ( ) { 'some message'; }**
**}**
****
**my A $a .= new;**
**
**$_ = $a;**
**my Hash $h = {**
**  key => $_.message(),**
**}**
*
Error generated is;

Type check failed in assignment to $h; expected Hash but got Block (->
;; $_? is raw { #`...)
    in block <unit> at hash.pl6 line ...

All is fine when *$_.message(),***is substituted with *$a.message(),**
*
A workaround for the moment is to assign the result of the method to a
Str variable which then can be used in the Hash.

Greetings,
Marcel


Reply via email to