diff options
author | Martin Baulig <martin@novell.com> | 2006-06-16 01:58:26 +0400 |
---|---|---|
committer | Martin Baulig <martin@novell.com> | 2006-06-16 01:58:26 +0400 |
commit | e7a29a20c4383e58ebcc08d6ec06e05e35bd039a (patch) | |
tree | ee5ea504ba7d54e961e072f6ea851fce8bb6ce7f /mcs/tests/gtest-270.cs | |
parent | 0bc47ad15089d7aa927f086725ca5daea9210271 (diff) |
2006-06-15 Martin Baulig <martin@ximian.com>
* statement.cs
(SwitchLabel.ResolveAndReduce): Added `bool allow_nullable'
argument; always allow a `null' label if true.
(Switch.SwitchGoverningType): Take an `Expression expr' argument.
(Switch.TableSwitchEmit, Switch.SimpleSwitchEmit): Check whether
we have a `null' label and mark the new `null_target' label;
default to the `default' label.
(Switch.Resolve): Add support for nullable types. Fixes #78630.
svn path=/trunk/mcs/; revision=61777
Diffstat (limited to 'mcs/tests/gtest-270.cs')
-rw-r--r-- | mcs/tests/gtest-270.cs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/mcs/tests/gtest-270.cs b/mcs/tests/gtest-270.cs new file mode 100644 index 00000000000..8b1093d2636 --- /dev/null +++ b/mcs/tests/gtest-270.cs @@ -0,0 +1,27 @@ +using System; + +class X +{ + static int Test (int? a) + { + switch (a) { + case 0: + return 0; + case 1: + return 1; + + default: + return -1; + } + } + + static int Main () + { + if (Test (null) != -1) + return 1; + if (Test (0) != 0) + return 2; + + return 0; + } +} |