Skip to content

Commit 1c849cf

Browse files
committed
Sema: Allow parametrized protocols in opaque return position
1 parent 8f2e11a commit 1c849cf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Sema/TypeCheckGeneric.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ OpaqueResultTypeRequest::evaluate(Evaluator &evaluator,
250250

251251
// Error out if the constraint type isn't a class or existential type.
252252
if (!constraintType->getClassOrBoundGenericClass() &&
253-
!constraintType->isExistentialType()) {
253+
!constraintType->is<ProtocolType>() &&
254+
!constraintType->is<ProtocolCompositionType>() &&
255+
!constraintType->is<ParametrizedProtocolType>()) {
254256
ctx.Diags.diagnose(currentRepr->getLoc(),
255257
diag::opaque_type_invalid_constraint);
256258
return nullptr;

0 commit comments

Comments
 (0)