Skip to content

Commit 9da79dd

Browse files
authored
Merge pull request #8107 from slavapestov/multi-file-protocol-assert-fail
Sema: Fix assertion when performing conformance check of protocol in another file
2 parents d666484 + 7809446 commit 9da79dd

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7165,7 +7165,8 @@ void TypeChecker::validateDecl(ValueDecl *D) {
71657165

71667166
validateAttributes(*this, D);
71677167

7168-
proto->computeRequirementSignature();
7168+
if (!proto->isRequirementSignatureComputed())
7169+
proto->computeRequirementSignature();
71697170

71707171
// If the protocol is @objc, it may only refine other @objc protocols.
71717172
// FIXME: Revisit this restriction.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
protocol ObservableType {
2+
func subscribe<O>(_: O)
3+
}
4+
5+
protocol ConnectableObservableType : ObservableType {
6+
func connect()
7+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// RUN: %target-swift-frontend -typecheck -primary-file %s %S/Inputs/requirement-signature.swift
2+
3+
func run<CO: ConnectableObservableType, O>(co: CO, o: O) {
4+
co.subscribe(o)
5+
}

0 commit comments

Comments
 (0)