Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2015-12-18 23:12:34 +0300
committerMarek Safar <marek.safar@gmail.com>2015-12-18 23:14:06 +0300
commit25497f5308b801d72fd1e1ed090bf08c42456fb5 (patch)
treead9015d5301eda4850fbd1cd14b1c3111a057ceb /mcs
parentf2b8c44a9141492c1598b35ba7f54397afc85726 (diff)
[mcs] Propagate null operator flag during standalone to extension methods promotion. Fixes #37080
Diffstat (limited to 'mcs')
-rw-r--r--mcs/mcs/ecore.cs1
-rw-r--r--mcs/tests/test-null-operator-22.cs33
-rw-r--r--mcs/tests/ver-il-net_4_x.xml29
3 files changed, 63 insertions, 0 deletions
diff --git a/mcs/mcs/ecore.cs b/mcs/mcs/ecore.cs
index 08bce8a9d70..b74da01e65c 100644
--- a/mcs/mcs/ecore.cs
+++ b/mcs/mcs/ecore.cs
@@ -4255,6 +4255,7 @@ namespace Mono.CSharp {
var emg = new ExtensionMethodGroupExpr (methods, InstanceExpression, loc);
emg.SetTypeArguments (rc, type_arguments);
+ emg.ConditionalAccess = ConditionalAccess;
return emg;
}
diff --git a/mcs/tests/test-null-operator-22.cs b/mcs/tests/test-null-operator-22.cs
new file mode 100644
index 00000000000..04115f9385e
--- /dev/null
+++ b/mcs/tests/test-null-operator-22.cs
@@ -0,0 +1,33 @@
+class A
+{
+ public A this [string arg] {
+ get {
+ return new A ();
+ }
+ set {
+ }
+ }
+
+ public int Count (string a)
+ {
+ return 1;
+ }
+}
+
+static class B
+{
+ public static string Count (this A arg)
+ {
+ return "x";
+ }
+}
+
+class X
+{
+ public static void Main ()
+ {
+ var a = new A ();
+ var b = a ["b"]?.Count ();
+ System.Console.WriteLine (b);
+ }
+} \ No newline at end of file
diff --git a/mcs/tests/ver-il-net_4_x.xml b/mcs/tests/ver-il-net_4_x.xml
index d543f197bd7..b2352089203 100644
--- a/mcs/tests/ver-il-net_4_x.xml
+++ b/mcs/tests/ver-il-net_4_x.xml
@@ -69665,6 +69665,35 @@
</method>
</type>
</test>
+ <test name="test-null-operator-22.cs">
+ <type name="A">
+ <method name="A get_Item(System.String)" attrs="2182">
+ <size>14</size>
+ </method>
+ <method name="Void set_Item(System.String, A)" attrs="2182">
+ <size>2</size>
+ </method>
+ <method name="Int32 Count(System.String)" attrs="134">
+ <size>10</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="B">
+ <method name="System.String Count(A)" attrs="150">
+ <size>14</size>
+ </method>
+ </type>
+ <type name="X">
+ <method name="Void Main()" attrs="150">
+ <size>41</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="test-partial-01.cs">
<type name="Foo.Hello">
<method name="Void .ctor()" attrs="6278">