File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
lib/AST/RequirementMachine Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -721,20 +721,27 @@ MutableTerm
721
721
RequirementMachine::getReducedShapeTerm (Type type) const {
722
722
assert (type->isParameterPack ());
723
723
724
- auto rootType = type->getRootGenericParam ();
725
- auto term = Context.getMutableTermForType (rootType->getCanonicalType (),
724
+ auto term = Context.getMutableTermForType (type->getCanonicalType (),
726
725
/* proto=*/ nullptr );
727
726
728
- // Append the 'shape' symbol to the term.
727
+ // From a type term T, form the shape term `T.[shape]` .
729
728
term.add (Symbol::forShape (Context));
730
729
730
+ // Compute the reduced shape term `T'.[shape]`.
731
731
System.simplify (term);
732
732
verify (term);
733
733
734
- // Remove the 'shape' symbol from the term.
735
- assert (term.back ().getKind () == Symbol::Kind::Shape);
736
- MutableTerm reducedTerm (term.begin (), term.end () - 1 );
734
+ // Get the term T', which is the reduced shape of T.
735
+ if (term.size () != 2 ||
736
+ term[0 ].getKind () != Symbol::Kind::GenericParam ||
737
+ term[1 ].getKind () != Symbol::Kind::Shape) {
738
+ llvm::errs () << " Invalid reduced shape\n " ;
739
+ llvm::errs () << " Type: " << type << " \n " ;
740
+ llvm::errs () << " Term: " << term << " \n " ;
741
+ abort ();
742
+ }
737
743
744
+ MutableTerm reducedTerm (term.begin (), term.end () - 1 );
738
745
return reducedTerm;
739
746
}
740
747
You can’t perform that action at this time.
0 commit comments