@@ -1398,7 +1398,8 @@ class ApplyClassifier {
1398
1398
if (isa<SubscriptDecl>(cdr.getDecl ()))
1399
1399
return PotentialEffectReason::forSubscriptAccess ();
1400
1400
1401
- assert (isa<VarDecl>(cdr.getDecl ()));
1401
+ // Note that declarations other than properties end up with
1402
+ // "property access" effect reasons for historical... reasons.
1402
1403
return PotentialEffectReason::forPropertyAccess ();
1403
1404
}
1404
1405
@@ -1537,18 +1538,18 @@ class ApplyClassifier {
1537
1538
if (!member)
1538
1539
return Classification::forInvalidCode ();
1539
1540
1540
- PotentialEffectReason reason =
1541
- PotentialEffectReason::forPropertyAccess ();
1542
- Classification classification;
1541
+ ConcreteDeclRef declToClassify;
1543
1542
if (auto getter = getEffectfulGetOnlyAccessor (member)) {
1544
- reason = getKindOfEffectfulProp (member);
1545
- classification = Classification::forDeclRef (
1546
- getter, ConditionalEffectKind::Always, reason, E->getLoc (),
1547
- assumedSafeArguments && assumedSafeArguments->contains (E));
1548
- } else if (isa<SubscriptExpr>(E) || isa<DynamicSubscriptExpr>(E)) {
1549
- reason = PotentialEffectReason::forSubscriptAccess ();
1543
+ declToClassify = getter;
1544
+ } else {
1545
+ declToClassify = member;
1550
1546
}
1551
1547
1548
+ PotentialEffectReason reason = getKindOfEffectfulProp (member);
1549
+ Classification classification = Classification::forDeclRef (
1550
+ declToClassify, ConditionalEffectKind::Always, reason, E->getLoc (),
1551
+ assumedSafeArguments && assumedSafeArguments->contains (E));
1552
+
1552
1553
classification.setDowngradeToWarning (
1553
1554
downgradeAsyncAccessToWarning (member.getDecl ()));
1554
1555
@@ -1557,14 +1558,6 @@ class ApplyClassifier {
1557
1558
E->isImplicitlyAsync ().has_value (), E->isImplicitlyThrows (),
1558
1559
reason);
1559
1560
1560
- if (!classification.hasUnsafe ()) {
1561
- classification.merge (
1562
- Classification::forDeclRef (
1563
- member, ConditionalEffectKind::Always, reason, E->getLoc (),
1564
- assumedSafeArguments && assumedSafeArguments->contains (E),
1565
- EffectKind::Unsafe));
1566
- }
1567
-
1568
1561
if (assumedSafeArguments) {
1569
1562
// If the declaration we're referencing is explicitly @safe, mark arguments
1570
1563
// as potentially being safe.
0 commit comments