Skip to content

Commit feb8684

Browse files
committed
[Diagnostics] Add a clarifying note about result type for invalid member ref diagnostic
1 parent dcd7469 commit feb8684

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7212,6 +7212,11 @@ bool InvalidMemberRefOnProtocolMetatype::diagnoseAsError() {
72127212
emitDiagnostic(diag::type_does_not_conform_in_member_ref_on_protocol_type,
72137213
member->getDescriptiveKind(), member->getName(),
72147214
MetatypeType::get(protocolTy), resultTy);
7215+
7216+
if (resultTy->is<FunctionType>() || resultTy->is<TupleType>() ||
7217+
resultTy->isExistentialType() || resultTy->is<AnyMetatypeType>())
7218+
emitDiagnostic(diag::only_concrete_types_conform_to_protocols);
7219+
72157220
emitDiagnosticAt(member, diag::decl_declared_here, member->getName());
72167221
return true;
72177222
}

0 commit comments

Comments
 (0)