mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
RequirementMachine: Homotopy reduction tweaks
- Skip permanent rules (there's no point, we'll add them back next time) - Skip conformance rules (these will be handled separately) - Delete 3-cells that are entirely "in-context" (but don't quote me on this one, I'm not quite yet convinced it's correct, but it feels right)
This commit is contained in:
@@ -23,6 +23,12 @@
|
||||
using namespace swift;
|
||||
using namespace rewriting;
|
||||
|
||||
/// If this is a rule of the form T.[p] => T where [p] is a property symbol,
|
||||
/// returns the symbol. Otherwise, returns None.
|
||||
///
|
||||
/// Note that this is meant to be used with a simplified rewrite system,
|
||||
/// where the right hand sides of rules are canonical, since this also means
|
||||
/// that T is canonical.
|
||||
Optional<Symbol> Rule::isPropertyRule() const {
|
||||
auto property = LHS.back();
|
||||
|
||||
@@ -38,6 +44,8 @@ Optional<Symbol> Rule::isPropertyRule() const {
|
||||
return property;
|
||||
}
|
||||
|
||||
/// If this is a rule of the form T.[p] => T where [p] is a protocol symbol,
|
||||
/// return true, otherwise return false.
|
||||
bool Rule::isProtocolConformanceRule() const {
|
||||
if (auto property = isPropertyRule())
|
||||
return property->getKind() == Symbol::Kind::Protocol;
|
||||
@@ -418,8 +426,8 @@ void RewriteSystem::dump(llvm::raw_ostream &out) const {
|
||||
out << "}\n";
|
||||
out << "Homotopy generators: {\n";
|
||||
for (const auto &loop : HomotopyGenerators) {
|
||||
out << "- " << loop.Basepoint << ": ";
|
||||
loop.Path.dump(out, loop.Basepoint, *this);
|
||||
out << "- ";
|
||||
loop.dump(out, *this);
|
||||
out << "\n";
|
||||
}
|
||||
out << "}\n";
|
||||
|
||||
Reference in New Issue
Block a user