[SR-12488] Type inference (of Void) for generic method fails without explicit return #54930
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Environment
Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29)
Additional Detail from JIRA
md5: ee03922ab21551c314b95d6f7799763a
Issue Description:
Consider such example function:
This can be used to mark "TODO once something is implemented" and we use it like this:
This works fine... However default swift-format (the non-apple one, for now) rules may (and do) cause this function to changed to:
It's somewhat annoying since we'd like to use that swift-format rule to remove returns where they are not necessary, however it does break code whenever such method is encountered.
Expectation: the <T> should still be inferred as Void, even without the
return
keyword present.The text was updated successfully, but these errors were encountered: