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

lupdate uses return type as context for free functions

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • P3: Somewhat important
    • None
    • 6.3.0
    • Tools: Linguist
    • None
    • 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

              jbornema Joerg Bornemann
              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