Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/Sema/TypeCheckStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2896,8 +2896,11 @@ IsAccessorTransparentRequest::evaluate(Evaluator &evaluator,
break;
}

// Anything else should not have a synthesized setter.
LLVM_FALLTHROUGH;
// Anything else we'll synthesize an invalid setter for in
// `synthesizeSetterBody`, this happens for cases such as stored
// properties defined in extensions or enums, we implicitly treat them as
// computed.
return false;
case WriteImplKind::Immutable:
if (accessor->getASTContext().LangOpts.AllowModuleWithCompilerErrors)
return false;
Expand Down
7 changes: 7 additions & 0 deletions test/decl/var/properties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,13 @@ extension ProtocolWithExtension1 {
static var fooExtStatic = 4 // expected-error{{static stored properties not supported in protocol extensions}}
}

// https://github.com/swiftlang/swift/issues/83969
// Make sure we don't crash.
public struct PublicTypeWithExt {}
extension PublicTypeWithExt {
public var foo: Int? // expected-error {{extensions must not contain stored properties}}
}

protocol ProtocolWithExtension2 {
var bar: String { get }
}
Expand Down