Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-104426

lupdate uses return type as context for free functions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Won't Do
    • Affects Version/s: 6.3.0
    • Fix Version/s: None
    • Component/s: Tools: Linguist
    • Labels:
      None
    • Platform/s:
      All

      Description

      The fix for QTBUG-91521 introduces the following issue.

      Consider this code:

      FooBar::Type freeFunction() 
      {
          tr("freeFunction");
      }
      

      That produces now

      <context>
          <name>FooBar</name>
          <message>
              <location filename="testbackendname.cpp" line="18"/>
              <source>freeFunction</source>
              <translation type="unfinished"></translation>
          </message>
      </context>
      

      The text should not appear at all. Instead, lupdate should produce a warning like this:

      filename.cpp:18: tr() cannot be called without context
      

      Given that the code above is unlikely to exist, this is quite an edge case.
      However, introducing such a regression is less than nice.

      This was found when investigating why QTBUG-99415 is fixed in Qt 6.3.0.

      Note that the context is correct for cases like:

      class Foo {
      public:
          Narf::Zort f() { tr("some text"); }    // context is Foo
      };
      

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              jbornema Joerg Bornemann
              Reporter:
              jbornema Joerg Bornemann
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes