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

[SR-11989] Better diagnostic for invalid 'enclosing self' property wrapper subscript #54422

Open
slavapestov opened this issue Jan 3, 2020 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation good first issue Good for newcomers property wrappers Feature: property wrappers swift 5.9

Comments

@slavapestov
Copy link
Member

slavapestov commented Jan 3, 2020

Previous ID SR-11989
Radar rdar://problem/58438128
Original Reporter @slavapestov
Type Bug
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug, StarterBug
Assignee janebond (JIRA)
Priority Medium

md5: 20d8a77f9190fc316ad55bfd7bb733b2

Issue Description:

This used to emit bad diagnostics and then crash the compiler. I've fixed the crash but we need to fix the bad diagnostic:

public class Store {
    @Published public var state: Any
    init() {
      self.state = 0
    }
}

@propertyWrapper public struct Published<Value> {
  public init(wrappedValue: Value) {}
  public var wrappedValue: Value {
    get { fatalError() }
    set {}
  }
  public static subscript(_enclosingInstance object: Any,
                          wrapped wrappedKeyPath: Any,
                          storage storageKeyPath: Any)
      -> Value {
    get { fatalError() }
    set {}
  }
  public struct Publisher {}
  public var projectedValue: Publisher {
    mutating get { fatalError() }
  }
}
@slavapestov
Copy link
Member Author

@swift-ci create

1 similar comment
@slavapestov
Copy link
Member Author

@swift-ci create

@slavapestov
Copy link
Member Author

I also added this FIXME to buildStorageReference(); probably it should be addressed at the same time:

    // FIXME: Since we're not resolving overloads or anything, we should be
    // building fully type-checked AST above; we already have all the
    // information that we need.

@swift-ci
Copy link
Collaborator

Comment by Hassan ElDesouky (JIRA)

@slavapestov Can you provide more details?

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation property wrappers Feature: property wrappers swift 5.9 labels Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation good first issue Good for newcomers property wrappers Feature: property wrappers swift 5.9
Projects
None yet
Development

No branches or pull requests

3 participants