Skip to content

[ConstraintSystem] Detect and diagnoses use of members with mutating getters in key path #24097

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

Merged
merged 4 commits into from
Apr 18, 2019

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Apr 17, 2019

Such use is currently not allowed so variables or subscripts with
mutating getters should be rejected and diagnosed.

struct S {
  var foo: Int {
    mutating get { return 42 }
  }

  subscript(_: Int) -> Bool {
    mutating get { return false }
  }
}

_ = \S.foo
_ = \S.[0]

Resolves: rdar://problem/49413561

@xedin
Copy link
Contributor Author

xedin commented Apr 17, 2019

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Apr 17, 2019

@swift-ci please test source compatibility

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - eaf1dc0

@xedin
Copy link
Contributor Author

xedin commented Apr 17, 2019

@swift-ci please test Linux platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - eaf1dc0

@xedin
Copy link
Contributor Author

xedin commented Apr 18, 2019

@swift-ci please test Linux platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - eaf1dc0

@xedin
Copy link
Contributor Author

xedin commented Apr 18, 2019

@swift-ci please test Linux platform

@xedin xedin merged commit 2340350 into swiftlang:master Apr 18, 2019
xedin added a commit to xedin/swift that referenced this pull request Apr 18, 2019
…getters in key path

Such use is currently not allowed so variables or subscripts with
mutating getters should be rejected and diagnosed.

```swift
struct S {
  var foo: Int {
    mutating get { return 42 }
  }

  subscript(_: Int) -> Bool {
    mutating get { return false }
  }
}

_ = \S.foo
_ = \S.[0]
```

Resolves: rdar://problem/49413561

(PR swiftlang#24097)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants