diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
index 15776dae68dca..456580dc858d4 100644
--- a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
+++ b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
@@ -6207,9 +6207,9 @@ private BoundExpression BindInstanceMemberAccess(
lookupResult,
flags);
- if (!boundMethodGroup.HasErrors && boundMethodGroup.ResultKind == LookupResultKind.Empty && typeArgumentsSyntax.Any(SyntaxKind.OmittedTypeArgument))
+ if (!boundMethodGroup.HasErrors && typeArgumentsSyntax.Any(SyntaxKind.OmittedTypeArgument))
{
- Error(diagnostics, ErrorCode.ERR_BadArity, node, rightName, MessageID.IDS_MethodGroup.Localize(), typeArgumentsSyntax.Count);
+ Error(diagnostics, ErrorCode.ERR_OmittedTypeArgument, node);
}
return boundMethodGroup;
diff --git a/src/Compilers/CSharp/Portable/CSharpResources.resx b/src/Compilers/CSharp/Portable/CSharpResources.resx
index d0f8c18de2bf6..e38175ee924cd 100644
--- a/src/Compilers/CSharp/Portable/CSharpResources.resx
+++ b/src/Compilers/CSharp/Portable/CSharpResources.resx
@@ -471,6 +471,9 @@
Keyword 'this' is not available in the current context
+
+ Omitting the type argument is not allowed in the current context
+
'{0}' has the wrong signature to be an entry point
diff --git a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs
index 0d319758d6705..bb266a9c44ecc 100644
--- a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs
+++ b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs
@@ -1581,6 +1581,7 @@ internal enum ErrorCode
WRN_TypeParameterSameAsOuterMethodTypeParameter = 8387,
ERR_OutVariableCannotBeByRef = 8388,
+ ERR_OmittedTypeArgument = 8389,
#region diagnostics introduced for C# 8.0
ERR_FeatureNotAvailableInVersion8 = 8400,
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf
index c39bf3a0595e1..08fc6d0b5e9c8 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf
@@ -522,6 +522,11 @@
Parametr typu s možnou hodnotou null musí být známou hodnotou nebo musí jít o typ odkazu, který nemůže mít hodnotu null. Zvažte přidání 'class', 'struct' nebo omezení typu.
+
+
+ Omitting the type argument is not allowed in the current context
+
+ Výstupní proměnná nemůže být deklarovaná jako lokální proměnná podle odkazu.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf
index b810fd96d826a..0f5d10480c6d0 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf
@@ -522,6 +522,11 @@
Ein Nullable-Typparameter muss als Werttyp oder als Non-Nullable-Verweistyp bekannt sein. Sie sollten eine class-, struct- oder eine Typeinschränkung hinzufügen.
+
+
+ Omitting the type argument is not allowed in the current context
+
+ Eine out-Variable kann nicht als lokales ref-Element deklariert werden.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf
index 9c4dfff940905..516e4c57a12da 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf
@@ -522,6 +522,11 @@
Debe saberse si un parámetro de tipo que acepta valores NULL es un tipo de valor o un tipo de referencia que no admite valores NULL. Considere agregar "class", "struct" o una restricción de tipo.
+
+
+ Omitting the type argument is not allowed in the current context
+
+ Una variable out no se puede declarar como ref local
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf
index 636f2cbeccac3..2eb58be273ff2 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf
@@ -522,6 +522,11 @@
Un paramètre de type nullable doit être connu pour pouvoir être un type valeur ou un type référence non-nullable. Ajoutez une contrainte 'class', 'struct' ou une contrainte de type.
+
+
+ Omitting the type argument is not allowed in the current context
+
+ Impossible de déclarer une variable out en tant que variable locale ref
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf
index bd12bad29c429..de5534b1d1769 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf
@@ -522,6 +522,11 @@
Un parametro di tipo che ammette i valori Null deve essere noto per essere un tipo valore o un tipo riferimento che non ammette i valori Null. Provare ad aggiungere un vincolo di tipo, 'class' o 'struct'.
+
+
+ Omitting the type argument is not allowed in the current context
+
+ Non è possibile dichiarare una variabile out come variabile locale ref
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf
index eb87b224cf146..0c90a72a7cd92 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf
@@ -522,6 +522,11 @@
Null 許容型パラメーターは、値の型または Null 非許容参照型として既知である必要があります。'class'、'struct'、型制約を追加することをご検討ください。
+
+
+ Omitting the type argument is not allowed in the current context
+
+ out 変数を ref ローカルと宣言することはできません
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf
index 6fdc509ff6f67..199b92ecbc1d5 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf
@@ -522,6 +522,11 @@
값 형식 또는 null을 허용하지 않는 참조 형식이 되려면 nullable 형식 매개 변수를 알려야 합니다. 'class', 'struct' 또는 형식 제약 조건 추가를 고려하세요.
+
+
+ Omitting the type argument is not allowed in the current context
+
+ 출력 변수는 참조 로컬로 선언할 수 없습니다.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf
index 4a53f3e9c344b..a9c4d8a52c3ef 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf
@@ -522,6 +522,11 @@
Nullowalny parametr typumusi być typem wartości lub nienullowalnym typem referencyjnym. Rozważ dodanie elementu „class”, „struct” lub ograniczenia typu.
+
+
+ Omitting the type argument is not allowed in the current context
+
+ Zmiennej out nie można zadeklarować jako lokalnej zmiennej ref
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf
index 13a55d0ec0f4f..6e2c28a47b4c4 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf
@@ -522,6 +522,11 @@
Um parâmetro de tipo que permite valor nulo precisa ser um tipo de valor ou um tipo de referência não anulável. Considere a possibilidade de adicionar 'class', 'struct' ou restrição de tipo.
+
+
+ Omitting the type argument is not allowed in the current context
+
+ Uma variável out não pode ser declarada como uma referência local
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf
index 734f1f2665d0f..75ecbf0b9a868 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf
@@ -522,6 +522,11 @@
Параметр типа, допускающего значение NULL, должен быть известен как тип значения или ссылочный тип, не допускающий значение NULL. Рекомендуется добавить "class", "struct" или ограничение типа.
+
+
+ Omitting the type argument is not allowed in the current context
+
+ Выходная переменная не может быть объявлена как локальная переменная ref
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf
index 461fe2e2b32ee..c60c2a87e2c6e 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf
@@ -522,6 +522,11 @@
Boş değer atanabilir bir tür parametresi bilinen bir değer türü veya boş değer atanamayan bir başvuru türü olmalıdır. Bir 'class', 'struct' veya tür kısıtlaması eklemeyi düşünün.
+
+
+ Omitting the type argument is not allowed in the current context
+
+ Bir out değişkeni ref yerel değeri olarak bildirilemez
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf
index ad479c03ac475..6b564653b4a91 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf
@@ -522,6 +522,11 @@
可为 null 的类型参数必须已知为值类型或不可为 null 引用类型。请考虑添加一个 “class”、“struct” 或类型约束。
+
+
+ Omitting the type argument is not allowed in the current context
+
+ out 变量无法声明为 ref 局部变量
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf
index 1f1a6c94f3ab4..38c0b1775599c 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf
@@ -522,6 +522,11 @@
可為 Null 的型別參數必須已知為實值型別或不可為 Null 的參考型別。建議新增 'class'、'struct' 或型別條件約束。
+
+
+ Omitting the type argument is not allowed in the current context
+
+ out 變數不可宣告為 ref local
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/BindingTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/BindingTests.cs
index 367e5b24d1d6b..2f33afac51fba 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/BindingTests.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/BindingTests.cs
@@ -3516,81 +3516,81 @@ public void Test()
var compilation = CreateCompilationWithMscorlib40AndSystemCore(source);
compilation.VerifyDiagnostics(
- // (13,27): error CS0305: Using the generic method group 'ExtensionMethod0' requires 1 type arguments
- // var omittedArg0 = "string literal".ExtensionMethod0<>();
- Diagnostic(ErrorCode.ERR_BadArity, @"""string literal"".ExtensionMethod0<>").WithArguments("ExtensionMethod0", "method group", "1").WithLocation(13, 27),
- // (13,44): error CS1061: 'string' does not contain a definition for 'ExtensionMethod0' and no extension method 'ExtensionMethod0' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
- // var omittedArg0 = "string literal".ExtensionMethod0<>();
- Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ExtensionMethod0<>").WithArguments("string", "ExtensionMethod0").WithLocation(13, 44),
- // (14,27): error CS0305: Using the generic method group 'ExtensionMethod1' requires 1 type arguments
- // var omittedArg1 = "string literal".ExtensionMethod1<>();
- Diagnostic(ErrorCode.ERR_BadArity, @"""string literal"".ExtensionMethod1<>").WithArguments("ExtensionMethod1", "method group", "1").WithLocation(14, 27),
- // (15,27): error CS0305: Using the generic method group 'ExtensionMethod2' requires 1 type arguments
- // var omittedArg2 = "string literal".ExtensionMethod2<>();
- Diagnostic(ErrorCode.ERR_BadArity, @"""string literal"".ExtensionMethod2<>").WithArguments("ExtensionMethod2", "method group", "1").WithLocation(15, 27),
- // (15,44): error CS1061: 'string' does not contain a definition for 'ExtensionMethod2' and no extension method 'ExtensionMethod2' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
- // var omittedArg2 = "string literal".ExtensionMethod2<>();
- Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ExtensionMethod2<>").WithArguments("string", "ExtensionMethod2").WithLocation(15, 44),
- // (17,31): error CS0305: Using the generic method group 'ExtensionMethod0' requires 1 type arguments
- // var omittedArgFunc0 = "string literal".ExtensionMethod0<>;
- Diagnostic(ErrorCode.ERR_BadArity, @"""string literal"".ExtensionMethod0<>").WithArguments("ExtensionMethod0", "method group", "1").WithLocation(17, 31),
- // (17,48): error CS1061: 'string' does not contain a definition for 'ExtensionMethod0' and no extension method 'ExtensionMethod0' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
- // var omittedArgFunc0 = "string literal".ExtensionMethod0<>;
- Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ExtensionMethod0<>").WithArguments("string", "ExtensionMethod0").WithLocation(17, 48),
- // (18,31): error CS0305: Using the generic method group 'ExtensionMethod1' requires 1 type arguments
- // var omittedArgFunc1 = "string literal".ExtensionMethod1<>;
- Diagnostic(ErrorCode.ERR_BadArity, @"""string literal"".ExtensionMethod1<>").WithArguments("ExtensionMethod1", "method group", "1").WithLocation(18, 31),
- // (18,13): error CS0815: Cannot assign method group to an implicitly-typed variable
- // var omittedArgFunc1 = "string literal".ExtensionMethod1<>;
- Diagnostic(ErrorCode.ERR_ImplicitlyTypedVariableAssignedBadValue, @"omittedArgFunc1 = ""string literal"".ExtensionMethod1<>").WithArguments("method group").WithLocation(18, 13),
- // (19,31): error CS0305: Using the generic method group 'ExtensionMethod2' requires 1 type arguments
- // var omittedArgFunc2 = "string literal".ExtensionMethod2<>;
- Diagnostic(ErrorCode.ERR_BadArity, @"""string literal"".ExtensionMethod2<>").WithArguments("ExtensionMethod2", "method group", "1").WithLocation(19, 31),
- // (19,48): error CS1061: 'string' does not contain a definition for 'ExtensionMethod2' and no extension method 'ExtensionMethod2' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
- // var omittedArgFunc2 = "string literal".ExtensionMethod2<>;
- Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ExtensionMethod2<>").WithArguments("string", "ExtensionMethod2").WithLocation(19, 48),
- // (21,42): error CS1061: 'string' does not contain a definition for 'ExtensionMethod0' and no extension method 'ExtensionMethod0' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
- // var moreArgs0 = "string literal".ExtensionMethod0();
- Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ExtensionMethod0").WithArguments("string", "ExtensionMethod0").WithLocation(21, 42),
- // (22,42): error CS1061: 'string' does not contain a definition for 'ExtensionMethod1' and no extension method 'ExtensionMethod1' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
- // var moreArgs1 = "string literal".ExtensionMethod1();
- Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ExtensionMethod1").WithArguments("string", "ExtensionMethod1").WithLocation(22, 42),
- // (23,42): error CS1061: 'string' does not contain a definition for 'ExtensionMethod2' and no extension method 'ExtensionMethod2' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
- // var moreArgs2 = "string literal".ExtensionMethod2();
- Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ExtensionMethod2").WithArguments("string", "ExtensionMethod2").WithLocation(23, 42),
- // (25,42): error CS0411: The type arguments for method 'FooExtensions.ExtensionMethod1(object)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
- // var lessArgs1 = "string literal".ExtensionMethod1();
- Diagnostic(ErrorCode.ERR_CantInferMethTypeArgs, "ExtensionMethod1").WithArguments("FooExtensions.ExtensionMethod1(object)").WithLocation(25, 42),
- // (26,42): error CS1061: 'string' does not contain a definition for 'ExtensionMethod2' and no extension method 'ExtensionMethod2' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
- // var lessArgs2 = "string literal".ExtensionMethod2();
- Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ExtensionMethod2").WithArguments("string", "ExtensionMethod2").WithLocation(26, 42),
- // (28,51): error CS1061: 'string' does not contain a definition for 'ExtensionMethodNotFound0' and no extension method 'ExtensionMethodNotFound0' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
- // var nonExistingMethod0 = "string literal".ExtensionMethodNotFound0();
- Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ExtensionMethodNotFound0").WithArguments("string", "ExtensionMethodNotFound0").WithLocation(28, 51),
- // (29,51): error CS1061: 'string' does not contain a definition for 'ExtensionMethodNotFound1' and no extension method 'ExtensionMethodNotFound1' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
- // var nonExistingMethod1 = "string literal".ExtensionMethodNotFound1();
- Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ExtensionMethodNotFound1").WithArguments("string", "ExtensionMethodNotFound1").WithLocation(29, 51),
- // (30,51): error CS1061: 'string' does not contain a definition for 'ExtensionMethodNotFound2' and no extension method 'ExtensionMethodNotFound2' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
- // var nonExistingMethod2 = "string literal".ExtensionMethodNotFound2();
- Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "ExtensionMethodNotFound2").WithArguments("string", "ExtensionMethodNotFound2").WithLocation(30, 51),
- // (32,51): error CS0305: Using the generic method group 'ExtensionMethod0' requires 1 type arguments
- // System.Func