Revert "Merge pull request #3081 from WalterBright/fix11822"

This reverts commit 24c1dff4856983533e813b89c1d8adf9492936d0, excepting test cases.
Revert "Merge pull request #3094 from WalterBright/fix11922"

This reverts commit 11f05b5dad2f5ef22a73dd851db1ec108508e022, excepting test cases.
Add more robust error propagation for TypeFunction

`TypeFunction` is also used for the extra payload of function attributes.
Therefore, even if function signature or its body has errors, we would be better to leave that `fd->type->ty == Tfunction`.

Also fix-up test cases for issue 11822, 11850, and 11857