Skip to content

Commit 0dcb78f

Browse files
authored
Merge pull request #29389 from xedin/rdar-50666427
[Diagnostics] Unsatisfied requirement `in reference` diagnostics expe…
2 parents 48ba315 + d412ea4 commit 0dcb78f

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

lib/Sema/CSDiagnostics.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,9 @@ bool RequirementFailure::diagnoseAsError() {
337337
return true;
338338
}
339339

340-
if (genericCtx != reqDC && (genericCtx->isChildContextOf(reqDC) ||
341-
isStaticOrInstanceMember(AffectedDecl))) {
340+
if (reqDC->isTypeContext() && genericCtx != reqDC &&
341+
(genericCtx->isChildContextOf(reqDC) ||
342+
isStaticOrInstanceMember(AffectedDecl))) {
342343
auto *NTD = reqDC->getSelfNominalTypeDecl();
343344
emitDiagnostic(anchor->getLoc(), getDiagnosticInRereference(),
344345
AffectedDecl->getDescriptiveKind(),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: not %target-swift-frontend %s -typecheck
2+
3+
protocol A {}
4+
5+
class C<T> where T: A {}
6+
7+
extension C {
8+
func foo() {
9+
extension C where T: Undefined {
10+
class Inner: Encodable {
11+
var foo: Int
12+
}
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)