Skip to content

Commit 2dd14af

Browse files
committed
RequirementMachine: Minor comment fixes
1 parent 71cdfff commit 2dd14af

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

lib/AST/RequirementMachine/HomotopyReduction.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212
//
13-
//
1413
// This file implements the algorithm for computing a minimal set of rules from
1514
// a confluent rewrite system. A minimal set of rules is:
1615
//
@@ -76,7 +75,10 @@ using namespace rewriting;
7675
llvm::SmallVector<unsigned, 1>
7776
RewriteLoop::findRulesAppearingOnceInEmptyContext(
7877
const RewriteSystem &system) const {
78+
// Rules appearing in empty context (possibly more than once).
7979
llvm::SmallDenseSet<unsigned, 2> rulesInEmptyContext;
80+
81+
// The number of times each rule appears (with or without context).
8082
llvm::SmallDenseMap<unsigned, unsigned, 2> ruleMultiplicity;
8183

8284
RewritePathEvaluator evaluator(Basepoint);
@@ -100,6 +102,7 @@ RewriteLoop::findRulesAppearingOnceInEmptyContext(
100102
step.apply(evaluator, system);
101103
}
102104

105+
// Collect all rules that we saw exactly once in empty context.
103106
SmallVector<unsigned, 1> result;
104107
for (auto rule : rulesInEmptyContext) {
105108
auto found = ruleMultiplicity.find(rule);
@@ -759,8 +762,10 @@ void RewriteSystem::minimizeRewriteSystem() {
759762
// Now find a minimal set of generating conformances.
760763
//
761764
// FIXME: For now this just produces a set of redundant conformances, but
762-
// it should actually compute the full generating conformance basis, since
763-
// we want to use the same information for finding conformance access paths.
765+
// it should actually output the canonical generating conformance equation
766+
// for each non-generating conformance. We can then use information to
767+
// compute conformance access paths, instead of the current "brute force"
768+
// algorithm used for that purpose.
764769
llvm::DenseSet<unsigned> redundantConformances;
765770
computeGeneratingConformances(redundantConformances);
766771

lib/AST/RequirementMachine/RewriteSystem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ bool Rule::isProtocolRefinementRule() const {
7474
LHS[1].getKind() == Symbol::Kind::Protocol &&
7575
LHS[0] != LHS[1]) {
7676

77-
// A protocol refinement rule only if it comes from a directly-stated
77+
// A protocol refinement rule must be from a directly-stated
7878
// inheritance clause entry. It can only become redundant if it is
7979
// written in terms of other protocol refinement rules; otherwise, it
8080
// must appear in the protocol's requirement signature.
8181
//
82-
// See RewriteSystem::isValidRefinementPath().
82+
// See RewriteSystem::isValidRefinementPath() for an explanation.
8383
auto *proto = LHS[0].getProtocol();
8484
auto *otherProto = LHS[1].getProtocol();
8585

0 commit comments

Comments
 (0)