Skip to content

Commit 2e9fb5a

Browse files
authored
Merge pull request swiftlang#36723 from CodaFi/extension-cord
Add a Null Check for Missing Generic Signatures
2 parents 67ef887 + 9e496d3 commit 2e9fb5a

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

lib/AST/DeclContext.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,9 @@ bool DeclContext::hasValueSemantics() const {
11881188
bool DeclContext::isClassConstrainedProtocolExtension() const {
11891189
if (getExtendedProtocolDecl()) {
11901190
auto ED = cast<ExtensionDecl>(this);
1191-
return ED->getGenericSignature()->requiresClass(ED->getSelfInterfaceType());
1191+
if (auto sig = ED->getGenericSignature()) {
1192+
return sig->requiresClass(ED->getSelfInterfaceType());
1193+
}
11921194
}
11931195
return false;
11941196
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: not %target-swift-frontend -typecheck %s
2+
3+
struct MyStruct {}
4+
protocol MyProtocol {}
5+
6+
func foo(bytes: [MyStruct]) {
7+
bytes.withUnsafeBufferPointer { a in
8+
extension MyProtocol {
9+
  var bytes: MyStruct {
10+
    fatalError()
11+
  }
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)