Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.11
-
None
-
3967337b61e361c5e9e0209c1810dbc76aabb7bd
Description
The following code prints 1 with 5.10, but null with dev:
import QtQuick 2.5 import QtQuick.Controls 2.3 ApplicationWindow { visible: true width: 640 height: 480 Component.onCompleted: { var str = "ab"; for (var inputIndex in str) { // .. } print(inputIndex) } }
The equivalent code in Chrome's console prints 1:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for#Parameters says the following about the initialisation expression:
These variables are not local to the loop, i.e. they are in the same scope the for loop is in.