Closed cnoon closed 7 years ago
We should log a bug with Apple about this. It's really odd that the compiler can't disambiguate the return types.
Crazy idea: make String
conform to Message and drop the string only APIs (no idea if that actually works). Would that pollute the String
namespace with name
? Unclear if this is dumb or genius...
This PR fixes an issue we identified in the Willow 4.0.0 release where the escaping closure APIs are ambiguous when the closure is multiline. The compiler can't infer what the return type of the closure is unfortunately. You can declare the return type of the closure to fix the ambiguity error, but that's less than ideal.
These changes fix the ambiguity by changing the log message string APIs to include the
Message
suffix. This fixes the ambiguity properly. The only question is whether this is the best way to name the APIs. I think this makes the usage the most readable.I'm open to suggestions if anyone thinks there's a better way. If someone can come up with a backwards compatible solution that doesn't require declaring the return type to the compiler, I'm all ears.