Skip to content

For 'lazy', make "cannot override with a stored property" a warning #13304

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

Conversation

jrose-apple
Copy link
Contributor

Previous versions of Swift accidentally treated lazy properties as computed properties because of how they were implemented. Now that we check this correctly, we've broken source compatibility. Downgrade the error to a warning in this case.

(Arguably we could allow overriding with a stored property. The original concerns were that you could accidentally end up with extra storage you didn't need, and that observing accessors would behave differently based on whether or not the property was overriding. But there's at least no ambiguity for 'lazy', which can't have observing accessors today.)

rdar://problem/35870371

Previous versions of Swift accidentally treated lazy properties as
computed properties because of how they were implemented. Now that we
check this correctly, we've broken source compatibility. Downgrade the
error to a warning in this case.

(Arguably we could /allow/ overriding with a stored property. The
original concerns were that you could accidentally end up with extra
storage you didn't need, and that observing accessors would behave
differently based on whether or not the property was overriding. But
there's at least no ambiguity for 'lazy', which can't have observing
accessors today.)

rdar://problem/35870371
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple jrose-apple merged commit 7c707ce into swiftlang:master Dec 6, 2017
@jrose-apple jrose-apple deleted the lazy-override-lax-enforcement branch December 6, 2017 21:41
jrose-apple added a commit to jrose-apple/swift that referenced this pull request Dec 6, 2017
…wiftlang#13304)

Previous versions of Swift accidentally treated lazy properties as
computed properties because of how they were implemented. Now that we
check this correctly, we've broken source compatibility. Downgrade the
error to a warning in this case.

(Arguably we could /allow/ overriding with a stored property. The
original concerns were that you could accidentally end up with extra
storage you didn't need, and that observing accessors would behave
differently based on whether or not the property was overriding. But
there's at least no ambiguity for 'lazy', which can't have observing
accessors today.)

rdar://problem/35870371
(cherry picked from commit 7c707ce)
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