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

Incorrect syntax warning in JavaScript template literal

XMLWordPrintable

      This relates to QTBUG-71812, but I'm still having a problem with it. I'm getting a pair of warnings on the following line:

      html += `<p style="margin-left: ${20 * (indents.length - 1)}"><a href="${thisUrl}">${title}</a></p>\n` 

      The two warnings are:

      Expected token `(Template tail)'

      Expected token `;'

      I'm doing exactly this sort of thing in lots of places without getting the warning, and this code compiles and runs just fine, so the warning is wrong. The red underline starts at the close brace after the word "title", so it underlines the last twelve characters, plus every remaining line in the file. That smells like there's something about the choice of the name "title" that it objects to.

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

            tjenssen Tim Jenssen
            pderocco Paul DeRocco
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes