Skip to content

Commit 77e2f4c

Browse files
committed
RequirementMachine: getRequirementForDiagnostics() doesn't need to return an Optional
1 parent f901cc7 commit 77e2f4c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/AST/RequirementMachine/Diagnostics.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ void RewriteSystem::computeRedundantRequirementDiagnostics(
351351
}
352352
}
353353

354-
static Optional<Requirement>
354+
static Requirement
355355
getRequirementForDiagnostics(Type subject, Symbol property,
356356
const PropertyMap &map,
357357
TypeArrayView<GenericTypeParamType> genericParams,
@@ -380,7 +380,8 @@ getRequirementForDiagnostics(Type subject, Symbol property,
380380
property.getLayoutConstraint());
381381

382382
default:
383-
return None;
383+
llvm::errs() << "Bad property symbol: " << property << "\n";
384+
abort();
384385
}
385386
}
386387

@@ -413,10 +414,10 @@ void RewriteSystem::computeConflictDiagnostics(
413414
Type subject = propertyMap.getTypeForTerm(subjectTerm, genericParams);
414415
MutableTerm prefix(subjectTerm.begin(), subjectTerm.end() - suffixTerm.size());
415416
errors.push_back(RequirementError::forConflictingRequirement(
416-
*getRequirementForDiagnostics(subject, *subjectRule.isPropertyRule(),
417-
propertyMap, genericParams, MutableTerm()),
418-
*getRequirementForDiagnostics(subject, *suffixRule.isPropertyRule(),
419-
propertyMap, genericParams, prefix),
417+
getRequirementForDiagnostics(subject, *subjectRule.isPropertyRule(),
418+
propertyMap, genericParams, MutableTerm()),
419+
getRequirementForDiagnostics(subject, *suffixRule.isPropertyRule(),
420+
propertyMap, genericParams, prefix),
420421
signatureLoc));
421422
}
422423
}

0 commit comments

Comments
 (0)