Details
-
New Feature
-
Status: Closed
-
Normal
-
Resolution: Done
-
None
-
None
-
None
-
1
-
Language 2015-04-01
Description
In 4.0, comparison of String and Number is different.
'1' == 1 # 4x. false, 3x. true
'1' <= 1 # 4x. error, 3x. true
Since 4.0 errors on comparison but not on equality, the equality operators must check their arguments. If a String and a Number are checked for equality this should result in a diagnostic for the operator.
Add MIGRATE4_EQUALITY_TYPE_MISMATCH to to MigrationIssues with the text:
"#{the(semantic)} always evaluates to false due to type mismatch #{left.class} #{right.class} (3.x. may evaluate to true)"
|
Add a report_equality_type_mismatch(left_value, right_value, o) where the semantic o is the equality expression to the MigrationChecker, and report if left/right have mismatch on String/Number.
Call this report method from the equality and comparison operator evaluation methods.
(Add method stubs to the MigrationChecker in the puppet repository and the concrete methods to the implementation in the module created in PUP-4149).
Attachments
Issue Links
- links to