Referencing `return?` of other functions/macros in doc-comments
For instance, we have something like this:
typedef Triangle = inline uint[3];
fn TriangleKind? get_triangle_kind(Triangle* triangle)
{
check_triangle(triangle)!;
...
}
<*
@return? NONEXISTENT_TRIANGLE
*>
fn void? check_triangle(Triangle* triangle)
{
...
}
What if we could explicitly define the faults returned by get_triangle_kind as though:
<*
@return? check_triangle()
*>
fn TriangleKind? get_triangle_kind(Triangle* triangle)
{
check_triangle(triangle)!;
}
So we can say: "get_triangle_kind can return the same faults as check_triangle". Regarding the syntax, there are multiple options:
@return? other_func()
@return? other_func
@return? &other_func
@return? [ref] other_func
Yes, I've thought of this a little. See #1410 for example. Maybe other_func! could work as the syntax? Because yes, it's a pain.
@return? other_func!
@return? &other_func
seems to be good. I suppose semantically it would just check @return? of specified function or macro without extra functionality for now. Now we have to decide about syntax
Yes, about the syntax:
<*
@return? check_triangle!, io::EOF
*>
fn TriangleKind? get_triangle_kind(Triangle* triangle)
{
check_triangle(triangle)!;
}
//-- or
<*
@return? check_triangle?, io::EOF
*>
fn TriangleKind? get_triangle_kind(Triangle* triangle)
{
check_triangle(triangle)!;
}
//-- or
<*
@return? check_triangle, io::EOF
*>
fn TriangleKind? get_triangle_kind(Triangle* triangle)
{
check_triangle(triangle)!;
}
//-- or
<*
@return? &check_triangle, io::EOF
*>
fn TriangleKind? get_triangle_kind(Triangle* triangle)
{
check_triangle(triangle)!;
}
I've just thought about referencing PFN types. In this case, thr morr valuable would be the case @return? IntFn or @return? IntFn! rather than @return? &IntFn
This should now work, try it out.
Syntax is @return some_func!