* mcs/expression.cs (Binary.ResolveOperator): When converting
'a + (- b)' to 'a - b', ensure that the unary '-' is discarded.
* tests/test-576.cs: New test for #82120.
svn path=/trunk/mcs/; revision=82204
+2007-07-18 Raja R Harinath <rharinath@novell.com>
+
+ Fix #82120
+ * expression.cs (Binary.ResolveOperator): When converting
+ 'a + (- b)' to 'a - b', ensure that the unary '-' is discarded.
+
2007-07-18 Atsushi Enomoto <atsushi@ximian.com>
* doc.cs : when T: or whatever x: is specified, it does not really
Unary right_unary = (Unary) right;
if (right_unary.Oper == Unary.Operator.UnaryNegation){
- return new Binary (Operator.Subtraction, left, right).Resolve (ec);
+ return new Binary (Operator.Subtraction, left, right_unary.Expr).Resolve (ec);
}
}
}
+2007-07-18 Raja R Harinath <rharinath@novell.com>
+
+ * test-576.cs: New test for #82120.
+
2007-07-18 Atsushi Enomoto <atsushi@ximian.com>
* gtest-xml-2.cs, gtest-xml-2-ref.xml : new /doc test for bug #82006.
--- /dev/null
+class Foo {
+ static void Main ()
+ {
+ int a = 0;
+ int b = 5;
+ a += -b;
+ if (a != -5)
+ throw new System.Exception ();
+ }
+}