=begin pod :kind("Type") :subkind("class") :category("exception")

=TITLE class X::TypeCheck::Splice

=SUBTITLE 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 L<Macro|/type/Macro> or an unquote/hole in a C<quasi>
quote does not return an L<AST|/type/AST>.

For example

=for code :skip-test<compile time error>
use experimental :macros;
macro quasi-ast { quasi { {{{'not AST'}}} };};
say quasi-ast;

dies with

=for code :lang<text>
===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

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

=head1 Methods

=head2 method action

    method action(--> Str:D)

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

=end pod
