From: Marek Safar Date: Wed, 7 Jun 2017 16:00:00 +0000 (+0200) Subject: [mcs] Better detection of null operator inside conditional expression. Fixes #57232 X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=522d0276630d843944e57522f96e2613913452cd;hp=dc58d950f2b2795c63517b3a8903fe33b70a89cd;p=mono.git [mcs] Better detection of null operator inside conditional expression. Fixes #57232 --- diff --git a/mcs/mcs/cs-tokenizer.cs b/mcs/mcs/cs-tokenizer.cs index 505173cb4f9..1be3309b1bf 100644 --- a/mcs/mcs/cs-tokenizer.cs +++ b/mcs/mcs/cs-tokenizer.cs @@ -1325,7 +1325,8 @@ namespace Mono.CSharp } if (d == '.') { - return Token.INTERR_OPERATOR; + d = reader.Peek (); + return d >= '0' && d <= '9' ? Token.INTERR : Token.INTERR_OPERATOR; } if (d != ' ') { diff --git a/mcs/tests/gtest-409.cs b/mcs/tests/gtest-409.cs index d8fee033830..8db59d7e48d 100644 --- a/mcs/tests/gtest-409.cs +++ b/mcs/tests/gtest-409.cs @@ -170,6 +170,11 @@ public class ConditionalParsing var t = (Int32)sbyte.MaxValue; } + void Test_22 (bool args) + { + var x = args ?.2f : -.2f; + } + static void Helper (T arg) { } diff --git a/mcs/tests/ver-il-net_4_x.xml b/mcs/tests/ver-il-net_4_x.xml index e2b6cd90558..fe7d9733555 100644 --- a/mcs/tests/ver-il-net_4_x.xml +++ b/mcs/tests/ver-il-net_4_x.xml @@ -14651,6 +14651,9 @@ 5 + + 24 +