@@ -56,7 +56,6 @@ static void recordRelation(Term key,
56
56
unsigned lhsRuleID,
57
57
Symbol rhsProperty,
58
58
RewriteSystem &system,
59
- SmallVectorImpl<InducedRule> &inducedRules,
60
59
bool debug) {
61
60
const auto &lhsRule = system.getRule (lhsRuleID);
62
61
auto lhsProperty = lhsRule.getLHS ().back ();
@@ -141,19 +140,17 @@ namespace {
141
140
ArrayRef<Term> rhsSubstitutions;
142
141
RewriteContext &ctx;
143
142
RewriteSystem &system;
144
- SmallVectorImpl<InducedRule> &inducedRules;
145
143
bool debug;
146
144
147
145
public:
148
146
ConcreteTypeMatcher (ArrayRef<Term> lhsSubstitutions,
149
147
ArrayRef<Term> rhsSubstitutions,
150
148
RewriteSystem &system,
151
- SmallVectorImpl<InducedRule> &inducedRules,
152
149
bool debug)
153
150
: lhsSubstitutions(lhsSubstitutions),
154
151
rhsSubstitutions (rhsSubstitutions),
155
152
ctx(system.getRewriteContext()), system(system),
156
- inducedRules(inducedRules), debug(debug) {}
153
+ debug(debug) {}
157
154
158
155
bool alwaysMismatchTypeParameters () const { return true ; }
159
156
@@ -260,7 +257,6 @@ namespace {
260
257
// / Returns true if a conflict was detected.
261
258
static bool unifyConcreteTypes (
262
259
Symbol lhs, Symbol rhs, RewriteSystem &system,
263
- SmallVectorImpl<InducedRule> &inducedRules,
264
260
bool debug) {
265
261
auto lhsType = lhs.getConcreteType ();
266
262
auto rhsType = rhs.getConcreteType ();
@@ -271,7 +267,7 @@ static bool unifyConcreteTypes(
271
267
272
268
ConcreteTypeMatcher matcher (lhs.getSubstitutions (),
273
269
rhs.getSubstitutions (),
274
- system, inducedRules, debug);
270
+ system, debug);
275
271
if (!matcher.match (lhsType, rhsType)) {
276
272
// FIXME: Diagnose the conflict
277
273
if (debug) {
@@ -308,7 +304,6 @@ static bool unifyConcreteTypes(
308
304
// / that gets recorded in the property map.
309
305
static std::pair<Symbol, bool > unifySuperclasses (
310
306
Symbol lhs, Symbol rhs, RewriteSystem &system,
311
- SmallVectorImpl<InducedRule> &inducedRules,
312
307
bool debug) {
313
308
if (debug) {
314
309
llvm::dbgs () << " % Unifying " << lhs << " with " << rhs << " \n " ;
@@ -351,7 +346,7 @@ static std::pair<Symbol, bool> unifySuperclasses(
351
346
// Unify type contructor arguments.
352
347
ConcreteTypeMatcher matcher (lhs.getSubstitutions (),
353
348
rhs.getSubstitutions (),
354
- system, inducedRules, debug);
349
+ system, debug);
355
350
if (!matcher.match (lhsType, rhsType)) {
356
351
if (debug) {
357
352
llvm::dbgs () << " %% Superclass conflict\n " ;
@@ -366,8 +361,7 @@ static std::pair<Symbol, bool> unifySuperclasses(
366
361
// / Record a protocol conformance, layout or superclass constraint on the given
367
362
// / key. Must be called in monotonically non-decreasing key order.
368
363
void PropertyMap::addProperty (
369
- Term key, Symbol property, unsigned ruleID,
370
- SmallVectorImpl<InducedRule> &inducedRules) {
364
+ Term key, Symbol property, unsigned ruleID) {
371
365
assert (property.isProperty ());
372
366
assert (*System.getRule (ruleID).isPropertyRule () == property);
373
367
auto *props = getOrCreateProperties (key);
@@ -401,17 +395,15 @@ void PropertyMap::addProperty(
401
395
// the new layout requirement is redundant.
402
396
if (mergedLayout == props->Layout ) {
403
397
if (checkRulePairOnce (*props->LayoutRule , ruleID)) {
404
- recordRelation (key, *props->LayoutRule , property, System,
405
- inducedRules, debug);
398
+ recordRelation (key, *props->LayoutRule , property, System, debug);
406
399
}
407
400
408
401
// If the intersection is equal to the new layout requirement, the
409
402
// existing layout requirement is redundant.
410
403
} else if (mergedLayout == newLayout) {
411
404
if (checkRulePairOnce (ruleID, *props->LayoutRule )) {
412
405
auto oldProperty = System.getRule (*props->LayoutRule ).getLHS ().back ();
413
- recordRelation (key, ruleID, oldProperty, System,
414
- inducedRules, debug);
406
+ recordRelation (key, ruleID, oldProperty, System, debug);
415
407
}
416
408
417
409
props->LayoutRule = ruleID;
@@ -437,8 +429,7 @@ void PropertyMap::addProperty(
437
429
Context.getASTContext ());
438
430
auto layoutSymbol = Symbol::forLayout (layout, Context);
439
431
440
- recordRelation (key, ruleID, layoutSymbol, System,
441
- inducedRules, debug);
432
+ recordRelation (key, ruleID, layoutSymbol, System, debug);
442
433
}
443
434
444
435
if (!props->Superclass ) {
@@ -447,7 +438,7 @@ void PropertyMap::addProperty(
447
438
} else {
448
439
assert (props->SuperclassRule .hasValue ());
449
440
auto pair = unifySuperclasses (*props->Superclass , property,
450
- System, inducedRules, debug);
441
+ System, debug);
451
442
props->Superclass = pair.first ;
452
443
bool conflict = pair.second ;
453
444
if (conflict) {
@@ -466,7 +457,7 @@ void PropertyMap::addProperty(
466
457
} else {
467
458
assert (props->ConcreteTypeRule .hasValue ());
468
459
bool conflict = unifyConcreteTypes (*props->ConcreteType , property,
469
- System, inducedRules, debug);
460
+ System, debug);
470
461
if (conflict) {
471
462
recordConflict (key, *props->ConcreteTypeRule , ruleID, System);
472
463
return ;
@@ -489,8 +480,7 @@ void PropertyMap::addProperty(
489
480
llvm_unreachable (" Bad symbol kind" );
490
481
}
491
482
492
- void PropertyMap::checkConcreteTypeRequirements (
493
- SmallVectorImpl<InducedRule> &inducedRules) {
483
+ void PropertyMap::checkConcreteTypeRequirements () {
494
484
bool debug = Debug.contains (DebugFlags::ConcreteUnification);
495
485
496
486
for (auto *props : Entries) {
@@ -505,8 +495,7 @@ void PropertyMap::checkConcreteTypeRequirements(
505
495
Context);
506
496
507
497
recordRelation (props->getKey (), *props->ConcreteTypeRule ,
508
- superclassSymbol, System,
509
- inducedRules, debug);
498
+ superclassSymbol, System, debug);
510
499
511
500
// Otherwise, we have a concrete vs superclass conflict.
512
501
} else {
@@ -518,8 +507,7 @@ void PropertyMap::checkConcreteTypeRequirements(
518
507
}
519
508
}
520
509
521
- void PropertyMap::concretizeNestedTypesFromConcreteParents (
522
- SmallVectorImpl<InducedRule> &inducedRules) {
510
+ void PropertyMap::concretizeNestedTypesFromConcreteParents () {
523
511
for (auto *props : Entries) {
524
512
if (props->getConformsTo ().empty ())
525
513
continue ;
@@ -546,8 +534,7 @@ void PropertyMap::concretizeNestedTypesFromConcreteParents(
546
534
props->ConcreteType ->getSubstitutions (),
547
535
props->ConformsToRules ,
548
536
props->ConformsTo ,
549
- props->ConcreteConformances ,
550
- inducedRules);
537
+ props->ConcreteConformances );
551
538
}
552
539
553
540
if (props->hasSuperclassBound ()) {
@@ -563,8 +550,7 @@ void PropertyMap::concretizeNestedTypesFromConcreteParents(
563
550
props->Superclass ->getSubstitutions (),
564
551
props->ConformsToRules ,
565
552
props->ConformsTo ,
566
- props->SuperclassConformances ,
567
- inducedRules);
553
+ props->SuperclassConformances );
568
554
}
569
555
}
570
556
}
@@ -608,8 +594,7 @@ void PropertyMap::concretizeNestedTypesFromConcreteParent(
608
594
ArrayRef<Term> substitutions,
609
595
ArrayRef<unsigned > conformsToRules,
610
596
ArrayRef<const ProtocolDecl *> conformsTo,
611
- llvm::TinyPtrVector<ProtocolConformance *> &conformances,
612
- SmallVectorImpl<InducedRule> &inducedRules) {
597
+ llvm::TinyPtrVector<ProtocolConformance *> &conformances) {
613
598
assert (requirementKind == RequirementKind::SameType ||
614
599
requirementKind == RequirementKind::Superclass);
615
600
assert (conformsTo.size () == conformsToRules.size ());
@@ -684,8 +669,7 @@ void PropertyMap::concretizeNestedTypesFromConcreteParent(
684
669
concreteType, substitutions, proto, Context);
685
670
686
671
recordConcreteConformanceRule (concreteRuleID, conformanceRuleID,
687
- requirementKind, concreteConformanceSymbol,
688
- inducedRules);
672
+ requirementKind, concreteConformanceSymbol);
689
673
690
674
auto assocTypes = proto->getAssociatedTypeMembers ();
691
675
if (assocTypes.empty ())
@@ -694,8 +678,7 @@ void PropertyMap::concretizeNestedTypesFromConcreteParent(
694
678
for (auto *assocType : assocTypes) {
695
679
concretizeTypeWitnessInConformance (key, requirementKind,
696
680
concreteConformanceSymbol,
697
- concrete, assocType,
698
- inducedRules);
681
+ concrete, assocType);
699
682
}
700
683
}
701
684
}
@@ -704,8 +687,7 @@ void PropertyMap::concretizeTypeWitnessInConformance(
704
687
Term key, RequirementKind requirementKind,
705
688
Symbol concreteConformanceSymbol,
706
689
ProtocolConformance *concrete,
707
- AssociatedTypeDecl *assocType,
708
- SmallVectorImpl<InducedRule> &inducedRules) const {
690
+ AssociatedTypeDecl *assocType) const {
709
691
auto concreteType = concreteConformanceSymbol.getConcreteType ();
710
692
auto substitutions = concreteConformanceSymbol.getSubstitutions ();
711
693
auto *proto = concreteConformanceSymbol.getProtocol ();
@@ -926,8 +908,7 @@ void PropertyMap::recordConcreteConformanceRule(
926
908
unsigned concreteRuleID,
927
909
unsigned conformanceRuleID,
928
910
RequirementKind requirementKind,
929
- Symbol concreteConformanceSymbol,
930
- SmallVectorImpl<InducedRule> &inducedRules) const {
911
+ Symbol concreteConformanceSymbol) const {
931
912
const auto &concreteRule = System.getRule (concreteRuleID);
932
913
const auto &conformanceRule = System.getRule (conformanceRuleID);
933
914
0 commit comments