@@ -3625,60 +3625,14 @@ void ConformanceChecker::ensureRequirementsAreSatisfied(
3625
3625
}
3626
3626
3627
3627
#pragma mark Protocol conformance checking
3628
- void ConformanceChecker::checkConformance (MissingWitnessDiagnosisKind Kind) {
3629
- assert (!Conformance->isComplete () && " Conformance is already complete" );
3630
-
3631
- FrontendStatsTracer statsTracer (TC.Context .Stats , " check-conformance" ,
3632
- Conformance);
3633
-
3634
- llvm::SaveAndRestore<bool > restoreSuppressDiagnostics (SuppressDiagnostics);
3635
- SuppressDiagnostics = false ;
3636
-
3637
- // FIXME: Caller checks that this type conforms to all of the
3638
- // inherited protocols.
3639
-
3640
- // Emit known diags for this conformance.
3641
- emitDelayedDiags ();
3642
-
3643
- // If delayed diags have already complained, return.
3644
- if (AlreadyComplained) {
3645
- Conformance->setInvalid ();
3646
- return ;
3647
- }
3648
-
3649
- // Resolve all of the type witnesses.
3650
- resolveTypeWitnesses ();
3651
-
3652
- // Diagnose missing type witnesses for now.
3653
- diagnoseMissingWitnesses (Kind);
3654
-
3655
- // Ensure the conforming type is used.
3656
- //
3657
- // FIXME: This feels like the wrong place for this, but if we don't put
3658
- // it here, extensions don't end up depending on the extended type.
3659
- recordConformanceDependency (DC, Adoptee->getAnyNominal (), Conformance, false );
3660
3628
3661
- // If we complain about any associated types, there is no point in continuing.
3662
- // FIXME: Not really true. We could check witnesses that don't involve the
3663
- // failed associated types.
3664
- if (AlreadyComplained) {
3665
- Conformance->setInvalid ();
3666
- return ;
3667
- }
3668
-
3669
- // Diagnose missing value witnesses later.
3670
- SWIFT_DEFER { diagnoseMissingWitnesses (Kind); };
3671
-
3672
- // Ensure the associated type conformances are used.
3673
- addUsedConformances (Conformance);
3674
-
3675
- // Check non-type requirements.
3629
+ void ConformanceChecker::resolveValueWitnesses () {
3676
3630
for (auto member : Proto->getMembers ()) {
3677
3631
auto requirement = dyn_cast<ValueDecl>(member);
3678
3632
if (!requirement)
3679
3633
continue ;
3680
3634
3681
- // Associated type requirements handled above .
3635
+ // Associated type requirements handled elsewhere .
3682
3636
if (isa<TypeDecl>(requirement))
3683
3637
continue ;
3684
3638
@@ -3829,7 +3783,7 @@ void ConformanceChecker::checkConformance(MissingWitnessDiagnosisKind Kind) {
3829
3783
// If this is an accessor for a storage decl, ignore it.
3830
3784
if (isa<AccessorDecl>(requirement))
3831
3785
continue ;
3832
-
3786
+
3833
3787
// Try to resolve the witness via explicit definitions.
3834
3788
switch (resolveWitnessViaLookup (requirement)) {
3835
3789
case ResolveWitnessResult::Success:
@@ -3875,6 +3829,57 @@ void ConformanceChecker::checkConformance(MissingWitnessDiagnosisKind Kind) {
3875
3829
break ;
3876
3830
}
3877
3831
}
3832
+ }
3833
+
3834
+ void ConformanceChecker::checkConformance (MissingWitnessDiagnosisKind Kind) {
3835
+ assert (!Conformance->isComplete () && " Conformance is already complete" );
3836
+
3837
+ FrontendStatsTracer statsTracer (TC.Context .Stats , " check-conformance" ,
3838
+ Conformance);
3839
+
3840
+ llvm::SaveAndRestore<bool > restoreSuppressDiagnostics (SuppressDiagnostics);
3841
+ SuppressDiagnostics = false ;
3842
+
3843
+ // FIXME: Caller checks that this type conforms to all of the
3844
+ // inherited protocols.
3845
+
3846
+ // Emit known diags for this conformance.
3847
+ emitDelayedDiags ();
3848
+
3849
+ // If delayed diags have already complained, return.
3850
+ if (AlreadyComplained) {
3851
+ Conformance->setInvalid ();
3852
+ return ;
3853
+ }
3854
+
3855
+ // Resolve all of the type witnesses.
3856
+ resolveTypeWitnesses ();
3857
+
3858
+ // Diagnose missing type witnesses for now.
3859
+ diagnoseMissingWitnesses (Kind);
3860
+
3861
+ // Ensure the conforming type is used.
3862
+ //
3863
+ // FIXME: This feels like the wrong place for this, but if we don't put
3864
+ // it here, extensions don't end up depending on the extended type.
3865
+ recordConformanceDependency (DC, Adoptee->getAnyNominal (), Conformance, false );
3866
+
3867
+ // If we complain about any associated types, there is no point in continuing.
3868
+ // FIXME: Not really true. We could check witnesses that don't involve the
3869
+ // failed associated types.
3870
+ if (AlreadyComplained) {
3871
+ Conformance->setInvalid ();
3872
+ return ;
3873
+ }
3874
+
3875
+ // Diagnose missing value witnesses later.
3876
+ SWIFT_DEFER { diagnoseMissingWitnesses (Kind); };
3877
+
3878
+ // Ensure the associated type conformances are used.
3879
+ addUsedConformances (Conformance);
3880
+
3881
+ // Check non-type requirements.
3882
+ resolveValueWitnesses ();
3878
3883
3879
3884
emitDelayedDiags ();
3880
3885
0 commit comments