@@ -66,7 +66,8 @@ static bool diagnoseSubstitutionMapAvailability(
66
66
SourceLoc loc, SubstitutionMap subs, const ExportContext &where,
67
67
Type depTy = Type(), Type replacementTy = Type(),
68
68
bool warnIfConformanceUnavailablePreSwift6 = false,
69
- bool suppressParameterizationCheckForOptional = false);
69
+ bool suppressParameterizationCheckForOptional = false,
70
+ bool preconcurrency = false);
70
71
71
72
// / Diagnose uses of unavailable declarations in types.
72
73
static bool
@@ -3990,8 +3991,12 @@ bool ExprAvailabilityWalker::diagnoseDeclRefAvailability(
3990
3991
}
3991
3992
3992
3993
if (R.isValid ()) {
3993
- if (diagnoseSubstitutionMapAvailability (R.Start , declRef.getSubstitutions (),
3994
- Where)) {
3994
+ if (diagnoseSubstitutionMapAvailability (
3995
+ R.Start , declRef.getSubstitutions (), Where,
3996
+ Type (), Type (),
3997
+ /* warnIfConformanceUnavailablePreSwift6*/ false ,
3998
+ /* suppressParameterizationCheckForOptional*/ false ,
3999
+ /* preconcurrency*/ D->preconcurrency ())) {
3995
4000
return true ;
3996
4001
}
3997
4002
}
@@ -4489,7 +4494,8 @@ class ProblematicTypeFinder : public TypeDeclFinder {
4489
4494
/* depTy=*/ Type (),
4490
4495
/* replacementTy=*/ Type (),
4491
4496
/* warnIfConformanceUnavailablePreSwift6=*/ false ,
4492
- /* suppressParameterizationCheckForOptional=*/ ty->isOptional ());
4497
+ /* suppressParameterizationCheckForOptional=*/ ty->isOptional (),
4498
+ /* preconcurrency*/ ty->getAnyNominal ()->preconcurrency ());
4493
4499
return Action::Continue;
4494
4500
}
4495
4501
@@ -4539,17 +4545,19 @@ void swift::diagnoseTypeAvailability(const TypeRepr *TR, Type T, SourceLoc loc,
4539
4545
}
4540
4546
4541
4547
static void diagnoseMissingConformance (
4542
- SourceLoc loc, Type type, ProtocolDecl *proto, const DeclContext *fromDC) {
4548
+ SourceLoc loc, Type type, ProtocolDecl *proto, const DeclContext *fromDC,
4549
+ bool preconcurrency) {
4543
4550
assert (proto->isSpecificProtocol (KnownProtocolKind::Sendable));
4544
- diagnoseMissingSendableConformance (loc, type, fromDC);
4551
+ diagnoseMissingSendableConformance (loc, type, fromDC, preconcurrency );
4545
4552
}
4546
4553
4547
4554
bool
4548
4555
swift::diagnoseConformanceAvailability (SourceLoc loc,
4549
4556
ProtocolConformanceRef conformance,
4550
4557
const ExportContext &where,
4551
4558
Type depTy, Type replacementTy,
4552
- bool warnIfConformanceUnavailablePreSwift6) {
4559
+ bool warnIfConformanceUnavailablePreSwift6,
4560
+ bool preconcurrency) {
4553
4561
assert (!where.isImplicit ());
4554
4562
4555
4563
if (conformance.isInvalid () || conformance.isAbstract ())
@@ -4561,7 +4569,8 @@ swift::diagnoseConformanceAvailability(SourceLoc loc,
4561
4569
for (auto patternConf : pack->getPatternConformances ()) {
4562
4570
diagnosed |= diagnoseConformanceAvailability (
4563
4571
loc, patternConf, where, depTy, replacementTy,
4564
- warnIfConformanceUnavailablePreSwift6);
4572
+ warnIfConformanceUnavailablePreSwift6,
4573
+ preconcurrency);
4565
4574
}
4566
4575
return diagnosed;
4567
4576
}
@@ -4581,7 +4590,8 @@ swift::diagnoseConformanceAvailability(SourceLoc loc,
4581
4590
if (auto builtinConformance = dyn_cast<BuiltinProtocolConformance>(rootConf)){
4582
4591
if (builtinConformance->isMissing ()) {
4583
4592
diagnoseMissingConformance (loc, builtinConformance->getType (),
4584
- builtinConformance->getProtocol (), DC);
4593
+ builtinConformance->getProtocol (), DC,
4594
+ preconcurrency);
4585
4595
}
4586
4596
}
4587
4597
@@ -4640,7 +4650,8 @@ swift::diagnoseConformanceAvailability(SourceLoc loc,
4640
4650
SubstitutionMap subConformanceSubs = concreteConf->getSubstitutionMap ();
4641
4651
if (diagnoseSubstitutionMapAvailability (loc, subConformanceSubs, where,
4642
4652
depTy, replacementTy,
4643
- warnIfConformanceUnavailablePreSwift6))
4653
+ warnIfConformanceUnavailablePreSwift6,
4654
+ preconcurrency))
4644
4655
return true ;
4645
4656
4646
4657
return false ;
@@ -4649,12 +4660,14 @@ swift::diagnoseConformanceAvailability(SourceLoc loc,
4649
4660
bool diagnoseSubstitutionMapAvailability (
4650
4661
SourceLoc loc, SubstitutionMap subs, const ExportContext &where, Type depTy,
4651
4662
Type replacementTy, bool warnIfConformanceUnavailablePreSwift6,
4652
- bool suppressParameterizationCheckForOptional) {
4663
+ bool suppressParameterizationCheckForOptional,
4664
+ bool preconcurrency) {
4653
4665
bool hadAnyIssues = false ;
4654
4666
for (ProtocolConformanceRef conformance : subs.getConformances ()) {
4655
4667
if (diagnoseConformanceAvailability (loc, conformance, where,
4656
4668
depTy, replacementTy,
4657
- warnIfConformanceUnavailablePreSwift6))
4669
+ warnIfConformanceUnavailablePreSwift6,
4670
+ preconcurrency))
4658
4671
hadAnyIssues = true ;
4659
4672
}
4660
4673
0 commit comments