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
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2013-03-18 13:57:04 +0400
committerMarek Safar <marek.safar@gmail.com>2013-03-18 13:57:04 +0400
commita583280e6431c3b2bffa20e5b798d200dda48eba (patch)
tree653b14473beedac9acc96c4c44d7ed19710d462c
parent46fc054c3f1bf59ddbc915698c6b5c5f8a02414d (diff)
Fully resolve extension method argument. Fixes #11213
-rw-r--r--mcs/errors/cs0154-5.cs19
-rw-r--r--mcs/mcs/ecore.cs6
2 files changed, 24 insertions, 1 deletions
diff --git a/mcs/errors/cs0154-5.cs b/mcs/errors/cs0154-5.cs
new file mode 100644
index 00000000000..21f55ceae5a
--- /dev/null
+++ b/mcs/errors/cs0154-5.cs
@@ -0,0 +1,19 @@
+// CS0154: The property or indexer `BugReport.MyProperty' cannot be used in this context because it lacks the `get' accessor
+// Line: 16
+
+static class BugReport
+{
+ static float MyProperty {
+ set { }
+ }
+
+ static void MyExtension (this float val)
+ {
+ }
+
+ public static void Main ()
+ {
+ MyProperty.MyExtension ();
+ }
+}
+
diff --git a/mcs/mcs/ecore.cs b/mcs/mcs/ecore.cs
index ee025092c44..e8bd8554dcd 100644
--- a/mcs/mcs/ecore.cs
+++ b/mcs/mcs/ecore.cs
@@ -3244,7 +3244,7 @@ namespace Mono.CSharp {
class ExtensionMethodGroupExpr : MethodGroupExpr, OverloadResolver.IErrorHandler
{
ExtensionMethodCandidates candidates;
- public readonly Expression ExtensionExpression;
+ public Expression ExtensionExpression;
public ExtensionMethodGroupExpr (ExtensionMethodCandidates candidates, Expression extensionExpr, Location loc)
: base (candidates.Methods.Cast<MemberSpec>().ToList (), extensionExpr.Type, loc)
@@ -3288,6 +3288,10 @@ namespace Mono.CSharp {
if (arguments == null)
arguments = new Arguments (1);
+ ExtensionExpression = ExtensionExpression.Resolve (ec);
+ if (ExtensionExpression == null)
+ return null;
+
arguments.Insert (0, new Argument (ExtensionExpression, Argument.AType.ExtensionType));
var res = base.OverloadResolve (ec, ref arguments, ehandler ?? this, restr);