Skip to content

Conversation

@calda
Copy link
Contributor

@calda calda commented Jan 3, 2026

This PR adds a proposal to support inferring generic arguments of result builder attributes.

For example, this sample code is currently rejected with the error "reference to generic type 'ArrayBuilder' requires arguments in <...>", but would compile successfully by inferring it as ArrayBuilder<String>.

@resultBuilder
struct ArrayBuilder<Element> {
  static func buildBlock(_ elements: Element...) -> [Element] {
    elements
  }
}

@ArrayBuilder
var stringArray: [String] {
  "foo"
  "bar"
}

@calda calda force-pushed the cal--infer-result-builder-generics branch from 02f1b16 to d8caf3e Compare January 3, 2026 21:22
@calda calda changed the title Add proposal to support inferring generic arguments of result builder attributes Infer generic arguments of result builder attributes Jan 3, 2026
@calda calda force-pushed the cal--infer-result-builder-generics branch from d8caf3e to b4ca275 Compare January 3, 2026 22:23
@calda calda force-pushed the cal--infer-result-builder-generics branch from b4ca275 to 3ec7b0d Compare January 5, 2026 00:08
@rjmccall rjmccall added LSG Contains topics under the domain of the Language Steering Group new proposal Adds a new proposal document labels Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LSG Contains topics under the domain of the Language Steering Group new proposal Adds a new proposal document

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants