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 dynamically replaced decl does not work when the attribute is attached to getter #76747

Open
AnthonyLatsis opened this issue Sep 27, 2024 · 0 comments · May be 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 @_dynamicReplacement Feature → attributes: the @_dynamicReplacement attribute 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}
}
struct Test {
  dynamic var x: Bool { @Builder<Int> get { 1 } }
}
extension Test {
  @_dynamicReplacement(for: x)
  var new_x: Bool { 1 }
}
/Users/mac/Desktop/test.swift:335:21: error: integer literal value '1' cannot be used as a boolean; did you mean 'true'? [integer_used_as_boolean_literal]
  var new_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 result builders Feature: Result builders attributes Feature: Declaration and type attributes @_dynamicReplacement Feature → attributes: the @_dynamicReplacement attribute 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 @_dynamicReplacement Feature → attributes: the @_dynamicReplacement attribute 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