diff --git a/src/Compiler/Checking/ConstraintSolver.fs b/src/Compiler/Checking/ConstraintSolver.fs index 34b25ba36a..29c753396a 100644 --- a/src/Compiler/Checking/ConstraintSolver.fs +++ b/src/Compiler/Checking/ConstraintSolver.fs @@ -1083,7 +1083,12 @@ and SolveAnonInfoEqualsAnonInfo (csenv: ConstraintSolverEnv) m2 (anonInfo1: Anon let message = match anonInfo1.SortedNames, anonInfo2.SortedNames with | Subset missingFields -> - FSComp.SR.tcAnonRecdFieldNameSubset(string missingFields) + match missingFields with + | [missingField] -> + FSComp.SR.tcAnonRecdSingleFieldNameSubset(string missingField) + | _ -> + let missingFields = String.concat ", " missingFields + FSComp.SR.tcAnonRecdMultipleFieldsNameSubset(string missingFields) | Superset extraFields -> FSComp.SR.tcAnonRecdFieldNameSuperset(string extraFields) | Overlap (missingFields, extraFields) -> diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 0a02f15fcc..d9ba6d6c7a 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1394,7 +1394,8 @@ tcGlobalsSystemTypeNotFound,"The system type '%s' was required but no referenced tcAnonRecdInvalid,"Invalid Anonymous Record type declaration." tcAnonRecdCcuMismatch,"Two anonymous record types are from different assemblies '%s' and '%s'" tcAnonRecdFieldNameMismatch,"This anonymous record does not exactly match the expected shape. Add the missing fields %s and remove the extra fields %s." -tcAnonRecdFieldNameSubset,"This anonymous record does not have enough fields. Add the missing fields %s." +tcAnonRecdSingleFieldNameSubset,"This anonymous record is missing field '%s'." +tcAnonRecdMultipleFieldsNameSubset,"This anonymous record is missing fields '%s'." tcAnonRecdFieldNameSuperset,"This anonymous record has too many fields. Remove the extra fields %s." tcAnonRecdFieldNameDifferent,"This is the wrong anonymous record. It should have the fields %s." keywordDescriptionAbstract,"Indicates a method that either has no implementation in the type in which it is declared or that is virtual and has a default implementation." diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index beecbb266a..228d79015d 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -1017,14 +1017,9 @@ Toto je nesprávný anonymní záznam. Měl by mít pole {0}. - - This anonymous record does not have enough fields. Add the missing fields {0}. - Tento anonymní záznam nemá dost polí. Přidejte chybějící pole {0}. - - This anonymous record has too many fields. Remove the extra fields {0}. - Tento anonymní záznam má příliš mnoho polí. Odeberte nadbytečná pole {0}. + Tento anonymní záznam má příliš mnoho polí. Odeberte nadbytečná pole {0}. @@ -1032,6 +1027,16 @@ Neplatná deklarace typu anonymního záznamu + + This anonymous record is missing fields '{0}'. + This anonymous record is missing fields '{0}'. + + + + This anonymous record is missing field '{0}'. + This anonymous record is missing field '{0}'. + + The field '{0}' appears multiple times in this anonymous record type. Pole {0} se v tomto anonymním typu záznamu vyskytuje vícekrát. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 6ce34728b7..bd7798f2d3 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -1017,14 +1017,9 @@ Dies ist der falsche anonyme Datensatz. Er muss folgende Felder umfassen: {0}. - - This anonymous record does not have enough fields. Add the missing fields {0}. - Dieser anonyme Datensatz weist nicht genügend Felder auf. Fügen Sie die fehlenden Felder ({0}) hinzu. - - This anonymous record has too many fields. Remove the extra fields {0}. - Dieser anonyme Datensatz enthält zu viele Felder. Entfernen Sie die zusätzlichen Felder ({0}). + Dieser anonyme Datensatz enthält zu viele Felder. Entfernen Sie die zusätzlichen Felder ({0}). @@ -1032,6 +1027,16 @@ Ungültige Deklaration für anonymen Datensatztyp. + + This anonymous record is missing fields '{0}'. + This anonymous record is missing fields '{0}'. + + + + This anonymous record is missing field '{0}'. + This anonymous record is missing field '{0}'. + + The field '{0}' appears multiple times in this anonymous record type. Das Feld "{0}" ist in diesem anonymen Datensatztyp mehrmals vorhanden. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 1260d64726..a6de2ed63a 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -1017,14 +1017,9 @@ Este es un registro anónimo incorrecto. Debe tener los campos {0}. - - This anonymous record does not have enough fields. Add the missing fields {0}. - Este registro anónimo no tiene suficientes campos. Agregue los campos que faltan {0}. - - This anonymous record has too many fields. Remove the extra fields {0}. - Este registro anónimo tiene demasiados campos. Quite los campos adicionales {0}. + Este registro anónimo tiene demasiados campos. Quite los campos adicionales {0}. @@ -1032,6 +1027,16 @@ Declaración de tipo de registro anónimo no válido. + + This anonymous record is missing fields '{0}'. + This anonymous record is missing fields '{0}'. + + + + This anonymous record is missing field '{0}'. + This anonymous record is missing field '{0}'. + + The field '{0}' appears multiple times in this anonymous record type. El campo "{0}" aparece varias veces en este tipo de registro anónimo. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 499359f02f..6c6230ad97 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -1017,14 +1017,9 @@ Il s'agit de l'enregistrement anonyme incorrect. Il doit contenir les champs {0}. - - This anonymous record does not have enough fields. Add the missing fields {0}. - Cet enregistrement anonyme ne contient pas suffisamment de champs. Ajoutez les champs manquants {0}. - - This anonymous record has too many fields. Remove the extra fields {0}. - Cet enregistrement anonyme a trop de champs. Supprimez les champs supplémentaires {0}. + Cet enregistrement anonyme a trop de champs. Supprimez les champs supplémentaires {0}. @@ -1032,6 +1027,16 @@ Déclaration de type d'enregistrement anonyme non valide. + + This anonymous record is missing fields '{0}'. + This anonymous record is missing fields '{0}'. + + + + This anonymous record is missing field '{0}'. + This anonymous record is missing field '{0}'. + + The field '{0}' appears multiple times in this anonymous record type. Le champ '{0}' apparaît plusieurs fois dans ce type d'enregistrement anonyme. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 7821487ad3..c58c13a6e0 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -1017,14 +1017,9 @@ Si tratta del record anonimo errato. Deve includere i campi {0}. - - This anonymous record does not have enough fields. Add the missing fields {0}. - Questo record anonimo non contiene un numero sufficiente di campi. Aggiungere i campi mancanti {0}. - - This anonymous record has too many fields. Remove the extra fields {0}. - Questo record anonimo contiene troppi campi. Rimuovere i campi aggiuntivi {0}. + Questo record anonimo contiene troppi campi. Rimuovere i campi aggiuntivi {0}. @@ -1032,6 +1027,16 @@ La dichiarazione di tipo Record anonimo non è valida. + + This anonymous record is missing fields '{0}'. + This anonymous record is missing fields '{0}'. + + + + This anonymous record is missing field '{0}'. + This anonymous record is missing field '{0}'. + + The field '{0}' appears multiple times in this anonymous record type. Il campo '{0}' viene visualizzato più volte in questo tipo di record anonimo. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 8bd0fc9cb2..7d79034951 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -1017,14 +1017,9 @@ この匿名レコードは正しくありません。フィールド {0} を含んでいる必要があります。 - - This anonymous record does not have enough fields. Add the missing fields {0}. - この匿名レコードには十分なフィールドがありません。不足しているフィールド {0} を追加してください。 - - This anonymous record has too many fields. Remove the extra fields {0}. - この匿名レコードはフィールドが多すぎます。不要なフィールド {0} を削除してください。 + この匿名レコードはフィールドが多すぎます。不要なフィールド {0} を削除してください。 @@ -1032,6 +1027,16 @@ 匿名レコードの型宣言が無効です。 + + This anonymous record is missing fields '{0}'. + This anonymous record is missing fields '{0}'. + + + + This anonymous record is missing field '{0}'. + This anonymous record is missing field '{0}'. + + The field '{0}' appears multiple times in this anonymous record type. この匿名レコードの種類に、フィールド '{0}' が複数回出現します。 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 1c4814d0e2..9f8c5930a0 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -1017,14 +1017,9 @@ 잘못된 익명 레코드입니다. {0} 필드가 있어야 합니다. - - This anonymous record does not have enough fields. Add the missing fields {0}. - 이 익명 레코드에 필드가 부족합니다. 누락된 필드 {0}을(를) 추가하세요. - - This anonymous record has too many fields. Remove the extra fields {0}. - 이 익명 레코드에 필드가 너무 많습니다. 추가 필드 {0}을(를) 제거하세요. + 이 익명 레코드에 필드가 너무 많습니다. 추가 필드 {0}을(를) 제거하세요. @@ -1032,6 +1027,16 @@ 익명 레코드 형식 선언이 잘못되었습니다. + + This anonymous record is missing fields '{0}'. + This anonymous record is missing fields '{0}'. + + + + This anonymous record is missing field '{0}'. + This anonymous record is missing field '{0}'. + + The field '{0}' appears multiple times in this anonymous record type. '{0}' 필드가 이 익명 레코드 형식에서 여러 번 나타납니다. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 95eb448870..580e507aea 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -1017,14 +1017,9 @@ To jest nieprawidłowy rekord anonimowy. Powinien zawierać pola {0}. - - This anonymous record does not have enough fields. Add the missing fields {0}. - Ten rekord anonimowy nie ma wystarczającej liczby pól. Dodaj brakujące pola {0}. - - This anonymous record has too many fields. Remove the extra fields {0}. - Ten rekord anonimowy ma za dużo pól. Usuń dodatkowe pola {0}. + Ten rekord anonimowy ma za dużo pól. Usuń dodatkowe pola {0}. @@ -1032,6 +1027,16 @@ Nieprawidłowa deklaracja typu rekordu anonimowego. + + This anonymous record is missing fields '{0}'. + This anonymous record is missing fields '{0}'. + + + + This anonymous record is missing field '{0}'. + This anonymous record is missing field '{0}'. + + The field '{0}' appears multiple times in this anonymous record type. Pole „{0}” występuje wielokrotnie w tym anonimowym typie rekordu. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 23394204db..00fb4aabaa 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -1017,14 +1017,9 @@ Este é o registro anônimo errado. Ele deve ter os campos {0}. - - This anonymous record does not have enough fields. Add the missing fields {0}. - Este registro anônimo não tem campos suficientes. Adicione os campos ausentes {0}. - - This anonymous record has too many fields. Remove the extra fields {0}. - Este registro anônimo tem muitos campos. Remova os campos extras {0}. + Este registro anônimo tem muitos campos. Remova os campos extras {0}. @@ -1032,6 +1027,16 @@ Declaração inválida de tipo de Registro Anônimo. + + This anonymous record is missing fields '{0}'. + This anonymous record is missing fields '{0}'. + + + + This anonymous record is missing field '{0}'. + This anonymous record is missing field '{0}'. + + The field '{0}' appears multiple times in this anonymous record type. O campo '{0}' aparece várias vezes nesse tipo de registro anônimo. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index c763a3ec3c..ceb37f8bc9 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -1017,14 +1017,9 @@ Неправильная анонимная запись. Она должна содержать поля {0}. - - This anonymous record does not have enough fields. Add the missing fields {0}. - В этой анонимной записи недостаточно полей. Добавьте недостающие поля {0}. - - This anonymous record has too many fields. Remove the extra fields {0}. - Эта анонимная запись содержит слишком много полей. Удалите лишние поля {0}. + Эта анонимная запись содержит слишком много полей. Удалите лишние поля {0}. @@ -1032,6 +1027,16 @@ Недопустимое объявление типа анонимной записи. + + This anonymous record is missing fields '{0}'. + This anonymous record is missing fields '{0}'. + + + + This anonymous record is missing field '{0}'. + This anonymous record is missing field '{0}'. + + The field '{0}' appears multiple times in this anonymous record type. Поле "{0}" появляется несколько раз в этом типе анонимной записи. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index cb2b3852ec..e579717bd1 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -1017,14 +1017,9 @@ Bu anonim kayıt yanlış. Kayıt, {0} alanlarını içermelidir. - - This anonymous record does not have enough fields. Add the missing fields {0}. - Bu anonim kayıtta yeterli sayıda alan yok. Eksik {0} alanlarını ekleyin. - - This anonymous record has too many fields. Remove the extra fields {0}. - Bu anonim kayıtta çok fazla alan var. Ek {0} alanlarını kaldırın. + Bu anonim kayıtta çok fazla alan var. Ek {0} alanlarını kaldırın. @@ -1032,6 +1027,16 @@ Anonim Kayıt türü bildirimi geçersiz. + + This anonymous record is missing fields '{0}'. + This anonymous record is missing fields '{0}'. + + + + This anonymous record is missing field '{0}'. + This anonymous record is missing field '{0}'. + + The field '{0}' appears multiple times in this anonymous record type. '{0}' alanı bu anonim kayıt türünde birden fazla yerde görünüyor. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 25ece528ce..9c40f47609 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -1017,14 +1017,9 @@ 此匿名记录不正确。它应具有字段 {0}。 - - This anonymous record does not have enough fields. Add the missing fields {0}. - 此匿名记录没有足够的字段。请添加缺少的字段 {0}。 - - This anonymous record has too many fields. Remove the extra fields {0}. - 此匿名记录的字段太多。请删除额外的字段 {0}。 + 此匿名记录的字段太多。请删除额外的字段 {0}。 @@ -1032,6 +1027,16 @@ 匿名记录类型声明无效。 + + This anonymous record is missing fields '{0}'. + This anonymous record is missing fields '{0}'. + + + + This anonymous record is missing field '{0}'. + This anonymous record is missing field '{0}'. + + The field '{0}' appears multiple times in this anonymous record type. 字段“{0}”在此匿名记录类型中多次出现。 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index d4a7d9adcf..99294c90c0 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -1017,14 +1017,9 @@ 此為錯誤的匿名記錄。其應有欄位 {0}。 - - This anonymous record does not have enough fields. Add the missing fields {0}. - 此匿名記錄沒有足夠的欄位。請新增缺少的欄位 {0}。 - - This anonymous record has too many fields. Remove the extra fields {0}. - 此匿名記錄有太多欄位。請移除額外的欄位 {0}。 + 此匿名記錄有太多欄位。請移除額外的欄位 {0}。 @@ -1032,6 +1027,16 @@ 匿名記錄型別宣告無效。 + + This anonymous record is missing fields '{0}'. + This anonymous record is missing fields '{0}'. + + + + This anonymous record is missing field '{0}'. + This anonymous record is missing field '{0}'. + + The field '{0}' appears multiple times in this anonymous record type. 欄位 '{0}' 在這個匿名記錄類型中出現多次。 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/AnonymousRecords.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/AnonymousRecords.fs index 438311c83f..9879640728 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/AnonymousRecords.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/AnonymousRecords.fs @@ -21,16 +21,27 @@ module AnonRecd = |> withMessage "The field 'A' appears multiple times in this record expression." [] - let ``Anonymous Records incomplete`` () = + let ``Anonymous Record missing single field`` () = Fsx """ let x () : {| A: int; B: string |} = {| A = 123 |} """ |> compile |> shouldFail |> withDiagnostics [ - (Error 1, Line 2, Col 40, Line 2, Col 53, "This anonymous record does not have enough fields. Add the missing fields [B].") + (Error 1, Line 2, Col 40, Line 2, Col 53, "This anonymous record is missing field 'B'.") ] + [] + let ``Anonymous Record missing multiple fields`` () = + Fsx """ +let x () : {| A: int; B: string; C: int |} = {| A = 123 |} +""" + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 1, Line 2, Col 48, Line 2, Col 61, "This anonymous record is missing fields 'B, C'.") + ] + [] let ``Anonymous Records with duplicate labels - Copy and update expression`` () = FSharp """ diff --git a/tests/fsharp/typecheck/sigs/neg113.bsl b/tests/fsharp/typecheck/sigs/neg113.bsl index b779344fda..c61b8907b4 100644 --- a/tests/fsharp/typecheck/sigs/neg113.bsl +++ b/tests/fsharp/typecheck/sigs/neg113.bsl @@ -1,5 +1,5 @@ -neg113.fs(5,50,5,61): typecheck error FS0001: This anonymous record does not have enough fields. Add the missing fields [b]. +neg113.fs(5,50,5,61): typecheck error FS0001: This anonymous record is missing field 'b'. neg113.fs(7,41,7,52): typecheck error FS0001: This is the wrong anonymous record. It should have the fields [b]. diff --git a/tests/fsharp/typecheck/sigs/neg113.vsbsl b/tests/fsharp/typecheck/sigs/neg113.vsbsl index b779344fda..c61b8907b4 100644 --- a/tests/fsharp/typecheck/sigs/neg113.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg113.vsbsl @@ -1,5 +1,5 @@ -neg113.fs(5,50,5,61): typecheck error FS0001: This anonymous record does not have enough fields. Add the missing fields [b]. +neg113.fs(5,50,5,61): typecheck error FS0001: This anonymous record is missing field 'b'. neg113.fs(7,41,7,52): typecheck error FS0001: This is the wrong anonymous record. It should have the fields [b]. diff --git a/tests/fsharp/typecheck/sigs/neg_anon_1.bsl b/tests/fsharp/typecheck/sigs/neg_anon_1.bsl index 018f51e3a3..5f4522e7c1 100644 --- a/tests/fsharp/typecheck/sigs/neg_anon_1.bsl +++ b/tests/fsharp/typecheck/sigs/neg_anon_1.bsl @@ -1,5 +1,5 @@ -neg_anon_1.fs(5,50,5,61): typecheck error FS0001: This anonymous record does not have enough fields. Add the missing fields [b]. +neg_anon_1.fs(5,50,5,61): typecheck error FS0001: This anonymous record is missing field 'b'. neg_anon_1.fs(7,41,7,52): typecheck error FS0001: This is the wrong anonymous record. It should have the fields [b].