diff --git a/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs b/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs
index 5e44a2d7b1c09..a9d68d8f2dfc8 100644
--- a/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs
+++ b/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs
@@ -5201,7 +5201,7 @@ internal static string ERR_IllegalRefParam {
}
///
- /// Looks up a localized string similar to Only assignment, call, increment, decrement, and new object expressions can be used as a statement.
+ /// Looks up a localized string similar to Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement.
///
internal static string ERR_IllegalStatement {
get {
diff --git a/src/Compilers/CSharp/Portable/CSharpResources.resx b/src/Compilers/CSharp/Portable/CSharpResources.resx
index 4771b9957e785..4da46f3c37f93 100644
--- a/src/Compilers/CSharp/Portable/CSharpResources.resx
+++ b/src/Compilers/CSharp/Portable/CSharpResources.resx
@@ -898,7 +898,7 @@
Property or indexer '{0}' cannot be assigned to -- it is read only
- Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ Only assignment, call, increment, decrement, await, and new object expressions can be used as a statementforeach requires that the return type '{0}' of '{1}' must have a suitable public MoveNext method and public Current property
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf
index d2bc0fb277ed4..276c4239b7553 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf
@@ -1323,8 +1323,8 @@
- Only assignment, call, increment, decrement, and new object expressions can be used as a statement
- Jako příkaz jde použít jenom objektové výrazy přiřazení, volání, zvýšení nebo snížení hodnoty nebo výrazy obsahující operátor new.
+ Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
+ Jako příkaz jde použít jenom objektové výrazy přiřazení, volání, zvýšení nebo snížení hodnoty nebo výrazy obsahující operátor new.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf
index c4c22837d10d8..5a93e754dc804 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf
@@ -1323,8 +1323,8 @@
- Only assignment, call, increment, decrement, and new object expressions can be used as a statement
- Nur assignment-, call-, increment-, decrement- und new object-Ausdrücke können als Anweisung verwendet werden.
+ Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
+ Nur assignment-, call-, increment-, decrement- und new object-Ausdrücke können als Anweisung verwendet werden.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf
index 76860c0e85f93..a61f62dc10f78 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf
@@ -1323,8 +1323,8 @@
- Only assignment, call, increment, decrement, and new object expressions can be used as a statement
- Solo las expresiones de asignación, llamada, incremento, decremento y objeto nuevo se pueden usar como instrucción
+ Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
+ Solo las expresiones de asignación, llamada, incremento, decremento y objeto nuevo se pueden usar como instrucción
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf
index e2d706c8f18a9..b935fd4af3fe9 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf
@@ -1323,8 +1323,8 @@
- Only assignment, call, increment, decrement, and new object expressions can be used as a statement
- Seuls une assignation, un appel, un incrément, un décrément et des expressions d'objet new peuvent être utilisés comme instruction
+ Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
+ Seuls une assignation, un appel, un incrément, un décrément et des expressions d'objet new peuvent être utilisés comme instruction
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf
index fb55c7b1cd57c..70aac3ba5d7d9 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf
@@ -1323,8 +1323,8 @@
- Only assignment, call, increment, decrement, and new object expressions can be used as a statement
- Si possono usare come istruzioni solo le assegnazioni, le chiamate, gli incrementi, i decrementi e le nuove espressioni dell'oggetto
+ Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
+ Si possono usare come istruzioni solo le assegnazioni, le chiamate, gli incrementi, i decrementi e le nuove espressioni dell'oggetto
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf
index 9d3dbde572182..20a758a9f70b4 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf
@@ -1323,8 +1323,8 @@
- Only assignment, call, increment, decrement, and new object expressions can be used as a statement
- 割り当て、呼び出し、インクリメント、デクリメント、新しいオブジェクトの式のみがステートメントとして使用できます。
+ Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
+ 割り当て、呼び出し、インクリメント、デクリメント、新しいオブジェクトの式のみがステートメントとして使用できます。
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf
index 03a9b8e52ae3a..72aac446f2879 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf
@@ -1323,8 +1323,8 @@
- Only assignment, call, increment, decrement, and new object expressions can be used as a statement
- 할당, 호출, 증가, 감소 및 새 개체 식만 문으로 사용할 수 있습니다.
+ Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
+ 할당, 호출, 증가, 감소 및 새 개체 식만 문으로 사용할 수 있습니다.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf
index 42213d9f7b57e..e4f4e27503272 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf
@@ -1323,8 +1323,8 @@
- Only assignment, call, increment, decrement, and new object expressions can be used as a statement
- Jako instrukcji można używać tylko wyrażeń przypisania, wywołania, zwiększenia, zmniejszenia oraz utworzenia nowego obiektu.
+ Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
+ Jako instrukcji można używać tylko wyrażeń przypisania, wywołania, zwiększenia, zmniejszenia oraz utworzenia nowego obiektu.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf
index 4b189dc48db1b..2c1defc2aa389 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf
@@ -1323,8 +1323,8 @@
- Only assignment, call, increment, decrement, and new object expressions can be used as a statement
- Somente expressões de atribuição, chamada, incremento, diminuição e novo objeto podem ser usadas como uma instrução
+ Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
+ Somente expressões de atribuição, chamada, incremento, diminuição e novo objeto podem ser usadas como uma instrução
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf
index 8d7e0234d67b3..58a0ac7c2bcaa 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf
@@ -1323,8 +1323,8 @@
- Only assignment, call, increment, decrement, and new object expressions can be used as a statement
- В качестве оператора могут использоваться только выражения присваивания, вызова, инкремента, декремента и создания нового объекта
+ Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
+ В качестве оператора могут использоваться только выражения присваивания, вызова, инкремента, декремента и создания нового объекта
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf
index 4fee021491354..545ae4a585fb3 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf
@@ -1323,8 +1323,8 @@
- Only assignment, call, increment, decrement, and new object expressions can be used as a statement
- Yalnızca atama, çağrı, artırma, azaltma ve yeni nesne ifadeleri deyim olarak kullanılabilir
+ Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
+ Yalnızca atama, çağrı, artırma, azaltma ve yeni nesne ifadeleri deyim olarak kullanılabilir
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf
index bebd0c0f36b9b..4accbd12de2a2 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf
@@ -1323,8 +1323,8 @@
- Only assignment, call, increment, decrement, and new object expressions can be used as a statement
- 只有 assignment、call、increment、decrement 和 new 对象表达式可用作语句
+ Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
+ 只有 assignment、call、increment、decrement 和 new 对象表达式可用作语句
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf
index dcd3c9c7148b4..c1f0b4d44246f 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf
@@ -1323,8 +1323,8 @@
- Only assignment, call, increment, decrement, and new object expressions can be used as a statement
- 只有指派、呼叫、遞增、遞減以及新的物件運算式,可以用做為陳述式。
+ Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
+ 只有指派、呼叫、遞增、遞減以及新的物件運算式,可以用做為陳述式。
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenDeconstructTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenDeconstructTests.cs
index 86f3bf4eb2e83..6def4e31012a3 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenDeconstructTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenDeconstructTests.cs
@@ -7068,7 +7068,7 @@ static void Main()
// (6,18): error CS8185: A declaration is not allowed in this context.
// (int x1, string x2);
Diagnostic(ErrorCode.ERR_DeclarationExpressionNotPermitted, "string x2").WithLocation(6, 18),
- // (6,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (6,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// (int x1, string x2);
Diagnostic(ErrorCode.ERR_IllegalStatement, "(int x1, string x2)").WithLocation(6, 9),
// (6,10): error CS0165: Use of unassigned local variable 'x1'
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs
index 53047b73418af..f06e0b363b94b 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs
@@ -14911,7 +14911,7 @@ void M(int x)
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
- // (6,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (6,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// (x, x);
Diagnostic(ErrorCode.ERR_IllegalStatement, "(x, x)").WithLocation(6, 9)
);
@@ -15082,7 +15082,7 @@ void M()
" + trivial2uple + tupleattributes_cs;
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
- // (6,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (6,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// (1, 1);
Diagnostic(ErrorCode.ERR_IllegalStatement, "(1, 1)").WithLocation(6, 9)
);
diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IDelegateCreationExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IDelegateCreationExpression.cs
index 6eeb380b0fb6a..0e6d059f2ee6a 100644
--- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IDelegateCreationExpression.cs
+++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IDelegateCreationExpression.cs
@@ -107,7 +107,7 @@ void Main()
null
";
var expectedDiagnostics = new DiagnosticDescription[] {
- // CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// /**/Action a = () => 1;/**/
Diagnostic(ErrorCode.ERR_IllegalStatement, "1").WithLocation(7, 36)
};
@@ -207,7 +207,7 @@ void Main()
null
";
var expectedDiagnostics = new DiagnosticDescription[] {
- // CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// Action a = /**/(Action)(() => 1)/**/;
Diagnostic(ErrorCode.ERR_IllegalStatement, "1").WithLocation(7, 45)
};
@@ -913,7 +913,7 @@ void Main()
null
";
var expectedDiagnostics = new DiagnosticDescription[] {
- // CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// Action a = /**/new Action(() => 1)/**/;
Diagnostic(ErrorCode.ERR_IllegalStatement, "1").WithLocation(7, 47)
};
@@ -1373,7 +1373,7 @@ void Main()
null
";
var expectedDiagnostics = new DiagnosticDescription[] {
- // CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// Action a = /**/new Action((Action)(() => 1))/**/;
Diagnostic(ErrorCode.ERR_IllegalStatement, "1").WithLocation(7, 56)
};
diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IDynamicMemberReferenceExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IDynamicMemberReferenceExpression.cs
index e25396bfa03c6..4f2f3cbb840fb 100644
--- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IDynamicMemberReferenceExpression.cs
+++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IDynamicMemberReferenceExpression.cs
@@ -279,7 +279,7 @@ Type Arguments(2):
// CS0307: The property 'GetValue' cannot be used with type arguments
// /**/d.GetValue/**/;
Diagnostic(ErrorCode.ERR_TypeArgsNotAllowed, "GetValue").WithArguments("GetValue", "property").WithLocation(9, 25),
- // CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// /**/d.GetValue/**/;
Diagnostic(ErrorCode.ERR_IllegalStatement, "d.GetValue").WithLocation(9, 23)
};
diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_InvalidStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_InvalidStatement.cs
index 6e3770d0af2dc..a7b5c1ca3c561 100644
--- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_InvalidStatement.cs
+++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_InvalidStatement.cs
@@ -269,7 +269,7 @@ static void Main(string[] args)
// CS0029: Cannot implicitly convert type 'Program' to 'bool'
// else if (x) x;
Diagnostic(ErrorCode.ERR_NoImplicitConv, "x").WithArguments("Program", "bool").WithLocation(12, 18),
- // CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// else if (x) x;
Diagnostic(ErrorCode.ERR_IllegalStatement, "x").WithLocation(12, 21)
};
@@ -315,7 +315,7 @@ static void Main(string[] args)
// CS0103: The name 'P' does not exist in the current context
// /**/for (P; x;)
Diagnostic(ErrorCode.ERR_NameNotInContext, "P").WithArguments("P").WithLocation(9, 24),
- // CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// /**/for (P; x;)
Diagnostic(ErrorCode.ERR_IllegalStatement, "P").WithLocation(9, 24),
// CS0029: Cannot implicitly convert type 'Program' to 'bool'
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/BindingAsyncTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/BindingAsyncTests.cs
index 244ecbca20f71..28a1558217278 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/BindingAsyncTests.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/BindingAsyncTests.cs
@@ -2457,10 +2457,10 @@ static int Main()
// (41,9): warning CS4014: Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.
// Meth(1); //warning CS4014
Diagnostic(ErrorCode.WRN_UnobservedAwaitableExpression, "Meth(1)"),
- // (47,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (47,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// test.Prop; //error CS0201
Diagnostic(ErrorCode.ERR_IllegalStatement, "test.Prop"),
- // (48,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (48,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// test[1]; //error CS0201
Diagnostic(ErrorCode.ERR_IllegalStatement, "test[1]"),
// (44,23): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/BindingTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/BindingTests.cs
index 985a8c318041f..91e137b22ec2d 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/BindingTests.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/BindingTests.cs
@@ -2875,7 +2875,7 @@ public void F()
// (7,40): error CS1002: ; expected
// var x = new Action(i => i.
Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(7, 40),
- // (7,38): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (7,38): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// var x = new Action(i => i.
Diagnostic(ErrorCode.ERR_IllegalStatement, @"i.
").WithLocation(7, 38)
@@ -2917,7 +2917,7 @@ public void F()
// (7,32): error CS1002: ; expected
// Action x = i => i.
Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(7, 32),
- // (7,30): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (7,30): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// Action x = i => i.
Diagnostic(ErrorCode.ERR_IllegalStatement, @"i.
").WithLocation(7, 30)
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs
index 7585a8050ce25..2239e2e28a10a 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs
@@ -852,7 +852,7 @@ static void Main()
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
- // (6,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (6,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// (a) => a;
Diagnostic(ErrorCode.ERR_IllegalStatement, "(a) => a").WithLocation(6, 9)
);
@@ -876,7 +876,7 @@ static void Main()
IBlockOperation (0 statements) (OperationKind.Block, Type: null, IsInvalid) (Syntax: '{ }')
";
var expectedDiagnostics = new DiagnosticDescription[] {
- // CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// /**/(a, b) => { }/**/;
Diagnostic(ErrorCode.ERR_IllegalStatement, "(a, b) => { }").WithLocation(6, 19)
};
@@ -4221,7 +4221,7 @@ static void Main()
// (6,28): error CS8185: A declaration is not allowed in this context.
// (var (a,b), var c, int d);
Diagnostic(ErrorCode.ERR_DeclarationExpressionNotPermitted, "int d").WithLocation(6, 28),
- // (6,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (6,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// (var (a,b), var c, int d);
Diagnostic(ErrorCode.ERR_IllegalStatement, "(var (a,b), var c, int d)").WithLocation(6, 9),
// (6,28): error CS0165: Use of unassigned local variable 'd'
@@ -4361,7 +4361,7 @@ public void StandAlone_02()
// (2,20): error CS8185: A declaration is not allowed in this context.
// (var (a,b), var c, int d);
Diagnostic(ErrorCode.ERR_DeclarationExpressionNotPermitted, "int d").WithLocation(2, 20),
- // (2,1): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (2,1): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// (var (a,b), var c, int d);
Diagnostic(ErrorCode.ERR_IllegalStatement, "(var (a,b), var c, int d)").WithLocation(2, 1)
);
@@ -4489,7 +4489,7 @@ static void Main()
// (6,29): error CS8185: A declaration is not allowed in this context.
// (var (_, _), var _, int _);
Diagnostic(ErrorCode.ERR_DeclarationExpressionNotPermitted, "int _").WithLocation(6, 29),
- // (6,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (6,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// (var (_, _), var _, int _);
Diagnostic(ErrorCode.ERR_IllegalStatement, "(var (_, _), var _, int _)").WithLocation(6, 9)
);
@@ -4613,7 +4613,7 @@ public void StandAlone_04()
// (2,21): error CS8185: A declaration is not allowed in this context.
// (var (_, _), var _, int _);
Diagnostic(ErrorCode.ERR_DeclarationExpressionNotPermitted, "int _").WithLocation(2, 21),
- // (2,1): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (2,1): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// (var (_, _), var _, int _);
Diagnostic(ErrorCode.ERR_IllegalStatement, "(var (_, _), var _, int _)").WithLocation(2, 1)
);
@@ -5162,7 +5162,7 @@ static void Main()
// (6,30): error CS8185: A declaration is not allowed in this context.
// ((var (a,b), var c), int d);
Diagnostic(ErrorCode.ERR_DeclarationExpressionNotPermitted, "int d").WithLocation(6, 30),
- // (6,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (6,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// ((var (a,b), var c), int d);
Diagnostic(ErrorCode.ERR_IllegalStatement, "((var (a,b), var c), int d)").WithLocation(6, 9),
// (6,30): error CS0165: Use of unassigned local variable 'd'
@@ -5316,7 +5316,7 @@ public void StandAlone_15()
// (2,22): error CS8185: A declaration is not allowed in this context.
// ((var (a,b), var c), int d);
Diagnostic(ErrorCode.ERR_DeclarationExpressionNotPermitted, "int d").WithLocation(2, 22),
- // (2,1): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (2,1): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// ((var (a,b), var c), int d);
Diagnostic(ErrorCode.ERR_IllegalStatement, "((var (a,b), var c), int d)").WithLocation(2, 1)
);
@@ -5457,7 +5457,7 @@ static void Main()
// (6,31): error CS8185: A declaration is not allowed in this context.
// ((var (_, _), var _), int _);
Diagnostic(ErrorCode.ERR_DeclarationExpressionNotPermitted, "int _").WithLocation(6, 31),
- // (6,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (6,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// ((var (_, _), var _), int _);
Diagnostic(ErrorCode.ERR_IllegalStatement, "((var (_, _), var _), int _)").WithLocation(6, 9)
);
@@ -5594,7 +5594,7 @@ public void StandAlone_17()
// (2,23): error CS8185: A declaration is not allowed in this context.
// ((var (_, _), var _), int _);
Diagnostic(ErrorCode.ERR_DeclarationExpressionNotPermitted, "int _").WithLocation(2, 23),
- // (2,1): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (2,1): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// ((var (_, _), var _), int _);
Diagnostic(ErrorCode.ERR_IllegalStatement, "((var (_, _), var _), int _)").WithLocation(2, 1)
);
@@ -5631,7 +5631,7 @@ static void Main()
// (6,26): error CS8185: A declaration is not allowed in this context.
// (var ((a,b), c), int d);
Diagnostic(ErrorCode.ERR_DeclarationExpressionNotPermitted, "int d").WithLocation(6, 26),
- // (6,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (6,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// (var ((a,b), c), int d);
Diagnostic(ErrorCode.ERR_IllegalStatement, "(var ((a,b), c), int d)").WithLocation(6, 9),
// (6,26): error CS0165: Use of unassigned local variable 'd'
@@ -5750,7 +5750,7 @@ public void StandAlone_19()
// (2,18): error CS8185: A declaration is not allowed in this context.
// (var ((a,b), c), int d);
Diagnostic(ErrorCode.ERR_DeclarationExpressionNotPermitted, "int d").WithLocation(2, 18),
- // (2,1): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (2,1): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// (var ((a,b), c), int d);
Diagnostic(ErrorCode.ERR_IllegalStatement, "(var ((a,b), c), int d)").WithLocation(2, 1)
);
@@ -5857,7 +5857,7 @@ static void Main()
// (6,27): error CS8185: A declaration is not allowed in this context.
// (var ((_, _), _), int _);
Diagnostic(ErrorCode.ERR_DeclarationExpressionNotPermitted, "int _").WithLocation(6, 27),
- // (6,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (6,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// (var ((_, _), _), int _);
Diagnostic(ErrorCode.ERR_IllegalStatement, "(var ((_, _), _), int _)").WithLocation(6, 9)
);
@@ -5957,7 +5957,7 @@ public void StandAlone_21()
// (2,19): error CS8185: A declaration is not allowed in this context.
// (var ((_, _), _), int _);
Diagnostic(ErrorCode.ERR_DeclarationExpressionNotPermitted, "int _").WithLocation(2, 19),
- // (2,1): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (2,1): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// (var ((_, _), _), int _);
Diagnostic(ErrorCode.ERR_IllegalStatement, "(var ((_, _), _), int _)").WithLocation(2, 1)
);
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/ExpressionBodiedMemberTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/ExpressionBodiedMemberTests.cs
index 79f28652ec54e..b7039d1b3ea98 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/ExpressionBodiedMemberTests.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/ExpressionBodiedMemberTests.cs
@@ -438,7 +438,7 @@ class Program
}
");
comp.VerifyDiagnostics(
- // (4,25): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (4,25): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// private void M() => (new object());
Diagnostic(ErrorCode.ERR_IllegalStatement, "(new object())").WithLocation(4, 25));
}
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/ForEachTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/ForEachTests.cs
index 5c8551fd7ef8e..38639e9312a89 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/ForEachTests.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/ForEachTests.cs
@@ -1898,7 +1898,7 @@ public static void Main(string [] args)
// (6,18): error CS0103: The name 'i' does not exist in the current context
// foreach(int; i < 5; i++)
Diagnostic(ErrorCode.ERR_NameNotInContext, "i").WithArguments("i").WithLocation(6, 18),
- // (6,18): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (6,18): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// foreach(int; i < 5; i++)
Diagnostic(ErrorCode.ERR_IllegalStatement, "i < 5").WithLocation(6, 18),
// (6,25): error CS0103: The name 'i' does not exist in the current context
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/LambdaTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/LambdaTests.cs
index 692af9b69756b..49d9810717f62 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/LambdaTests.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/LambdaTests.cs
@@ -162,7 +162,7 @@ void M()
// (52,28): error CS8030: Anonymous function converted to a void returning delegate cannot return a value
// Action q11 = ()=>{ return 1; };
Diagnostic(ErrorCode.ERR_RetNoObjectRequiredLambda, "return").WithLocation(52, 28),
- // (54,26): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (54,26): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// Action q12 = ()=>1;
Diagnostic(ErrorCode.ERR_IllegalStatement, "1").WithLocation(54, 26),
// (56,42): warning CS0162: Unreachable code detected
@@ -591,7 +591,7 @@ static void Main()
// (9,32): error CS0020: Division by constant zero
// ((Func)delegate { 1 / 0; })();
Diagnostic(ErrorCode.ERR_IntDivByZero, "1 / 0").WithLocation(9, 32),
- // (9,32): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (9,32): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// ((Func)delegate { 1 / 0; })();
Diagnostic(ErrorCode.ERR_IllegalStatement, "1 / 0").WithLocation(9, 32),
// (9,21): error CS1643: Not all code paths return a value in anonymous method of type 'Func'
@@ -642,10 +642,10 @@ public static void Main(string[] args)
// statement expression.
CreateCompilation(csSource).VerifyDiagnostics(
- // (7,21): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (7,21): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// D d = () => new D(() => { });
Diagnostic(ErrorCode.ERR_IllegalStatement, "new D(() => { })"),
- // (8,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (8,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// new D(()=>{});
Diagnostic(ErrorCode.ERR_IllegalStatement, "new D(()=>{})"));
}
@@ -1345,7 +1345,7 @@ void M()
}
");
comp.VerifyDiagnostics(
- // (6,41): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (6,41): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// var d = new System.Action(() => (new object()));
Diagnostic(ErrorCode.ERR_IllegalStatement, "(new object())").WithLocation(6, 41));
}
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/LocalFunctionTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/LocalFunctionTests.cs
index 4630bf9cc457f..1950b5fc7282a 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/LocalFunctionTests.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/LocalFunctionTests.cs
@@ -2658,7 +2658,7 @@ int Goo
// (10,17): error CS0127: Since 'Program.Main(string[])' returns void, a return keyword must not be followed by an object expression
// return 2;
Diagnostic(ErrorCode.ERR_RetNoObjectRequired, "return").WithArguments("Program.Main(string[])").WithLocation(10, 17),
- // (13,20): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (13,20): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// int Bar => 2;
Diagnostic(ErrorCode.ERR_IllegalStatement, "2").WithLocation(13, 20),
// (13,9): warning CS0162: Unreachable code detected
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/NameOfTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/NameOfTests.cs
index 5d69138840863..463207584935f 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/NameOfTests.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/NameOfTests.cs
@@ -657,7 +657,7 @@ static void Main(string[] args)
source,
options: TestOptions.DebugExe,
parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp6)).VerifyDiagnostics(
- // (7,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (7,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// nameof(N);
Diagnostic(ErrorCode.ERR_IllegalStatement, "nameof(N)").WithLocation(7, 9)
);
@@ -682,7 +682,7 @@ static void Main(string[] args)
// (7,9): error CS8026: Feature 'nameof operator' is not available in C# 5. Please use language version 6 or greater.
// nameof(N);
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion5, "nameof(N)").WithArguments("nameof operator", "6").WithLocation(7, 9),
- // (7,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (7,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// nameof(N);
Diagnostic(ErrorCode.ERR_IllegalStatement, "nameof(N)").WithLocation(7, 9)
);
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs
index c008730c2e50e..15839c20fbe85 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs
@@ -8877,7 +8877,7 @@ static bool TakeOutParam(bool y, out bool x)
// (12,23): error CS0103: The name 'let' does not exist in the current context
// return (o) => let x1 = o;
Diagnostic(ErrorCode.ERR_NameNotInContext, "let").WithArguments("let").WithLocation(12, 23),
- // (12,23): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (12,23): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// return (o) => let x1 = o;
Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(12, 23),
// (12,27): error CS0103: The name 'x1' does not exist in the current context
@@ -8892,7 +8892,7 @@ static bool TakeOutParam(bool y, out bool x)
// (17,23): error CS0103: The name 'let' does not exist in the current context
// return (o) => let var x2 = o;
Diagnostic(ErrorCode.ERR_NameNotInContext, "let").WithArguments("let").WithLocation(17, 23),
- // (17,23): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (17,23): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// return (o) => let var x2 = o;
Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(17, 23),
// (17,36): error CS0103: The name 'o' does not exist in the current context
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests_Scope.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests_Scope.cs
index cd842c3ab934d..636b03f1ae41a 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests_Scope.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests_Scope.cs
@@ -1394,7 +1394,7 @@ void Test12()
// (12,23): error CS0103: The name 'let' does not exist in the current context
// return (o) => let x1 = o;
Diagnostic(ErrorCode.ERR_NameNotInContext, "let").WithArguments("let").WithLocation(12, 23),
- // (12,23): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (12,23): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// return (o) => let x1 = o;
Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(12, 23),
// (12,27): error CS0103: The name 'x1' does not exist in the current context
@@ -1409,7 +1409,7 @@ void Test12()
// (17,23): error CS0103: The name 'let' does not exist in the current context
// return (o) => let var x2 = o;
Diagnostic(ErrorCode.ERR_NameNotInContext, "let").WithArguments("let").WithLocation(17, 23),
- // (17,23): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (17,23): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// return (o) => let var x2 = o;
Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(17, 23),
// (17,36): error CS0103: The name 'o' does not exist in the current context
@@ -2817,7 +2817,7 @@ System.Action Test13()
// (12,29): error CS0103: The name 'let' does not exist in the current context
// void f(object o) => let x1 = o;
Diagnostic(ErrorCode.ERR_NameNotInContext, "let").WithArguments("let").WithLocation(12, 29),
- // (12,29): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (12,29): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// void f(object o) => let x1 = o;
Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(12, 29),
// (12,33): error CS0103: The name 'x1' does not exist in the current context
@@ -2829,7 +2829,7 @@ System.Action Test13()
// (18,29): error CS0103: The name 'let' does not exist in the current context
// void f(object o) => let var x2 = o;
Diagnostic(ErrorCode.ERR_NameNotInContext, "let").WithArguments("let").WithLocation(18, 29),
- // (18,29): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (18,29): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// void f(object o) => let var x2 = o;
Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(18, 29),
// (18,42): error CS0103: The name 'o' does not exist in the current context
@@ -3001,13 +3001,13 @@ bool Test11(object x11) => 1 is int x11 &&
// (9,29): error CS0103: The name 'let' does not exist in the current context
// void Test1(object o) => let x1 = o;
Diagnostic(ErrorCode.ERR_NameNotInContext, "let").WithArguments("let").WithLocation(9, 29),
- // (9,29): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (9,29): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// void Test1(object o) => let x1 = o;
Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(9, 29),
// (11,29): error CS0103: The name 'let' does not exist in the current context
// void Test2(object o) => let var x2 = o;
Diagnostic(ErrorCode.ERR_NameNotInContext, "let").WithArguments("let").WithLocation(11, 29),
- // (11,29): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (11,29): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// void Test2(object o) => let var x2 = o;
Diagnostic(ErrorCode.ERR_IllegalStatement, "let").WithLocation(11, 29),
// (15,29): error CS0841: Cannot use local variable 'x4' before it is declared
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/ScriptSemanticsTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/ScriptSemanticsTests.cs
index 984f98547402f..2dae044d79f85 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/ScriptSemanticsTests.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/ScriptSemanticsTests.cs
@@ -1070,7 +1070,7 @@ public void ArithmeticOperators_MultiplicationExpression()
s1.VerifyEmitDiagnostics();
s2.VerifyDiagnostics(
- // (1,1): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (1,1): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
Diagnostic(ErrorCode.ERR_IllegalStatement, "i* i"));
}
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticAnalyzerTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticAnalyzerTests.cs
index e67090d489e92..f72aa8ccdacf8 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticAnalyzerTests.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticAnalyzerTests.cs
@@ -160,7 +160,7 @@ void M()
// (6,9): error CS0103: The name 'x' does not exist in the current context
// x;
Diagnostic(ErrorCode.ERR_NameNotInContext, "x").WithArguments("x").WithLocation(6, 9),
- // (6,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (6,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// x;
Diagnostic(ErrorCode.ERR_IllegalStatement, "x").WithLocation(6, 9));
}
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs
index 37bd84a38c2ce..e9cd0afbecf6c 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs
@@ -7441,7 +7441,7 @@ public void Add(T x)
}
}";
CreateCompilation(text).VerifyDiagnostics(
- // (9,10): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (9,10): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
Diagnostic(ErrorCode.ERR_IllegalStatement, "checked(i++)"));
}
@@ -7460,16 +7460,16 @@ public static int Main()
}
}";
CreateCompilation(text, parseOptions: TestOptions.Regular.WithTuplesFeature()).VerifyDiagnostics(
- // (6,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (6,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// (a) => a;
Diagnostic(ErrorCode.ERR_IllegalStatement, "(a) => a").WithLocation(6, 9),
- // (7,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (7,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// (a, b) => { };
Diagnostic(ErrorCode.ERR_IllegalStatement, "(a, b) => { }").WithLocation(7, 9),
- // (9,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (9,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// x + y; x == 1;
Diagnostic(ErrorCode.ERR_IllegalStatement, "x + y").WithLocation(9, 9),
- // (9,16): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (9,16): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// x + y; x == 1;
Diagnostic(ErrorCode.ERR_IllegalStatement, "x == 1").WithLocation(9, 16),
// (4,23): error CS0161: 'A.Main()': not all code paths return a value
@@ -7494,16 +7494,16 @@ public static int Main()
}";
var comp = CreateCompilation(new[] { Parse(test, options: TestOptions.Regular6) }, new MetadataReference[] { });
comp.VerifyDiagnostics(
- // (6,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (6,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// (a) => a;
Diagnostic(ErrorCode.ERR_IllegalStatement, "(a) => a").WithLocation(6, 9),
- // (7,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (7,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// (a, b) => { };
Diagnostic(ErrorCode.ERR_IllegalStatement, "(a, b) => { }").WithLocation(7, 9),
- // (9,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (9,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// x + y; x == 1;
Diagnostic(ErrorCode.ERR_IllegalStatement, "x + y").WithLocation(9, 9),
- // (9,16): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (9,16): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// x + y; x == 1;
Diagnostic(ErrorCode.ERR_IllegalStatement, "x == 1").WithLocation(9, 16),
// (4,23): error CS0161: 'A.Main()': not all code paths return a value
@@ -23822,13 +23822,13 @@ static void Main()
}
";
CreateCompilationWithMscorlib45(text, options: TestOptions.ReleaseDll).VerifyDiagnostics(
- // (8,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (8,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// x?.Length;
Diagnostic(ErrorCode.ERR_IllegalStatement, "x?.Length").WithLocation(8, 9),
- // (9,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (9,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// x?[1];
Diagnostic(ErrorCode.ERR_IllegalStatement, "x?[1]").WithLocation(9, 9),
- // (10,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (10,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// x?.ToString()[1];
Diagnostic(ErrorCode.ERR_IllegalStatement, "x?.ToString()[1]").WithLocation(10, 9)
);
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/StackAllocInitializerTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/StackAllocInitializerTests.cs
index 9ab2d9fe4a581..6cfecf667b65b 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/StackAllocInitializerTests.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/StackAllocInitializerTests.cs
@@ -738,19 +738,19 @@ public void Method1()
// (6,9): error CS1525: Invalid expression term 'stackalloc'
// stackalloc[] {1};
Diagnostic(ErrorCode.ERR_InvalidExprTerm, "stackalloc").WithArguments("stackalloc").WithLocation(6, 9),
- // (6,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (6,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// stackalloc[] {1};
Diagnostic(ErrorCode.ERR_IllegalStatement, "stackalloc[] {1}").WithLocation(6, 9),
// (7,9): error CS1525: Invalid expression term 'stackalloc'
// stackalloc int[] {1};
Diagnostic(ErrorCode.ERR_InvalidExprTerm, "stackalloc").WithArguments("stackalloc").WithLocation(7, 9),
- // (7,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (7,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// stackalloc int[] {1};
Diagnostic(ErrorCode.ERR_IllegalStatement, "stackalloc int[] {1}").WithLocation(7, 9),
// (8,9): error CS1525: Invalid expression term 'stackalloc'
// stackalloc int[1] {1};
Diagnostic(ErrorCode.ERR_InvalidExprTerm, "stackalloc").WithArguments("stackalloc").WithLocation(8, 9),
- // (8,9): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (8,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// stackalloc int[1] {1};
Diagnostic(ErrorCode.ERR_IllegalStatement, "stackalloc int[1] {1}").WithLocation(8, 9)
);
diff --git a/src/Compilers/CSharp/Test/Syntax/Parsing/ParserErrorMessageTests.cs b/src/Compilers/CSharp/Test/Syntax/Parsing/ParserErrorMessageTests.cs
index fd73ba452fd49..ad6d437d27e19 100644
--- a/src/Compilers/CSharp/Test/Syntax/Parsing/ParserErrorMessageTests.cs
+++ b/src/Compilers/CSharp/Test/Syntax/Parsing/ParserErrorMessageTests.cs
@@ -4741,7 +4741,7 @@ unsafe public static int Main()
// (7,30): error CS1575: A stackalloc expression requires [] after type
// int *pp = stackalloc int 30;
Diagnostic(ErrorCode.ERR_BadStackAllocExpr, "int").WithLocation(7, 30),
- // (7,34): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
+ // (7,34): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// int *pp = stackalloc int 30;
Diagnostic(ErrorCode.ERR_IllegalStatement, "30").WithLocation(7, 34)
);