On Wed Sep 23 17:14:20 2015, b...@abrij.org wrote:
> 
> Tests added in S13-overloading/typecasting-long.t
> 
> However there is a subcase still behaving magically, and two tests
> were fudged for it:
> 
> $ perl6 -e 'class XYX { method postcircumfix:<( )>(XYX:U:) { 42 } };
> XYX().perl.say;'
> XYX(Any)
> $ perl6 -e 'class XYX { method postcircumfix:<( )>(XYX:U: $x) { 42 }
> }; XYX().perl.say;'
> XYX(Any)
> $ # But the dotted for does behave correctly, and so do :D invocants.
> $ perl6 -e 'class XYX { method postcircumfix:<( )>(XYX:U: $x) { 42 }
> }; XYX.().perl.say;'
> Too few positionals passed; expected 2 arguments but got 1
>   in method postcircumfix:<( )> at -e:1
>   in block <unit> at -e:1
> $ perl6 -e 'class XYX { method postcircumfix:<( )>(XYX:U: $x) { 42 }
> }; XYX.new()().perl.say;'
> Too few positionals passed; expected 2 arguments but got 1
>   in method postcircumfix:<( )> at -e:1
>   in block <unit> at -e:1

The form TypeName(TypeName) is (syntactically) a coercion type literal. And 
SomeType() is also a coercion type literal, and short for SomeType(Any). This 
is a parse-time distinction. The . is needed to force it to be a call. So, the 
behavior seen here is correct.

I've updated the tests in S13-overloading/typecasting-long.t to reflect this.

/jnthn

Reply via email to