might be how users write custom is-checks to see if a given type is some templated type, however for isSomething!noreturn this returns true, which might be unexpected for the user. (see forum discussion)
My check idea to add would be warning if noreturn isn't explicitly handled for global templates or maybe even everywhere. (could be configurable)
so for the code above it would give a warning and the user would have a few choices to fix it:
// noreturn is not Something
enum isSomething(T) = is(T : Something!Types, Types...)
&& !is(immutable T == immutable noreturn);
// noreturn is Something
enum isSomething(T) = is(T : Something!Types, Types...)
|| is(immutable T == immutable noreturn);
// only match exact Something (no alias this support anymore though)
enum isSomething(T) = is(T == Something!Types, Types...);
to keep the check simple it would just check for any is(T : ...) expression and see if in the same expression or template T is compared with noreturn.
See https://forum.dlang.org/thread/xmjabqpofltdwxfqlwhi@forum.dlang.org
code like
might be how users write custom is-checks to see if a given type is some templated type, however for
isSomething!noreturn
this returnstrue
, which might be unexpected for the user. (see forum discussion)My check idea to add would be warning if noreturn isn't explicitly handled for global templates or maybe even everywhere. (could be configurable)
so for the code above it would give a warning and the user would have a few choices to fix it:
to keep the check simple it would just check for any
is(T : ...)
expression and see if in the same expression or template T is compared withnoreturn
.