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

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJon Hanna <jon@hackcraft.net>2018-01-22 23:35:20 +0300
committerVladimir Sadov <vsadov@microsoft.com>2018-01-22 23:35:20 +0300
commitdb6db4a075df7e5a80050b3611df69243b347618 (patch)
treeeace29da43b274a83e92359f0c18a35702a70ba1 /src
parent3102a879b949843e91563107f602eb9ff61c2afb (diff)
Remove test for "wrong nested this" in Microsoft.CSharp (#26417)
* Remove test for "wrong nested this" in Microsoft.CSharp Since we have dynamically found a member by examining a type or the type of an object, it can never not be nor be derived from the type the member was found on, unlike in the static binding when where lookup can include outer classes, (with CS0038 resulting if the member found isn't static). Remove the test, which involves removing ERR_WrongNestedThis, contributing to #22470 * Remove duplication in assertion.
Diffstat (limited to 'src')
-rw-r--r--src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorCode.cs1
-rw-r--r--src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorFacts.cs3
-rw-r--r--src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionBinder.cs14
-rw-r--r--src/Microsoft.CSharp/src/Resources/Strings.de.resx3
-rw-r--r--src/Microsoft.CSharp/src/Resources/Strings.es.resx3
-rw-r--r--src/Microsoft.CSharp/src/Resources/Strings.fr.resx3
-rw-r--r--src/Microsoft.CSharp/src/Resources/Strings.it.resx3
-rw-r--r--src/Microsoft.CSharp/src/Resources/Strings.ja.resx3
-rw-r--r--src/Microsoft.CSharp/src/Resources/Strings.ko.resx3
-rw-r--r--src/Microsoft.CSharp/src/Resources/Strings.resx3
-rw-r--r--src/Microsoft.CSharp/src/Resources/Strings.ru.resx3
-rw-r--r--src/Microsoft.CSharp/src/Resources/Strings.zh-Hans.resx3
-rw-r--r--src/Microsoft.CSharp/src/Resources/Strings.zh-Hant.resx3
13 files changed, 2 insertions, 46 deletions
diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorCode.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorCode.cs
index c762ace62d..062b2f091b 100644
--- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorCode.cs
+++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorCode.cs
@@ -16,7 +16,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors
ERR_AmbigBinaryOps = 34,
ERR_AmbigUnaryOp = 35,
ERR_ValueCantBeNull = 37,
- ERR_WrongNestedThis = 38,
ERR_NoSuchMember = 117,
ERR_ObjectRequired = 120,
ERR_AmbigCall = 121,
diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorFacts.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorFacts.cs
index 81c4f736d2..f11188386c 100644
--- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorFacts.cs
+++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorFacts.cs
@@ -44,9 +44,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors
case ErrorCode.ERR_ValueCantBeNull:
codeStr = SR.ValueCantBeNull;
break;
- case ErrorCode.ERR_WrongNestedThis:
- codeStr = SR.WrongNestedThis;
- break;
case ErrorCode.ERR_NoSuchMember:
codeStr = SR.NoSuchMember;
break;
diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionBinder.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionBinder.cs
index 00ca1e2c6b..7834c8cc1f 100644
--- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionBinder.cs
+++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionBinder.cs
@@ -1150,18 +1150,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics
pfConstrained = true;
}
- Expr objNew = tryConvert(pObject, swt.GetType(), CONVERTTYPE.NOUDC);
-
- // This check ensures that we do not bind to methods in an outer class
- // which are visible, but whose this pointer is of an incorrect type...
- // ... also handles case of calling an pObject method on a RefAny value.
- // WE don't give a great message for this, but it'll do.
- if (objNew == null)
- {
- throw ErrorContext.Error(ErrorCode.ERR_WrongNestedThis, swt.GetType(), pObject.Type);
- }
-
- pObject = objNew;
+ pObject = tryConvert(pObject, swt.GetType(), CONVERTTYPE.NOUDC);
+ Debug.Assert(pObject != null);
}
return pObject;
diff --git a/src/Microsoft.CSharp/src/Resources/Strings.de.resx b/src/Microsoft.CSharp/src/Resources/Strings.de.resx
index 0b9a2ff9f1..38d09851f4 100644
--- a/src/Microsoft.CSharp/src/Resources/Strings.de.resx
+++ b/src/Microsoft.CSharp/src/Resources/Strings.de.resx
@@ -81,9 +81,6 @@
<data name="ValueCantBeNull" xml:space="preserve">
<value>NULL kann nicht in {0} konvertiert werden, da dieser Werttyp nicht auf NULL festgelegt werden kann.</value>
</data>
- <data name="WrongNestedThis" xml:space="preserve">
- <value>Auf einen nicht statischen Member des äußeren {0}-Typs kann nicht über den geschachtelten {1}-Typ zugegriffen werden.</value>
- </data>
<data name="NoSuchMember" xml:space="preserve">
<value>{0} enthält keine Definition für {1}.</value>
</data>
diff --git a/src/Microsoft.CSharp/src/Resources/Strings.es.resx b/src/Microsoft.CSharp/src/Resources/Strings.es.resx
index b50227d36d..2ecf6454cb 100644
--- a/src/Microsoft.CSharp/src/Resources/Strings.es.resx
+++ b/src/Microsoft.CSharp/src/Resources/Strings.es.resx
@@ -81,9 +81,6 @@
<data name="ValueCantBeNull" xml:space="preserve">
<value>No se puede convertir NULL en '{0}' porque es un tipo de valor que no acepta valores NULL.</value>
</data>
- <data name="WrongNestedThis" xml:space="preserve">
- <value>No se puede obtener acceso a un miembro no estático de tipo externo '{0}' mediante el tipo anidado '{1}'.</value>
- </data>
<data name="NoSuchMember" xml:space="preserve">
<value>'{0}' no contiene una definición para '{1}'.</value>
</data>
diff --git a/src/Microsoft.CSharp/src/Resources/Strings.fr.resx b/src/Microsoft.CSharp/src/Resources/Strings.fr.resx
index e31fb94aab..4879b314dc 100644
--- a/src/Microsoft.CSharp/src/Resources/Strings.fr.resx
+++ b/src/Microsoft.CSharp/src/Resources/Strings.fr.resx
@@ -81,9 +81,6 @@
<data name="ValueCantBeNull" xml:space="preserve">
<value>Impossible de convertir null en '{0}', car il s'agit d'un type valeur qui n'autorise pas les valeurs null</value>
</data>
- <data name="WrongNestedThis" xml:space="preserve">
- <value>Impossible d'accéder à un membre non statique de type externe '{0}' par l'intermédiaire du type imbriqué '{1}'</value>
- </data>
<data name="NoSuchMember" xml:space="preserve">
<value>'{0}' ne contient pas de définition pour '{1}'</value>
</data>
diff --git a/src/Microsoft.CSharp/src/Resources/Strings.it.resx b/src/Microsoft.CSharp/src/Resources/Strings.it.resx
index 7ca475533f..4c215fcd65 100644
--- a/src/Microsoft.CSharp/src/Resources/Strings.it.resx
+++ b/src/Microsoft.CSharp/src/Resources/Strings.it.resx
@@ -81,9 +81,6 @@
<data name="ValueCantBeNull" xml:space="preserve">
<value>Impossibile convertire Null in '{0}' perché è un tipo di valore non nullable</value>
</data>
- <data name="WrongNestedThis" xml:space="preserve">
- <value>Impossibile accedere a un membro non statico di tipo outer '{0}' tramite il tipo annidato '{1}'</value>
- </data>
<data name="NoSuchMember" xml:space="preserve">
<value>'{0}' non contiene una definizione per '{1}'</value>
</data>
diff --git a/src/Microsoft.CSharp/src/Resources/Strings.ja.resx b/src/Microsoft.CSharp/src/Resources/Strings.ja.resx
index 861002fe0a..3807dae995 100644
--- a/src/Microsoft.CSharp/src/Resources/Strings.ja.resx
+++ b/src/Microsoft.CSharp/src/Resources/Strings.ja.resx
@@ -81,9 +81,6 @@
<data name="ValueCantBeNull" xml:space="preserve">
<value>Null 非許容の値型であるため、Null を '{0}' に変換できません</value>
</data>
- <data name="WrongNestedThis" xml:space="preserve">
- <value>入れ子にされた型 '{1}' を経由して、外の型 '{0}' の静的でないメンバーにアクセスすることはできません</value>
- </data>
<data name="NoSuchMember" xml:space="preserve">
<value>'{0}' に '{1}' の定義がありません</value>
</data>
diff --git a/src/Microsoft.CSharp/src/Resources/Strings.ko.resx b/src/Microsoft.CSharp/src/Resources/Strings.ko.resx
index a2a6b1bf15..609342acc1 100644
--- a/src/Microsoft.CSharp/src/Resources/Strings.ko.resx
+++ b/src/Microsoft.CSharp/src/Resources/Strings.ko.resx
@@ -81,9 +81,6 @@
<data name="ValueCantBeNull" xml:space="preserve">
<value>'{0}'은(는) null을 허용하지 않는 값 형식이므로 null을 이 형식으로 변환할 수 없습니다.</value>
</data>
- <data name="WrongNestedThis" xml:space="preserve">
- <value>중첩 형식 '{1}'을(를) 통해 외부 형식 '{0}'의 static이 아닌 멤버에 액세스할 수 없습니다.</value>
- </data>
<data name="NoSuchMember" xml:space="preserve">
<value>'{0}'에 '{1}'에 대한 정의가 없습니다.</value>
</data>
diff --git a/src/Microsoft.CSharp/src/Resources/Strings.resx b/src/Microsoft.CSharp/src/Resources/Strings.resx
index 462e5c137e..1ffdac1c11 100644
--- a/src/Microsoft.CSharp/src/Resources/Strings.resx
+++ b/src/Microsoft.CSharp/src/Resources/Strings.resx
@@ -109,9 +109,6 @@
<data name="ValueCantBeNull" xml:space="preserve">
<value>Cannot convert null to '{0}' because it is a non-nullable value type</value>
</data>
- <data name="WrongNestedThis" xml:space="preserve">
- <value>Cannot access a non-static member of outer type '{0}' via nested type '{1}'</value>
- </data>
<data name="NoSuchMember" xml:space="preserve">
<value>'{0}' does not contain a definition for '{1}'</value>
</data>
diff --git a/src/Microsoft.CSharp/src/Resources/Strings.ru.resx b/src/Microsoft.CSharp/src/Resources/Strings.ru.resx
index 9c982cc8df..78b66c55fb 100644
--- a/src/Microsoft.CSharp/src/Resources/Strings.ru.resx
+++ b/src/Microsoft.CSharp/src/Resources/Strings.ru.resx
@@ -81,9 +81,6 @@
<data name="ValueCantBeNull" xml:space="preserve">
<value>Cannot convert null to "{0}" because it is a non-nullable value type</value>
</data>
- <data name="WrongNestedThis" xml:space="preserve">
- <value>Невозможно получить доступ к нестатическому члену внешнего типа "{0}" через вложенный тип "{1}"</value>
- </data>
<data name="NoSuchMember" xml:space="preserve">
<value>"{0}" не содержит определения для "{1}"</value>
</data>
diff --git a/src/Microsoft.CSharp/src/Resources/Strings.zh-Hans.resx b/src/Microsoft.CSharp/src/Resources/Strings.zh-Hans.resx
index c4f57cf06a..65ecb7fc02 100644
--- a/src/Microsoft.CSharp/src/Resources/Strings.zh-Hans.resx
+++ b/src/Microsoft.CSharp/src/Resources/Strings.zh-Hans.resx
@@ -81,9 +81,6 @@
<data name="ValueCantBeNull" xml:space="preserve">
<value>无法将 null 转换为“{0}”,因为后者是不可以为 null 的值类型</value>
</data>
- <data name="WrongNestedThis" xml:space="preserve">
- <value>无法通过嵌套类型“{1}”来访问外部类型“{0}”的非静态成员</value>
- </data>
<data name="NoSuchMember" xml:space="preserve">
<value>“{0}”未包含“{1}”的定义</value>
</data>
diff --git a/src/Microsoft.CSharp/src/Resources/Strings.zh-Hant.resx b/src/Microsoft.CSharp/src/Resources/Strings.zh-Hant.resx
index 55ec74b0d6..0517ad500e 100644
--- a/src/Microsoft.CSharp/src/Resources/Strings.zh-Hant.resx
+++ b/src/Microsoft.CSharp/src/Resources/Strings.zh-Hant.resx
@@ -81,9 +81,6 @@
<data name="ValueCantBeNull" xml:space="preserve">
<value>無法將 null 轉換成 '{0}',因為它是不可為 null 的實值型別</value>
</data>
- <data name="WrongNestedThis" xml:space="preserve">
- <value>無法透過巢狀型別 '{1}' 存取外部型別 '{0}' 的非靜態成員</value>
- </data>
<data name="NoSuchMember" xml:space="preserve">
<value>'{0}' 不包含 '{1}' 的定義</value>
</data>