Skip to content

Commit b145ed2

Browse files
committed
RequirementMachine: Write some comments
1 parent 61805a5 commit b145ed2

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

include/swift/AST/RewriteSystem.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ enum class OverlapKind {
219219
/// The first atom in the term must be a protocol, generic parameter, or
220220
/// associated type atom.
221221
///
222-
/// A layout constraint atom must only appear at the end of a term.
222+
/// A layout, superclass or concrete type atom must only appear at the
223+
/// end of a term.
223224
///
224225
/// Out-of-line methods are documented in RewriteSystem.cpp.
225226
class Term final {

lib/AST/RewriteSystem.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,6 +1357,17 @@ void RewriteSystem::processMergedAssociatedTypes() {
13571357
/// There is also an additional wrinkle. If we're in case 2, and the
13581358
/// last atom of V is a superclass or concrete type atom A, we prepend
13591359
/// T to each substitution of A.
1360+
///
1361+
/// For example, suppose we have the following two rules:
1362+
///
1363+
/// A.B -> C
1364+
/// B.[concrete: Foo<X>] -> B
1365+
///
1366+
/// The overlapped term is A.B.[concrete: Foo<X>], so the critical pair
1367+
/// is (C.[concrete: Foo<A.X>], A.B). We prepended 'A' to the
1368+
/// concrete substitution 'X' to get 'A.X'; the new concrete term
1369+
/// is now rooted at the same level as A.B in the rewrite system,
1370+
/// not just B.
13601371
Optional<std::pair<MutableTerm, MutableTerm>>
13611372
RewriteSystem::computeCriticalPair(const Rule &lhs, const Rule &rhs) const {
13621373
MutableTerm t, v;

0 commit comments

Comments
 (0)