Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-27796

Linter reports false use before declaration warnings

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • Qt Creator 7.0.2
    • Quick / QML Support
    • None

    Description

      Consider this function: 

      function reduceViewProductHistoryDetail(state, backend, actionCreator, data) {
          // Set the currently viewed event.
          // Search in active product live events first, then in product history.
      
          for (let i = 0; i < state.activeProductLiveEvents.count; ++i) {
              const e = state.activeProductLiveEvents.get(i)
              if (e.mid === data.id) {
                  state.detailEvent.fromJS(e)
                  actionCreator.redirect(Const.Page.ProductHistoryDetail)
                  return
              }
          }
          for (let i = 0; i < state.productHistory.count; ++i) {
              const e = state.productHistory.get(i)
              if (e.mid === data.id) {
                  state.detailEvent.fromJS(e)
                  actionCreator.redirect(Const.Page.ProductHistoryDetail)
                  return
              }
          }
      }
      

      The linter reports false positives for uses before declaration.

      When you remove the second for loop, no warnings get emitted.

      For the emitted warnings, see the attached screenshot

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtqmlteam Qt Qml Team User
            skaldesh Sebastian Borchers
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes