File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
lib/ASTGen/Sources/ASTGen Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -2066,17 +2066,18 @@ extension ASTGenVisitor {
2066
2066
kind = . weak
2067
2067
guard node. detail == nil else {
2068
2068
// TODO: Diagnose.
2069
- return nil
2069
+ fatalError ( " invalid argument for 'weak' modifier " )
2070
2070
}
2071
2071
case . unowned:
2072
- switch node. detail? . detail. keywordKind {
2073
- case . safe, nil :
2072
+ switch node. detail? . detail. rawText {
2073
+ case " safe " , nil :
2074
2074
kind = . unowned
2075
- case . unsafe:
2075
+ case " unsafe " :
2076
2076
kind = . unmanaged
2077
- case _ ? :
2077
+ case let text ? :
2078
2078
// TODO: Diagnose
2079
- kind = . unowned
2079
+ _ = text
2080
+ fatalError ( " invalid argument for 'unowned' modifier " )
2080
2081
}
2081
2082
default :
2082
2083
preconditionFailure ( " ReferenceOwnership modifier must be 'weak' or 'unowned' " )
Original file line number Diff line number Diff line change @@ -227,3 +227,10 @@ func testNonIsolated(actor: MyActor) {
227
227
_ = actor . constFlag
228
228
_ = actor . mutableFlag
229
229
}
230
+
231
+ struct ReferenceOwnershipModifierTest < X: AnyObject > {
232
+ weak var weakValue : X ?
233
+ unowned var unownedValue : X
234
+ unowned(safe) var unownedSafeValue : X
235
+ unowned(unsafe) var unmanagedValue : X
236
+ }
You can’t perform that action at this time.
0 commit comments