Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix AND expression in v4
The type of the and expressions, e.g. (a && b), were being assigned to the type of the right hand expression (b). As reported in QTBUG-24660, this approach could lead to some unexpected behaviors. Now, when the left and right hand expressions are of different types, the responsability to deal with the and expression is delegated to v8. Task-number: QTBUG-24660 Change-Id: Ic42ebb035e62e2f197c337b2106d00453a99f04c Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
- Loading branch information
1 parent
4cd2f0b
commit b7f3138
Showing
10 changed files
with
187 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Qt.v4 1.0 | ||
|
||
Result { | ||
property string s: "foo" && "bar" | ||
result: s == "bar" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import Qt.v4 1.0 | ||
|
||
Result { | ||
property string s: "" | ||
property bool flag: true | ||
|
||
result: (s && flag) == "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import Qt.v4 1.0 | ||
|
||
Result { | ||
property string s: "foo" | ||
property bool flag: true | ||
|
||
result: (!flag && s) == false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Qt.v4 1.0 | ||
|
||
Result { | ||
property bool flag: true | ||
|
||
result: (null && flag) == null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Qt.v4 1.0 | ||
|
||
Result { | ||
property string s: "" | ||
property bool flag: true | ||
property string subresult: s && flag | ||
|
||
result: subresult === "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Qt.v4 1.0 | ||
|
||
Result { | ||
property real nan: Number.NaN | ||
property bool flag: true | ||
property real subresult: nan && flag | ||
|
||
result: isNaN(subresult) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Qt.v4 1.0 | ||
|
||
Result { | ||
property int a: 10 | ||
result: a == 10 && a == 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Qt.v4 1.0 | ||
|
||
Result { | ||
property bool val1: false | ||
property bool val2: true | ||
property bool val3: false | ||
|
||
property bool b1: (true && true && false) | ||
property bool b2: (true && (false && true)) | ||
property bool b3: ((true && true) && true) | ||
property bool b4: (val1 && (val2 && val3)) ? true : false | ||
|
||
result: !b1 && !b2 && b3 && !b4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters