The error you’re getting doesn’t make it very clear why the type returned by xselectScope is comptime-only, and the example code isn’t self-contained so I can’t test it myself, but I’m fairly sure it has to do with @TypeOf(func) and @TypeOf(cb).
The way you’re currently passing those arguments is as aio.xselectScope(chanSend, report_add): the result of @TypeOf(chanSend) here is going to be fn (*UsizeChannel) !void, which is a function body type, as opposed to *const fn (*UsizeChannel) !void, which is a function pointer type. Function body types are comptime-only, while function pointer types can be stored at runtime. The Zig wiki has an overview of the difference in the self-hosted compiler upgrade guide, as this was one of the language changes made as part of that upgrade.
So, in order to fix this, you may want to try calling the function as aio.xselectScope(&chanSend, &report_add) to pass function pointers rather than function bodies. That will also require changes to the @typeInfo logic in xselectScope.
Thanks dimdin,
I tried your suggestion and found that it still show me a similar compiler issue. And the issue finally get resolved by the advice provided by ianprime0509