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

[Reg 6.5 -> 6.6] Qml: Compiler generates wrong code for Array.prototype.join invocation

    XMLWordPrintable

Details

    • ae76c8f42 (dev), 2889e7963 (6.8), 342fbebd3 (6.7)

    Description

      Please try the attached example. All functions should return the string "A+B".

      However, the compiled version does not:

      qml: foo1: 
      qml: foo2: A+B
      qml: foo3: A+B
      
      import QtQuick
      
      Window {
        width: 640
        height: 480
        visible: true
        title: qsTr("Hello World")
      
        // compiled: fail
        function foo1() : string
        {
          var s = [];
          s.push("A")
          s.push("B")
          return s.join("+");
        }
      
        // not compiled: "toString" seems to disable the compiler
        function foo2() : string
        {
          var s = [];
          s.push("A")
          s.push("B")
          return s.join("+").toString();
        }
      
        // not compiled: no return type annotation
        function foo3()
        {
          var s = [];
          s.push("A")
          s.push("B")
          return s.join("+");
        }
      
        Component.onCompleted: {
          console.log("foo1:", foo1());
          console.log("foo2:", foo2());
          console.log("foo3:", foo3());
        }
      }
      

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            njeisecke_qtc Nils Jeisecke
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes