Uploaded image for project: 'Swift'
  1. Swift
  2. SR-14162

Index store does not relate static property getter used as subscript key.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Source Tooling
    • Labels:
      None
    • Environment:

      Swift 5.3 & 5.4 beta (Xcode 12.5 beta 1)

      Description

      Given the following code:

      enum FixtureEnum128 {
          static let someVar = ""
      }
      
      class FixtureClass128 {
          func someFunc() {
              var s: [String: Int] = [:]
              s[FixtureEnum128.someVar] = 0
          }
      }
      

      The index store does not relate the someVar getter when used as a subscript key. It does however relate the setter, which is also incorrect.

      1:6 | enum/Swift | FixtureEnum128 | s:14swift_ide_test14FixtureEnum128O | Def | rel: 0
      2:16 | static-property/Swift | someVar | s:14swift_ide_test14FixtureEnum128O7someVarSSvpZ | Def,RelChild | rel: 1
        RelChild | enum/Swift | FixtureEnum128 | s:14swift_ide_test14FixtureEnum128O
      2:16 | static-method/acc-get/Swift | getter:someVar | s:14swift_ide_test14FixtureEnum128O7someVarSSvgZ | Def,Impl,RelChild,RelAcc | rel: 1
        RelChild,RelAcc | static-property/Swift | someVar | s:14swift_ide_test14FixtureEnum128O7someVarSSvpZ
      2:16 | static-method/acc-set/Swift | setter:someVar | s:14swift_ide_test14FixtureEnum128O7someVarSSvsZ | Def,Impl,RelChild,RelAcc | rel: 1
        RelChild,RelAcc | static-property/Swift | someVar | s:14swift_ide_test14FixtureEnum128O7someVarSSvpZ
      5:7 | class/Swift | FixtureClass128 | s:14swift_ide_test15FixtureClass128C | Def | rel: 0
      6:10 | instance-method/Swift | someFunc() | s:14swift_ide_test15FixtureClass128C8someFuncyyF | Def,Dyn,RelChild | rel: 1
        RelChild | class/Swift | FixtureClass128 | s:14swift_ide_test15FixtureClass128C
      7:17 | struct/Swift | String | s:SS | Ref,RelCont | rel: 1
        RelCont | instance-method/Swift | someFunc() | s:14swift_ide_test15FixtureClass128C8someFuncyyF
      7:25 | struct/Swift | Int | s:Si | Ref,RelCont | rel: 1
        RelCont | instance-method/Swift | someFunc() | s:14swift_ide_test15FixtureClass128C8someFuncyyF
      8:10 | instance-property/subscript/Swift | subscript(_:) | s:SDyq_Sgxcip | Ref,Writ,RelCont | rel: 1
        RelCont | instance-method/Swift | someFunc() | s:14swift_ide_test15FixtureClass128C8someFuncyyF
      8:10 | instance-method/acc-set/Swift | setter:subscript(_:) | s:SDyq_Sgxcis | Ref,Call,Impl,RelCall,RelCont | rel: 1
        RelCall,RelCont | instance-method/Swift | someFunc() | s:14swift_ide_test15FixtureClass128C8someFuncyyF
      8:11 | enum/Swift | FixtureEnum128 | s:14swift_ide_test14FixtureEnum128O | Ref,RelCont | rel: 1
        RelCont | instance-method/Swift | someFunc() | s:14swift_ide_test15FixtureClass128C8someFuncyyF
      8:26 | static-property/Swift | someVar | s:14swift_ide_test14FixtureEnum128O7someVarSSvpZ | Ref,Writ,RelCont | rel: 1
        RelCont | instance-method/Swift | someFunc() | s:14swift_ide_test15FixtureClass128C8someFuncyyF
      8:26 | static-method/acc-set/Swift | setter:someVar | s:14swift_ide_test14FixtureEnum128O7someVarSSvsZ | Ref,Call,Impl,RelRec,RelCall,RelCont | rel: 2
        RelCall,RelCont | instance-method/Swift | someFunc() | s:14swift_ide_test15FixtureClass128C8someFuncyyF
        RelRec | enum/Swift | FixtureEnum128 | s:14swift_ide_test14FixtureEnum128O
      5:7 | constructor/Swift | init() | s:14swift_ide_test15FixtureClass128CACycfc | Def,Impl,RelChild | rel: 1
        RelChild | class/Swift | FixtureClass128 | s:14swift_ide_test15FixtureClass128C
      

       

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            Leitch Ian Leitch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: