Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result builder inference from protocol requirement does not work when the attribute is attached to getter #76746

Closed
AnthonyLatsis opened this issue Sep 27, 2024 · 0 comments · Fixed by #76749
Assignees
Labels
attributes Feature: Declaration and type attributes bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself conformances Feature → protocol: protocol conformances result builders Feature: Result builders swift 6.1 type checker Area → compiler: Semantic analysis unexpected error Bug: Unexpected error

Comments

@AnthonyLatsis
Copy link
Collaborator

Description

No response

Reproduction

@resultBuilder
enum Builder<T> {
  static func buildBlock(_ t: T...) -> Bool {true}
}
protocol P {
  var x: Bool { @Builder<Int> get }
}
struct Test: P {
  var x: Bool { 1 }
}
error: integer literal value '1' cannot be used as a boolean; did you mean 'true'? [integer_used_as_boolean_literal]
  var x: Bool { 1 }
                ^
                true

Expected behavior

Successful compilation.

Environment

Swift version 6.1-dev (614e8aa)

Additional information

No response

@AnthonyLatsis AnthonyLatsis added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself type checker Area → compiler: Semantic analysis conformances Feature → protocol: protocol conformances result builders Feature: Result builders attributes Feature: Declaration and type attributes unexpected error Bug: Unexpected error swift 6.1 labels Sep 27, 2024
@AnthonyLatsis AnthonyLatsis self-assigned this Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attributes Feature: Declaration and type attributes bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself conformances Feature → protocol: protocol conformances result builders Feature: Result builders swift 6.1 type checker Area → compiler: Semantic analysis unexpected error Bug: Unexpected error
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant