Skip to content

Conversation

meg-gupta
Copy link
Contributor

@meg-gupta meg-gupta commented Sep 9, 2025

Add support for borrow and mutate accessors in the swift parser.

@meg-gupta
Copy link
Contributor Author

@swift-ci test

var _otherK: Klass
var k1: Klass {
borrow {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just want to mention that this will be source breaking for the following code, which is currently valid. I’ll leave it up to you to decide whether that source breakage is acceptable.

func borrow<T>(_ x: () -> T) -> T { return x() } var x: Int { borrow { 1 } }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing that out. This is currently experimental and is not an immediate problem. We may gate the feature on language version in the future if source breakage becomes a concern.

@meg-gupta meg-gupta force-pushed the borrowandmutateaccessors branch from 9af2aaa to d165336 Compare September 25, 2025 22:45
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci smoke test

@meg-gupta meg-gupta merged commit 974c292 into swiftlang:main Sep 26, 2025
33 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants