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

Weird compiler warning for functions without return type annotation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.7.1, 6.8.0 FF, 6.9
    • 6.7
    • QML: Compiler
    • None
    • 04eca6984 (dev), d13a6ea1f (dev), 5cf5d2926 (6.7), 1d4e86395 (6.7)

    Description

       

      Consider the following QML function

      function foo() {
          return 1 + 1
      } 

      qmlcachegen in verbose mode prints

      Warning: Main.qml:10:9: function without return type annotation returns double of double [compiler]
              return 1 + 1
              ^^^^^^
      

       

      First of all "returns double of double" reads very weird. Presumably this should be "returns double".

      But even beyond that the warning could be improved, maybe even with a suggestion

      Warning: Main.qml:9: function with return value but no return type annotation
          function foo(): double {
                        ^^^^^^^^

      Tested with 6.7 and current dev

      Attachments

        For Gerrit Dashboard: QTBUG-124220
        # Subject Branch Project Status CR V

        Activity

          People

            olivier.decanniere Olivier De Cannière
            nicolasfella Nicolas Fella
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes