Fix recursive check for non dependent return types during type inference. Fixes #13969