class X::TypeCheck::Splice

Compilation error due to a macro trying to splice a non-AST value
class X::TypeCheck::Splice is X::TypeCheck does X::Comp { }

Note: Experimental macros will not be available in language version 6.e, to clear the way for actual macros using RakuAST in 6.f.

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

===SORRY!===
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␤»

Methods

method action

method action(--> Str:D)

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

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.