Skip to content

Commit cbacece

Browse files
authored
Merge pull request #83971 from hamishknight/set-point
2 parents a9a6bf4 + 8cc5d06 commit cbacece

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lib/Sema/TypeCheckStorage.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2896,8 +2896,11 @@ IsAccessorTransparentRequest::evaluate(Evaluator &evaluator,
28962896
break;
28972897
}
28982898

2899-
// Anything else should not have a synthesized setter.
2900-
LLVM_FALLTHROUGH;
2899+
// Anything else we'll synthesize an invalid setter for in
2900+
// `synthesizeSetterBody`, this happens for cases such as stored
2901+
// properties defined in extensions or enums, we implicitly treat them as
2902+
// computed.
2903+
return false;
29012904
case WriteImplKind::Immutable:
29022905
if (accessor->getASTContext().LangOpts.AllowModuleWithCompilerErrors)
29032906
return false;

test/decl/var/properties.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,13 @@ extension ProtocolWithExtension1 {
484484
static var fooExtStatic = 4 // expected-error{{static stored properties not supported in protocol extensions}}
485485
}
486486

487+
// https://github.com/swiftlang/swift/issues/83969
488+
// Make sure we don't crash.
489+
public struct PublicTypeWithExt {}
490+
extension PublicTypeWithExt {
491+
public var foo: Int? // expected-error {{extensions must not contain stored properties}}
492+
}
493+
487494
protocol ProtocolWithExtension2 {
488495
var bar: String { get }
489496
}

0 commit comments

Comments
 (0)