Open
Description
Swift adopted a lot of attributes over the years, and sometimes it can be hard to remember where an attribute is supposed to go. Here’s an example where the compiler fails to issue a helpful reminder:
@resultBuilder
struct Builder {
static func buildBlock() {}
}
func foo(_: @Builder () -> Void) {} // error: unknown attribute 'Builder'
Result builder attributes are custom declaration attributes, so a much better diagnosis would be something along the lines of result builder attribute 'Builder' must be applied to the <declaration kind> instead
plus a corresponding fix-it.
I suspect this problem is not exclusive to result builders. Prospectively, we should probably look into devising a general solution for diagnosing declaration attributes on types and vice versa.