class X::TypeCheck::Splice
Error ReportCollection examples

Compilation error due to a macro trying to splice a non-AST value

class X::TypeCheck::Splice is X::TypeCheck does X::Comp { }

Compile time error thrown when a Macro or an unquote/hole in a quasi quote does not return an AST.

For example

use experimental :macros;
macro quasi-ast { quasi { {{{'not AST'}}} };};
say quasi-ast;

dies with

Type check failed in macro application; expected AST but got Str("not AST")

This is because you are purposefully creating something that does not evaluate to an abstract syntax tree. To fix, instead write

use experimental :macros;
macro an-ast {
    quasi { 'yes AST' }
say an-ast;              # OUTPUT: «yes AST␤» 


method action

method action(--> Str:D)

Returns a verbal description of the action that triggered the error, "macro application" or "unquote evaluation".