diff --git a/src/Compilers/CSharp/Portable/BoundTree/Formatting.cs b/src/Compilers/CSharp/Portable/BoundTree/Formatting.cs
index e7d6bcdc47e6a..a3f4257fc3e10 100644
--- a/src/Compilers/CSharp/Portable/BoundTree/Formatting.cs
+++ b/src/Compilers/CSharp/Portable/BoundTree/Formatting.cs
@@ -170,7 +170,7 @@ public override object Display
internal partial class BoundUnconvertedCollectionExpression
{
public override object Display
- => (Type is null) ? MessageID.IDS_FeatureCollectionExpressions.Localize() : base.Display;
+ => (Type is null) ? MessageID.IDS_CollectionExpression.Localize() : base.Display;
}
internal partial class BoundPassByCopy
diff --git a/src/Compilers/CSharp/Portable/CSharpResources.resx b/src/Compilers/CSharp/Portable/CSharpResources.resx
index 87b27a965a5cc..fe9ff8f3a107c 100644
--- a/src/Compilers/CSharp/Portable/CSharpResources.resx
+++ b/src/Compilers/CSharp/Portable/CSharpResources.resx
@@ -6850,6 +6850,9 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
collection expressions
+
+ collection expression
+
Cannot initialize type '{0}' with a collection expression because the type is not constructible.
diff --git a/src/Compilers/CSharp/Portable/Errors/MessageID.cs b/src/Compilers/CSharp/Portable/Errors/MessageID.cs
index cd06dbeed0fa1..c827b5e5f0344 100644
--- a/src/Compilers/CSharp/Portable/Errors/MessageID.cs
+++ b/src/Compilers/CSharp/Portable/Errors/MessageID.cs
@@ -302,6 +302,7 @@ internal enum MessageID
IDS_FeatureExtensions = MessageBase + 12853,
IDS_FeatureNullConditionalAssignment = MessageBase + 12854,
IDS_FeatureExpressionOptionalAndNamedArguments = MessageBase + 12855,
+ IDS_CollectionExpression = MessageBase + 12856,
}
// Message IDs may refer to strings that need to be localized.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf
index 697b2b861e52b..8825ac687f034 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf
@@ -2552,6 +2552,11 @@
přepsání tvůrce asynchronní metody
+
+ collection expression
+ collection expression
+
+
allows ref struct constraint
povoluje omezení ref struct
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf
index 90f6eadbedde1..ef7f0e29967f6 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf
@@ -2552,6 +2552,11 @@
Außerkraftsetzung des asynchronen Methoden-Generators
+
+ collection expression
+ collection expression
+
+
allows ref struct constraint
lässt eine Verweisstruktureinschränkung zu.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf
index f807bfa4488dd..5fc12ad5bdb65 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf
@@ -2552,6 +2552,11 @@
invalidación del generador de métodos asincrónicos
+
+ collection expression
+ collection expression
+
+
allows ref struct constraint
permite la restricción ref struct
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf
index 33eedc4a06d7b..0c0f2f3a4ca00 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf
@@ -2552,6 +2552,11 @@
Remplacement du générateur de méthode asynchrone
+
+ collection expression
+ collection expression
+
+
allows ref struct constraint
autorise la contrainte de struct ref
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf
index d5273280ff8e8..cce6928ac8add 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf
@@ -2552,6 +2552,11 @@
override del generatore di metodi asincroni
+
+ collection expression
+ collection expression
+
+
allows ref struct constraint
consente il vincolo di struct di riferimento
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf
index 0a92feb9c99bd..36811fe9064c6 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf
@@ -2552,6 +2552,11 @@
非同期メソッド ビルダーのオーバーライド
+
+ collection expression
+ collection expression
+
+
allows ref struct constraint
ref 構造体制約を許可します
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf
index 3d7594687a146..ee178a3590cb9 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf
@@ -2552,6 +2552,11 @@
비동기 메서드 빌더 재정의
+
+ collection expression
+ collection expression
+
+
allows ref struct constraint
ref 구조체 제약 조건 허용
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf
index f15157a44edf7..e864335a16e28 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf
@@ -2552,6 +2552,11 @@
zastąpienie konstruktora metodą asynchroniczną
+
+ collection expression
+ collection expression
+
+
allows ref struct constraint
zezwala na ograniczenie ref struct
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf
index a4eac04841f2b..9da1115aa1152 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf
@@ -2552,6 +2552,11 @@
substituição do construtor de método assíncrono
+
+ collection expression
+ collection expression
+
+
allows ref struct constraint
permite a restrição de ref struct
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf
index bf7d20fea47d7..5afdd9365a280 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf
@@ -2552,6 +2552,11 @@
переопределение построителя методов async
+
+ collection expression
+ collection expression
+
+
allows ref struct constraint
разрешает ограничение структуры "ref"
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf
index e1b7e1afa66b2..c83a893e9cb63 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf
@@ -2552,6 +2552,11 @@
zaman uyumsuz yöntem oluşturucusunu geçersiz kılma
+
+ collection expression
+ collection expression
+
+
allows ref struct constraint
ref struct kısıtlamasına izin verir
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf
index 37ffe4e9f0b7a..4ac30e9897283 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf
@@ -2552,6 +2552,11 @@
异步方法生成器替代
+
+ collection expression
+ collection expression
+
+
allows ref struct constraint
允许 ref struct 约束
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf
index 5044f006ddd3b..edff2e019cf93 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf
@@ -2552,6 +2552,11 @@
非同步方法建立器覆寫
+
+ collection expression
+ collection expression
+
+
allows ref struct constraint
允許參考結構限制式
diff --git a/src/Compilers/CSharp/Test/Emit3/Semantics/CollectionExpressionTests.cs b/src/Compilers/CSharp/Test/Emit3/Semantics/CollectionExpressionTests.cs
index eeb7002d0a44e..78cc248bb4826 100644
--- a/src/Compilers/CSharp/Test/Emit3/Semantics/CollectionExpressionTests.cs
+++ b/src/Compilers/CSharp/Test/Emit3/Semantics/CollectionExpressionTests.cs
@@ -3311,9 +3311,9 @@ static void Main(string[] args)
""";
var comp = CreateCompilation(source);
comp.VerifyEmitDiagnostics(
- // (6,17): error CS0173: Type of conditional expression cannot be determined because there is no implicit conversion between 'collection expressions' and 'collection expressions'
+ // (6,17): error CS0173: Type of conditional expression cannot be determined because there is no implicit conversion between 'collection expression' and 'collection expression'
// var y = b ? [new int[0]] : [[1, 2, 3]];
- Diagnostic(ErrorCode.ERR_InvalidQM, "b ? [new int[0]] : [[1, 2, 3]]").WithArguments("collection expressions", "collection expressions").WithLocation(6, 17));
+ Diagnostic(ErrorCode.ERR_InvalidQM, "b ? [new int[0]] : [[1, 2, 3]]").WithArguments("collection expression", "collection expression").WithLocation(6, 17));
}
[Fact]
@@ -3436,9 +3436,9 @@ static void Main()
""";
var comp = CreateCompilation(new[] { source, s_collectionExtensions });
comp.VerifyEmitDiagnostics(
- // 0.cs(9,29): error CS0173: Type of conditional expression cannot be determined because there is no implicit conversion between 'collection expressions' and 'collection expressions'
+ // 0.cs(9,29): error CS0173: Type of conditional expression cannot be determined because there is no implicit conversion between 'collection expression' and 'collection expression'
// var a = AsArray([.. b ? [x] : [y]]);
- Diagnostic(ErrorCode.ERR_InvalidQM, "b ? [x] : [y]").WithArguments("collection expressions", "collection expressions").WithLocation(9, 29));
+ Diagnostic(ErrorCode.ERR_InvalidQM, "b ? [x] : [y]").WithArguments("collection expression", "collection expression").WithLocation(9, 29));
}
[Fact]
@@ -9763,9 +9763,9 @@ static string[] Append(string a, string b, bool c)
""";
var comp = CreateCompilation(source);
comp.VerifyEmitDiagnostics(
- // (5,26): error CS0173: Type of conditional expression cannot be determined because there is no implicit conversion between 'collection expressions' and 'collection expressions'
+ // (5,26): error CS0173: Type of conditional expression cannot be determined because there is no implicit conversion between 'collection expression' and 'collection expression'
// return [a, b, .. c ? [null] : []];
- Diagnostic(ErrorCode.ERR_InvalidQM, "c ? [null] : []").WithArguments("collection expressions", "collection expressions").WithLocation(5, 26));
+ Diagnostic(ErrorCode.ERR_InvalidQM, "c ? [null] : []").WithArguments("collection expression", "collection expression").WithLocation(5, 26));
}
[Fact]
@@ -28022,9 +28022,9 @@ static void Main(List list)
}
""";
CreateCompilation(source).VerifyEmitDiagnostics(
- // (7,9): error CS0019: Operator '+' cannot be applied to operands of type 'collection expressions' and 'List'
+ // (7,9): error CS0019: Operator '+' cannot be applied to operands of type 'collection expression' and 'List'
// [] + list;
- Diagnostic(ErrorCode.ERR_BadBinaryOps, "[] + list").WithArguments("+", "collection expressions", "System.Collections.Generic.List").WithLocation(7, 9),
+ Diagnostic(ErrorCode.ERR_BadBinaryOps, "[] + list").WithArguments("+", "collection expression", "System.Collections.Generic.List").WithLocation(7, 9),
// (7,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
// [] + list;
Diagnostic(ErrorCode.ERR_IllegalStatement, "[] + list").WithLocation(7, 9));