The following logic is pretty much copy/pasta of the code to infer @safe/pure/nothrow