Skip to content

Commit 41c04c5

Browse files
committed
RequirementMachine: Add a comment explaining a recent change to concrete contraction
1 parent 6b48eb6 commit 41c04c5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/AST/RequirementMachine/ConcreteContraction.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,17 @@ bool ConcreteContraction::performConcreteContraction(
599599
// requirement where the left hand side is not a type parameter.
600600
SmallVector<Requirement, 4> reqs;
601601
if (req.inferred) {
602+
// Discard errors from desugaring a substituted requirement that
603+
// was inferred. For example, if we have something like
604+
//
605+
// <T, U where T == Int, U == Set<T>>
606+
//
607+
// The inferred requirement 'T : Hashable' from 'Set<>' will
608+
// be substituted with 'T == Int' to get 'Int : Hashable'.
609+
//
610+
// Desugaring will diagnose a redundant conformance requirement,
611+
// but we want to ignore that, since the user did not explicitly
612+
// write 'Int : Hashable' (or 'T : Hashable') anywhere.
602613
SmallVector<RequirementError, 4> discardErrors;
603614
desugarRequirement(substReq, SourceLoc(), reqs, discardErrors);
604615
} else {

0 commit comments

Comments
 (0)