@@ -2718,6 +2718,8 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
27182718 }
27192719
27202720 void visitSubscriptDecl (SubscriptDecl *SD) {
2721+ auto *DC = SD->getDeclContext ();
2722+
27212723 // Force requests that can emit diagnostics.
27222724 (void ) SD->getInterfaceType ();
27232725 (void ) SD->getGenericSignature ();
@@ -2768,7 +2770,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
27682770 checkDefaultArguments (SD->getIndices ());
27692771 checkVariadicParameters (SD->getIndices (), SD);
27702772
2771- if (SD-> getDeclContext () ->getSelfClassDecl ()) {
2773+ if (DC ->getSelfClassDecl ()) {
27722774 checkDynamicSelfType (SD, SD->getValueInterfaceType ());
27732775
27742776 if (SD->getValueInterfaceType ()->hasDynamicSelfType () &&
@@ -2779,15 +2781,15 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
27792781
27802782 // Reject "class" methods on actors.
27812783 if (SD->getStaticSpelling () == StaticSpellingKind::KeywordClass &&
2782- SD-> getDeclContext () ->getSelfClassDecl () &&
2783- SD-> getDeclContext () ->getSelfClassDecl ()->isActor ()) {
2784+ DC ->getSelfClassDecl () &&
2785+ DC ->getSelfClassDecl ()->isActor ()) {
27842786 SD->diagnose (diag::class_subscript_not_in_class, false )
27852787 .fixItReplace (SD->getStaticLoc (), " static" );
27862788 }
27872789
27882790 // Reject noncopyable typed subscripts with read/set accessors since we
27892791 // cannot define modify operations upon them without copying the read.
2790- if (SD->getElementInterfaceType ()->isNoncopyable ()) {
2792+ if (SD->getElementInterfaceType ()->isNoncopyable (DC )) {
27912793 if (auto *read = SD->getAccessor (AccessorKind::Read)) {
27922794 if (!read->isImplicit ()) {
27932795 if (auto *set = SD->getAccessor (AccessorKind::Set)) {
0 commit comments