diff options
author | Miguel de Icaza <miguel@gnome.org> | 2007-07-23 20:26:59 +0400 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2007-07-23 20:26:59 +0400 |
commit | 063633a98e6148775ae4687804a41272d7700cdc (patch) | |
tree | 0c3ac3dd7ed41138a43f0df4e2eed68ec7b40a19 /mcs/tests/test-577.cs | |
parent | 4388d76fc59324d35116dbd937170d5e7e75ab0d (diff) |
2007-07-23 Miguel de Icaza <miguel@novell.com>
* expression.cs (Binary): Add support for the brain-dead CSC 2.x
feature that allows structs to be compared against null and inline
the result as true or false.
Notice that the same code is not permitted inside a generic block
of code that would do:
class Foo<T> where T : struct {
bool Eval (T x)
{
return x == null;
}
}
It is only allowed if the type of T is not bound (no where
clause). In my opinion, this CSC 2 behavior is broken but people
seem to be using it (IronRuby does, a few bug reports on bugzilla
have it and some people have complained about it).
All of the users that depend on this behavior have code that is
very likely broken.
* report.cs (Warning, Error): make these take object arguments,
not strings, as that allows us to take advantage of Format.
svn path=/trunk/mcs/; revision=82517
Diffstat (limited to 'mcs/tests/test-577.cs')
-rw-r--r-- | mcs/tests/test-577.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/mcs/tests/test-577.cs b/mcs/tests/test-577.cs new file mode 100644 index 00000000000..2060c6056bd --- /dev/null +++ b/mcs/tests/test-577.cs @@ -0,0 +1,24 @@ +using System; + +public class X { + public static bool Compute (int x) + { + return x == null; + } + + public static bool Compute2 (int x) + { + return x != null; + } + + static int Main () + { + if (Compute (1) != false) + return 1; + + if (Compute2 (1) != true) + return 1; + + return 0; + } +} |