Skip to content

Commit 88bfa3d

Browse files
committed
Add information about type checking
1 parent b98d8ce commit 88bfa3d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

TSPL.docc/ReferenceManual/Expressions.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,6 +1544,16 @@ are expressions that contain a macro ---
15441544
the macros in those expressions are evaluated
15451545
using the source code location where `f(a:b:c:)` is defined.
15461546

1547+
When you use a macro as a default value,
1548+
it's type checked without expanding the macro,
1549+
to check the following requirements:
1550+
1551+
- The macro either takes no arguments,
1552+
or its arguments are literals without string interpolation.
1553+
- The macro's return type matches the parameter's type.
1554+
- The access level for the macro's return type
1555+
is the same as or less restrictive than the function that uses it.
1556+
15471557
You use macro expressions to call freestanding macros.
15481558
To call an attached macro,
15491559
use the custom attribute syntax described in <doc:Attributes>.

0 commit comments

Comments
 (0)