From 015312ecb26aa92337a5f9b7f8cac039f5f75364 Mon Sep 17 00:00:00 2001 From: Isaac Abraham Date: Sat, 4 Jan 2020 21:02:07 +0100 Subject: [PATCH 1/6] Initial attempt at better anonymous record reporting. --- src/fsharp/ConstraintSolver.fs | 22 +++++++++++++++++++--- src/fsharp/FSComp.txt | 5 ++++- src/fsharp/xlf/FSComp.txt.cs.xlf | 19 +++++++++++++++++-- src/fsharp/xlf/FSComp.txt.de.xlf | 19 +++++++++++++++++-- src/fsharp/xlf/FSComp.txt.es.xlf | 21 ++++++++++++++++++--- src/fsharp/xlf/FSComp.txt.fr.xlf | 19 +++++++++++++++++-- src/fsharp/xlf/FSComp.txt.it.xlf | 19 +++++++++++++++++-- src/fsharp/xlf/FSComp.txt.ja.xlf | 19 +++++++++++++++++-- src/fsharp/xlf/FSComp.txt.ko.xlf | 19 +++++++++++++++++-- src/fsharp/xlf/FSComp.txt.pl.xlf | 19 +++++++++++++++++-- src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 19 +++++++++++++++++-- src/fsharp/xlf/FSComp.txt.ru.xlf | 19 +++++++++++++++++-- src/fsharp/xlf/FSComp.txt.tr.xlf | 19 +++++++++++++++++-- src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 19 +++++++++++++++++-- src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 19 +++++++++++++++++-- 15 files changed, 245 insertions(+), 31 deletions(-) diff --git a/src/fsharp/ConstraintSolver.fs b/src/fsharp/ConstraintSolver.fs index f5aade84008..25317a4418a 100644 --- a/src/fsharp/ConstraintSolver.fs +++ b/src/fsharp/ConstraintSolver.fs @@ -835,10 +835,26 @@ and SolveAnonInfoEqualsAnonInfo (csenv: ConstraintSolverEnv) m2 (anonInfo1: Anon (match anonInfo1.Assembly, anonInfo2.Assembly with | ccu1, ccu2 -> if not (ccuEq ccu1 ccu2) then ErrorD (ConstraintSolverError(FSComp.SR.tcAnonRecdCcuMismatch(ccu1.AssemblyName, ccu2.AssemblyName), csenv.m,m2)) else ResultD () ) ++ (fun () -> + if not (anonInfo1.SortedNames = anonInfo2.SortedNames) then - let namesText1 = sprintf "%A" (Array.toList anonInfo1.SortedNames) - let namesText2 = sprintf "%A" (Array.toList anonInfo2.SortedNames) - ErrorD (ConstraintSolverError(FSComp.SR.tcAnonRecdFieldNameMismatch(namesText1, namesText2), csenv.m,m2)) + let (|Subset|Superset|Overlap|CompletelyDifferent|) (first, second) = + let first = Set first + let second = Set second + let secondOnly = (second - first) |> Set.toList + let firstOnly = (first - second) |> Set.toList + if second.IsSubsetOf first then Subset firstOnly + elif second.IsSupersetOf first then Superset secondOnly + elif Set.intersect first second <> Set.empty then Overlap(firstOnly, secondOnly) + else CompletelyDifferent(Seq.toList first) + + let message = + match anonInfo1.SortedNames, anonInfo2.SortedNames with + | Subset missingFields -> FSComp.SR.tcAnonRecdFieldNameSubset(sprintf "%A" missingFields) + | Superset extraFields -> FSComp.SR.tcAnonRecdFieldNameSuperset(sprintf "%A" extraFields) + | Overlap(missingFields, extraFields) -> FSComp.SR.tcAnonRecdFieldNameMismatch(sprintf "%A" missingFields, sprintf "%A" extraFields) + | CompletelyDifferent(missingFields) -> FSComp.SR.tcAnonRecdFieldNameDifferent(sprintf "%A" missingFields) + + ErrorD (ConstraintSolverError(message, csenv.m,m2)) else ResultD ()) diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index c1ab22ab6ab..730e5a8ff43 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1352,7 +1352,10 @@ tcGlobalsSystemTypeNotFound,"The system type '%s' was required but no referenced 3214,methodIsNotStatic,"Method or object constructor '%s' is not static" 3215,parsUnexpectedSymbolEqualsInsteadOfIn,"Unexpected symbol '=' in expression. Did you intend to use 'for x in y .. z do' instead?" tcAnonRecdCcuMismatch,"Two anonymous record types are from different assemblies '%s' and '%s'" -tcAnonRecdFieldNameMismatch,"Two anonymous record types have mismatched sets of field names '%s' and '%s'" +tcAnonRecdFieldNameMismatch,"This anonymous record has the following missing fields '%s' and the following unexpected extra fields '%s'." +tcAnonRecdFieldNameSubset,"This anonymous record is missing the following fields: '%s'. Please add them." +tcAnonRecdFieldNameSuperset,"This anonymous record has the following unexpected extra fields '%s'. Please remove them." +tcAnonRecdFieldNameDifferent,"This is the wrong anonymous record. The expected record has the following 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." keyworkDescriptionAnd,"Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters." keywordDescriptionAs,"Used to give the current class object an object name. Also used to give a name to a whole pattern within a pattern match." diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 990037e09db..63b4860e542 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -47,6 +47,21 @@ Algoritmus {0} není podporovaný. + + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + + + + This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record is missing the following fields: '{0}'. Please add them. + + + + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + + Attributes cannot be applied to type extensions. Atributy nejde použít pro rozšíření typů. @@ -7128,8 +7143,8 @@ - Two anonymous record types have mismatched sets of field names '{0}' and '{1}' - Dva typy anonymních záznamů mají odlišné sady názvů polí: {0} a {1} + This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + Dva typy anonymních záznamů mají odlišné sady názvů polí: {0} a {1} diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index a0263a53bd8..ffc79a894fa 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -47,6 +47,21 @@ Algorithmus "{0}" wird nicht unterstützt + + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + + + + This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record is missing the following fields: '{0}'. Please add them. + + + + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + + Attributes cannot be applied to type extensions. Attribute können nicht auf Typerweiterungen angewendet werden. @@ -7128,8 +7143,8 @@ - Two anonymous record types have mismatched sets of field names '{0}' and '{1}' - Zwei anonyme Datensatztypen weisen die nicht übereinstimmenden Feldnamen "{0}" und "{1}" auf. + This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + Zwei anonyme Datensatztypen weisen die nicht übereinstimmenden Feldnamen "{0}" und "{1}" auf. diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index ba91cf6400f..f8a2ee398c6 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -47,6 +47,21 @@ No se admite el algoritmo '{0}' + + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + + + + This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record is missing the following fields: '{0}'. Please add them. + + + + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + + Attributes cannot be applied to type extensions. Los atributos no se pueden aplicar a las extensiones de tipo. @@ -159,7 +174,7 @@ All branches of a pattern match expression must return values of the same type as the first branch, which here is '{0}'. This branch returns a value of type '{1}'. - Todas las ramas de una expresión de coincidencia de patrón deben devolver valores del mismo tipo. La primera rama devolvió un valor de tipo "{0}", pero esta rama devolvió un valor de tipo "\{1 \}". + All branches of a pattern match expression must return values of the same type as the first branch, which here is '{0}'. This branch returns a value of type '{1}'. @@ -7128,8 +7143,8 @@ - Two anonymous record types have mismatched sets of field names '{0}' and '{1}' - Dos tipos de registros anónimos tienen conjuntos de nombres de campo que no coinciden "{0}" y "{1}" + This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + Dos tipos de registros anónimos tienen conjuntos de nombres de campo que no coinciden "{0}" y "{1}" diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index d2751124dbd..2866302d6ae 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -47,6 +47,21 @@ Algorithme '{0}' non pris en charge + + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + + + + This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record is missing the following fields: '{0}'. Please add them. + + + + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + + Attributes cannot be applied to type extensions. Impossible d'appliquer des attributs aux extensions de type. @@ -7128,8 +7143,8 @@ - Two anonymous record types have mismatched sets of field names '{0}' and '{1}' - Deux types d'enregistrement anonyme ont des ensembles de noms de champ incompatibles '{0}' et '{1}' + This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + Deux types d'enregistrement anonyme ont des ensembles de noms de champ incompatibles '{0}' et '{1}' diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index 3dc48e6248b..ba7bf80505d 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -47,6 +47,21 @@ L'algoritmo '{0}' non è supportato + + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + + + + This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record is missing the following fields: '{0}'. Please add them. + + + + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + + Attributes cannot be applied to type extensions. Gli attributi non possono essere applicati a estensioni di tipo. @@ -7128,8 +7143,8 @@ - Two anonymous record types have mismatched sets of field names '{0}' and '{1}' - Due tipi di record anonimo contengono set di nomi di campo '{0}' e '{1}' non corrispondenti + This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + Due tipi di record anonimo contengono set di nomi di campo '{0}' e '{1}' non corrispondenti diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index 46fc22b3885..143e188f2a2 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -47,6 +47,21 @@ アルゴリズム '{0}' はサポートされていません + + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + + + + This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record is missing the following fields: '{0}'. Please add them. + + + + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + + Attributes cannot be applied to type extensions. 属性を型拡張に適用することはできません。 @@ -7128,8 +7143,8 @@ - Two anonymous record types have mismatched sets of field names '{0}' and '{1}' - 2 種類の匿名レコードのフィールド名 '{0}' と '{1}' が一致しません + This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + 2 種類の匿名レコードのフィールド名 '{0}' と '{1}' が一致しません diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index 0807084300b..e9787924435 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -47,6 +47,21 @@ {0}' 알고리즘은 지원되지 않습니다. + + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + + + + This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record is missing the following fields: '{0}'. Please add them. + + + + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + + Attributes cannot be applied to type extensions. 형식 확장에 특성을 적용할 수 없습니다. @@ -7128,8 +7143,8 @@ - Two anonymous record types have mismatched sets of field names '{0}' and '{1}' - 두 무명 레코드 형식의 필드 이름 '{0}' 및 '{1}' 집합이 일치하지 않습니다. + This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + 두 무명 레코드 형식의 필드 이름 '{0}' 및 '{1}' 집합이 일치하지 않습니다. diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index e9d92110cbd..dbf533b746c 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -47,6 +47,21 @@ Algorytm „{0}” nie jest obsługiwany + + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + + + + This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record is missing the following fields: '{0}'. Please add them. + + + + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + + Attributes cannot be applied to type extensions. Atrybutów nie można stosować do rozszerzeń typu. @@ -7128,8 +7143,8 @@ - Two anonymous record types have mismatched sets of field names '{0}' and '{1}' - Dwa typy rekordów anonimowych mają niezgodne zestawy nazw pól „{0}” i „{1}” + This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + Dwa typy rekordów anonimowych mają niezgodne zestawy nazw pól „{0}” i „{1}” diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index 7d15750bf3b..a3bdaf0cb35 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -47,6 +47,21 @@ Algoritmo '{0}' sem suporte + + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + + + + This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record is missing the following fields: '{0}'. Please add them. + + + + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + + Attributes cannot be applied to type extensions. Os atributos não podem ser aplicados às extensões de tipo. @@ -7128,8 +7143,8 @@ - Two anonymous record types have mismatched sets of field names '{0}' and '{1}' - Dois tipos de registro anônimos têm conjuntos incompatíveis de nomes de campos '{0}' e '{1}' + This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + Dois tipos de registro anônimos têm conjuntos incompatíveis de nomes de campos '{0}' e '{1}' diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index 9d342925266..3e21921b08e 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -47,6 +47,21 @@ Алгоритм "{0}" не поддерживается + + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + + + + This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record is missing the following fields: '{0}'. Please add them. + + + + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + + Attributes cannot be applied to type extensions. Атрибуты не могут быть применены к расширениям типа. @@ -7128,8 +7143,8 @@ - Two anonymous record types have mismatched sets of field names '{0}' and '{1}' - Два анонимных типа записей содержат несоответствующие наборы имен полей '{0}' и '{1}' + This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + Два анонимных типа записей содержат несоответствующие наборы имен полей '{0}' и '{1}' diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index 18b7d759b27..987b70151a3 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -47,6 +47,21 @@ {0}' algoritması desteklenmiyor + + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + + + + This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record is missing the following fields: '{0}'. Please add them. + + + + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + + Attributes cannot be applied to type extensions. Öznitelikler tür uzantılarına uygulanamaz. @@ -7128,8 +7143,8 @@ - Two anonymous record types have mismatched sets of field names '{0}' and '{1}' - İki anonim kayıt türünün eşleşmeyen '{0}' ve '{1}' alan adı kümeleri var + This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + İki anonim kayıt türünün eşleşmeyen '{0}' ve '{1}' alan adı kümeleri var diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index d3e0ab4f8ed..ccea26ce36c 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -47,6 +47,21 @@ 不支持算法“{0}” + + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + + + + This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record is missing the following fields: '{0}'. Please add them. + + + + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + + Attributes cannot be applied to type extensions. 属性不可应用于类型扩展。 @@ -7128,8 +7143,8 @@ - Two anonymous record types have mismatched sets of field names '{0}' and '{1}' - 两个匿名记录类型具有一组不匹配的字段名称“{0}”和“{1}” + This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + 两个匿名记录类型具有一组不匹配的字段名称“{0}”和“{1}” diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index 41be9e5f870..21a8a6444b7 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -47,6 +47,21 @@ 不支援演算法 '{0}' + + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. The expected record has the following fields: '{0}'. + + + + This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record is missing the following fields: '{0}'. Please add them. + + + + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + + Attributes cannot be applied to type extensions. 屬性無法套用到類型延伸模組。 @@ -7128,8 +7143,8 @@ - Two anonymous record types have mismatched sets of field names '{0}' and '{1}' - 兩個匿名的記錄類型有兩組不相符的欄位名稱 '{0}' 和 '{1}' + This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + 兩個匿名的記錄類型有兩組不相符的欄位名稱 '{0}' 和 '{1}' From 5c5d9b7297c7eead54d25db0ce541bd940819184 Mon Sep 17 00:00:00 2001 From: Isaac Abraham Date: Sun, 5 Jan 2020 14:56:28 +0100 Subject: [PATCH 2/6] Update error texts and fix tests. --- src/fsharp/ConstraintSolver.fs | 13 +++++++------ src/fsharp/FSComp.txt | 8 ++++---- src/fsharp/xlf/FSComp.txt.cs.xlf | 14 +++++++------- src/fsharp/xlf/FSComp.txt.de.xlf | 14 +++++++------- src/fsharp/xlf/FSComp.txt.es.xlf | 14 +++++++------- src/fsharp/xlf/FSComp.txt.fr.xlf | 14 +++++++------- src/fsharp/xlf/FSComp.txt.it.xlf | 14 +++++++------- src/fsharp/xlf/FSComp.txt.ja.xlf | 14 +++++++------- src/fsharp/xlf/FSComp.txt.ko.xlf | 14 +++++++------- src/fsharp/xlf/FSComp.txt.pl.xlf | 14 +++++++------- src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 14 +++++++------- src/fsharp/xlf/FSComp.txt.ru.xlf | 14 +++++++------- src/fsharp/xlf/FSComp.txt.tr.xlf | 14 +++++++------- src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 14 +++++++------- src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 14 +++++++------- tests/fsharp/typecheck/sigs/neg_anon_1.bsl | 4 ++-- 16 files changed, 104 insertions(+), 103 deletions(-) diff --git a/src/fsharp/ConstraintSolver.fs b/src/fsharp/ConstraintSolver.fs index 25317a4418a..3df8061a4be 100644 --- a/src/fsharp/ConstraintSolver.fs +++ b/src/fsharp/ConstraintSolver.fs @@ -840,8 +840,9 @@ and SolveAnonInfoEqualsAnonInfo (csenv: ConstraintSolverEnv) m2 (anonInfo1: Anon let (|Subset|Superset|Overlap|CompletelyDifferent|) (first, second) = let first = Set first let second = Set second - let secondOnly = (second - first) |> Set.toList - let firstOnly = (first - second) |> Set.toList + let secondOnly = Set.toList (second - first) + let firstOnly = Set.toList (first - second) + if second.IsSubsetOf first then Subset firstOnly elif second.IsSupersetOf first then Superset secondOnly elif Set.intersect first second <> Set.empty then Overlap(firstOnly, secondOnly) @@ -849,10 +850,10 @@ and SolveAnonInfoEqualsAnonInfo (csenv: ConstraintSolverEnv) m2 (anonInfo1: Anon let message = match anonInfo1.SortedNames, anonInfo2.SortedNames with - | Subset missingFields -> FSComp.SR.tcAnonRecdFieldNameSubset(sprintf "%A" missingFields) - | Superset extraFields -> FSComp.SR.tcAnonRecdFieldNameSuperset(sprintf "%A" extraFields) - | Overlap(missingFields, extraFields) -> FSComp.SR.tcAnonRecdFieldNameMismatch(sprintf "%A" missingFields, sprintf "%A" extraFields) - | CompletelyDifferent(missingFields) -> FSComp.SR.tcAnonRecdFieldNameDifferent(sprintf "%A" missingFields) + | Subset missingFields -> FSComp.SR.tcAnonRecdFieldNameSubset(string missingFields) + | Superset extraFields -> FSComp.SR.tcAnonRecdFieldNameSuperset(string extraFields) + | Overlap (missingFields, extraFields) -> FSComp.SR.tcAnonRecdFieldNameMismatch(string missingFields, string extraFields) + | CompletelyDifferent missingFields -> FSComp.SR.tcAnonRecdFieldNameDifferent(string missingFields) ErrorD (ConstraintSolverError(message, csenv.m,m2)) else diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 730e5a8ff43..0bda612a162 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1352,10 +1352,10 @@ tcGlobalsSystemTypeNotFound,"The system type '%s' was required but no referenced 3214,methodIsNotStatic,"Method or object constructor '%s' is not static" 3215,parsUnexpectedSymbolEqualsInsteadOfIn,"Unexpected symbol '=' in expression. Did you intend to use 'for x in y .. z do' instead?" tcAnonRecdCcuMismatch,"Two anonymous record types are from different assemblies '%s' and '%s'" -tcAnonRecdFieldNameMismatch,"This anonymous record has the following missing fields '%s' and the following unexpected extra fields '%s'." -tcAnonRecdFieldNameSubset,"This anonymous record is missing the following fields: '%s'. Please add them." -tcAnonRecdFieldNameSuperset,"This anonymous record has the following unexpected extra fields '%s'. Please remove them." -tcAnonRecdFieldNameDifferent,"This is the wrong anonymous record. The expected record has the following fields: '%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." +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." keyworkDescriptionAnd,"Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters." keywordDescriptionAs,"Used to give the current class object an object name. Also used to give a name to a whole pattern within a pattern match." diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 63b4860e542..93d6fdbcdd7 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -48,18 +48,18 @@ - This is the wrong anonymous record. The expected record has the following fields: '{0}'. - This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. It should have the fields {0}. + This is the wrong anonymous record. It should have the fields {0}. - This anonymous record is missing the following fields: '{0}'. Please add them. - This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record does not have enough fields. Add the missing fields {0}. + This anonymous record does not have enough fields. Add the missing fields {0}. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has too many fields. Remove the extra fields {0}. + This anonymous record has too many fields. Remove the extra fields {0}. @@ -7143,7 +7143,7 @@ - This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + This anonymous record does not exactly match the expected shape. Add the missing fields {0} and remove the extra fields {1}. Dva typy anonymních záznamů mají odlišné sady názvů polí: {0} a {1} diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index ffc79a894fa..3f6d6ed9d8e 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -48,18 +48,18 @@ - This is the wrong anonymous record. The expected record has the following fields: '{0}'. - This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. It should have the fields {0}. + This is the wrong anonymous record. It should have the fields {0}. - This anonymous record is missing the following fields: '{0}'. Please add them. - This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record does not have enough fields. Add the missing fields {0}. + This anonymous record does not have enough fields. Add the missing fields {0}. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has too many fields. Remove the extra fields {0}. + This anonymous record has too many fields. Remove the extra fields {0}. @@ -7143,7 +7143,7 @@ - This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + This anonymous record does not exactly match the expected shape. Add the missing fields {0} and remove the extra fields {1}. Zwei anonyme Datensatztypen weisen die nicht übereinstimmenden Feldnamen "{0}" und "{1}" auf. diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index f8a2ee398c6..b9f3b2eca0c 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -48,18 +48,18 @@ - This is the wrong anonymous record. The expected record has the following fields: '{0}'. - This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. It should have the fields {0}. + This is the wrong anonymous record. It should have the fields {0}. - This anonymous record is missing the following fields: '{0}'. Please add them. - This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record does not have enough fields. Add the missing fields {0}. + This anonymous record does not have enough fields. Add the missing fields {0}. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has too many fields. Remove the extra fields {0}. + This anonymous record has too many fields. Remove the extra fields {0}. @@ -7143,7 +7143,7 @@ - This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + This anonymous record does not exactly match the expected shape. Add the missing fields {0} and remove the extra fields {1}. Dos tipos de registros anónimos tienen conjuntos de nombres de campo que no coinciden "{0}" y "{1}" diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index 2866302d6ae..110db5e63f0 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -48,18 +48,18 @@ - This is the wrong anonymous record. The expected record has the following fields: '{0}'. - This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. It should have the fields {0}. + This is the wrong anonymous record. It should have the fields {0}. - This anonymous record is missing the following fields: '{0}'. Please add them. - This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record does not have enough fields. Add the missing fields {0}. + This anonymous record does not have enough fields. Add the missing fields {0}. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has too many fields. Remove the extra fields {0}. + This anonymous record has too many fields. Remove the extra fields {0}. @@ -7143,7 +7143,7 @@ - This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + This anonymous record does not exactly match the expected shape. Add the missing fields {0} and remove the extra fields {1}. Deux types d'enregistrement anonyme ont des ensembles de noms de champ incompatibles '{0}' et '{1}' diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index ba7bf80505d..7e3e657641f 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -48,18 +48,18 @@ - This is the wrong anonymous record. The expected record has the following fields: '{0}'. - This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. It should have the fields {0}. + This is the wrong anonymous record. It should have the fields {0}. - This anonymous record is missing the following fields: '{0}'. Please add them. - This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record does not have enough fields. Add the missing fields {0}. + This anonymous record does not have enough fields. Add the missing fields {0}. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has too many fields. Remove the extra fields {0}. + This anonymous record has too many fields. Remove the extra fields {0}. @@ -7143,7 +7143,7 @@ - This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + This anonymous record does not exactly match the expected shape. Add the missing fields {0} and remove the extra fields {1}. Due tipi di record anonimo contengono set di nomi di campo '{0}' e '{1}' non corrispondenti diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index 143e188f2a2..91bf01e11ab 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -48,18 +48,18 @@ - This is the wrong anonymous record. The expected record has the following fields: '{0}'. - This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. It should have the fields {0}. + This is the wrong anonymous record. It should have the fields {0}. - This anonymous record is missing the following fields: '{0}'. Please add them. - This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record does not have enough fields. Add the missing fields {0}. + This anonymous record does not have enough fields. Add the missing fields {0}. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has too many fields. Remove the extra fields {0}. + This anonymous record has too many fields. Remove the extra fields {0}. @@ -7143,7 +7143,7 @@ - This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + This anonymous record does not exactly match the expected shape. Add the missing fields {0} and remove the extra fields {1}. 2 種類の匿名レコードのフィールド名 '{0}' と '{1}' が一致しません diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index e9787924435..45b89be4326 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -48,18 +48,18 @@ - This is the wrong anonymous record. The expected record has the following fields: '{0}'. - This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. It should have the fields {0}. + This is the wrong anonymous record. It should have the fields {0}. - This anonymous record is missing the following fields: '{0}'. Please add them. - This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record does not have enough fields. Add the missing fields {0}. + This anonymous record does not have enough fields. Add the missing fields {0}. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has too many fields. Remove the extra fields {0}. + This anonymous record has too many fields. Remove the extra fields {0}. @@ -7143,7 +7143,7 @@ - This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + This anonymous record does not exactly match the expected shape. Add the missing fields {0} and remove the extra fields {1}. 두 무명 레코드 형식의 필드 이름 '{0}' 및 '{1}' 집합이 일치하지 않습니다. diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index dbf533b746c..e59f8848fac 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -48,18 +48,18 @@ - This is the wrong anonymous record. The expected record has the following fields: '{0}'. - This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. It should have the fields {0}. + This is the wrong anonymous record. It should have the fields {0}. - This anonymous record is missing the following fields: '{0}'. Please add them. - This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record does not have enough fields. Add the missing fields {0}. + This anonymous record does not have enough fields. Add the missing fields {0}. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has too many fields. Remove the extra fields {0}. + This anonymous record has too many fields. Remove the extra fields {0}. @@ -7143,7 +7143,7 @@ - This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + This anonymous record does not exactly match the expected shape. Add the missing fields {0} and remove the extra fields {1}. Dwa typy rekordów anonimowych mają niezgodne zestawy nazw pól „{0}” i „{1}” diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index a3bdaf0cb35..902b2363080 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -48,18 +48,18 @@ - This is the wrong anonymous record. The expected record has the following fields: '{0}'. - This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. It should have the fields {0}. + This is the wrong anonymous record. It should have the fields {0}. - This anonymous record is missing the following fields: '{0}'. Please add them. - This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record does not have enough fields. Add the missing fields {0}. + This anonymous record does not have enough fields. Add the missing fields {0}. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has too many fields. Remove the extra fields {0}. + This anonymous record has too many fields. Remove the extra fields {0}. @@ -7143,7 +7143,7 @@ - This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + This anonymous record does not exactly match the expected shape. Add the missing fields {0} and remove the extra fields {1}. Dois tipos de registro anônimos têm conjuntos incompatíveis de nomes de campos '{0}' e '{1}' diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index 3e21921b08e..52dba96f84d 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -48,18 +48,18 @@ - This is the wrong anonymous record. The expected record has the following fields: '{0}'. - This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. It should have the fields {0}. + This is the wrong anonymous record. It should have the fields {0}. - This anonymous record is missing the following fields: '{0}'. Please add them. - This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record does not have enough fields. Add the missing fields {0}. + This anonymous record does not have enough fields. Add the missing fields {0}. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has too many fields. Remove the extra fields {0}. + This anonymous record has too many fields. Remove the extra fields {0}. @@ -7143,7 +7143,7 @@ - This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + This anonymous record does not exactly match the expected shape. Add the missing fields {0} and remove the extra fields {1}. Два анонимных типа записей содержат несоответствующие наборы имен полей '{0}' и '{1}' diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index 987b70151a3..b72a64d5a91 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -48,18 +48,18 @@ - This is the wrong anonymous record. The expected record has the following fields: '{0}'. - This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. It should have the fields {0}. + This is the wrong anonymous record. It should have the fields {0}. - This anonymous record is missing the following fields: '{0}'. Please add them. - This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record does not have enough fields. Add the missing fields {0}. + This anonymous record does not have enough fields. Add the missing fields {0}. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has too many fields. Remove the extra fields {0}. + This anonymous record has too many fields. Remove the extra fields {0}. @@ -7143,7 +7143,7 @@ - This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + This anonymous record does not exactly match the expected shape. Add the missing fields {0} and remove the extra fields {1}. İki anonim kayıt türünün eşleşmeyen '{0}' ve '{1}' alan adı kümeleri var diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index ccea26ce36c..45a2abaed4f 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -48,18 +48,18 @@ - This is the wrong anonymous record. The expected record has the following fields: '{0}'. - This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. It should have the fields {0}. + This is the wrong anonymous record. It should have the fields {0}. - This anonymous record is missing the following fields: '{0}'. Please add them. - This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record does not have enough fields. Add the missing fields {0}. + This anonymous record does not have enough fields. Add the missing fields {0}. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has too many fields. Remove the extra fields {0}. + This anonymous record has too many fields. Remove the extra fields {0}. @@ -7143,7 +7143,7 @@ - This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + This anonymous record does not exactly match the expected shape. Add the missing fields {0} and remove the extra fields {1}. 两个匿名记录类型具有一组不匹配的字段名称“{0}”和“{1}” diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index 21a8a6444b7..51b821b96f0 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -48,18 +48,18 @@ - This is the wrong anonymous record. The expected record has the following fields: '{0}'. - This is the wrong anonymous record. The expected record has the following fields: '{0}'. + This is the wrong anonymous record. It should have the fields {0}. + This is the wrong anonymous record. It should have the fields {0}. - This anonymous record is missing the following fields: '{0}'. Please add them. - This anonymous record is missing the following fields: '{0}'. Please add them. + This anonymous record does not have enough fields. Add the missing fields {0}. + This anonymous record does not have enough fields. Add the missing fields {0}. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. - This anonymous record has the following unexpected extra fields '{0}'. Please remove them. + This anonymous record has too many fields. Remove the extra fields {0}. + This anonymous record has too many fields. Remove the extra fields {0}. @@ -7143,7 +7143,7 @@ - This anonymous record has the following missing fields '{0}' and the following unexpected extra fields '{1}'. + This anonymous record does not exactly match the expected shape. Add the missing fields {0} and remove the extra fields {1}. 兩個匿名的記錄類型有兩組不相符的欄位名稱 '{0}' 和 '{1}' diff --git a/tests/fsharp/typecheck/sigs/neg_anon_1.bsl b/tests/fsharp/typecheck/sigs/neg_anon_1.bsl index 3e75d81144c..0f9d56559a3 100644 --- a/tests/fsharp/typecheck/sigs/neg_anon_1.bsl +++ b/tests/fsharp/typecheck/sigs/neg_anon_1.bsl @@ -1,7 +1,7 @@ -neg_anon_1.fs(5,50,5,61): typecheck error FS0001: Two anonymous record types have mismatched sets of field names '["a"; "b"]' and '["a"]' +neg_anon_1.fs(5,50,5,61): typecheck error FS0001: This anonymous record does not have enough fields. Add the missing fields [a]. -neg_anon_1.fs(7,41,7,52): typecheck error FS0001: Two anonymous record types have mismatched sets of field names '["b"]' and '["a"]' +neg_anon_1.fs(7,41,7,52): typecheck error FS0001: This is the wrong anonymous record. It should have the fields [b]. neg_anon_1.fs(10,27,10,55): typecheck error FS0059: The type '{| a: int |}' does not have any proper subtypes and need not be used as the target of a static coercion From b1c3839e2482905b17133c52d0b293db56d75c34 Mon Sep 17 00:00:00 2001 From: Isaac Abraham Date: Mon, 6 Jan 2020 08:36:26 +0100 Subject: [PATCH 3/6] Fix test, but for real this time. --- tests/fsharp/typecheck/sigs/neg_anon_1.bsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharp/typecheck/sigs/neg_anon_1.bsl b/tests/fsharp/typecheck/sigs/neg_anon_1.bsl index 0f9d56559a3..018f51e3a3c 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 [a]. +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(7,41,7,52): typecheck error FS0001: This is the wrong anonymous record. It should have the fields [b]. From 4615707bc55c796d47a4c674dca9ca78a732314f Mon Sep 17 00:00:00 2001 From: Isaac Abraham Date: Mon, 6 Jan 2020 09:55:09 +0100 Subject: [PATCH 4/6] Fix another random BSL file. --- tests/fsharp/typecheck/sigs/neg113.bsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/fsharp/typecheck/sigs/neg113.bsl b/tests/fsharp/typecheck/sigs/neg113.bsl index b9f0190c63b..b779344fda7 100644 --- a/tests/fsharp/typecheck/sigs/neg113.bsl +++ b/tests/fsharp/typecheck/sigs/neg113.bsl @@ -1,7 +1,7 @@ -neg113.fs(5,50,5,61): typecheck error FS0001: Two anonymous record types have mismatched sets of field names '["a"; "b"]' and '["a"]' +neg113.fs(5,50,5,61): typecheck error FS0001: This anonymous record does not have enough fields. Add the missing fields [b]. -neg113.fs(7,41,7,52): typecheck error FS0001: Two anonymous record types have mismatched sets of field names '["b"]' and '["a"]' +neg113.fs(7,41,7,52): typecheck error FS0001: This is the wrong anonymous record. It should have the fields [b]. neg113.fs(10,27,10,55): typecheck error FS0059: The type '{| a: int |}' does not have any proper subtypes and need not be used as the target of a static coercion From 01a2f11f3565544d17ff56bdf8a8574868585e5c Mon Sep 17 00:00:00 2001 From: Isaac Abraham Date: Mon, 6 Jan 2020 11:45:35 +0100 Subject: [PATCH 5/6] Next random file fix! --- tests/fsharp/typecheck/sigs/neg113.vsbsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/fsharp/typecheck/sigs/neg113.vsbsl b/tests/fsharp/typecheck/sigs/neg113.vsbsl index b9f0190c63b..b779344fda7 100644 --- a/tests/fsharp/typecheck/sigs/neg113.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg113.vsbsl @@ -1,7 +1,7 @@ -neg113.fs(5,50,5,61): typecheck error FS0001: Two anonymous record types have mismatched sets of field names '["a"; "b"]' and '["a"]' +neg113.fs(5,50,5,61): typecheck error FS0001: This anonymous record does not have enough fields. Add the missing fields [b]. -neg113.fs(7,41,7,52): typecheck error FS0001: Two anonymous record types have mismatched sets of field names '["b"]' and '["a"]' +neg113.fs(7,41,7,52): typecheck error FS0001: This is the wrong anonymous record. It should have the fields [b]. neg113.fs(10,27,10,55): typecheck error FS0059: The type '{| a: int |}' does not have any proper subtypes and need not be used as the target of a static coercion From f70c90629dca5b7236635068f95d89dde1b068cf Mon Sep 17 00:00:00 2001 From: Isaac Abraham Date: Tue, 7 Jan 2020 16:48:28 +0100 Subject: [PATCH 6/6] Line formatting. --- src/fsharp/ConstraintSolver.fs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/fsharp/ConstraintSolver.fs b/src/fsharp/ConstraintSolver.fs index 3df8061a4be..91fa74aa552 100644 --- a/src/fsharp/ConstraintSolver.fs +++ b/src/fsharp/ConstraintSolver.fs @@ -843,17 +843,25 @@ and SolveAnonInfoEqualsAnonInfo (csenv: ConstraintSolverEnv) m2 (anonInfo1: Anon let secondOnly = Set.toList (second - first) let firstOnly = Set.toList (first - second) - if second.IsSubsetOf first then Subset firstOnly - elif second.IsSupersetOf first then Superset secondOnly - elif Set.intersect first second <> Set.empty then Overlap(firstOnly, secondOnly) - else CompletelyDifferent(Seq.toList first) + if second.IsSubsetOf first then + Subset firstOnly + elif second.IsSupersetOf first then + Superset secondOnly + elif Set.intersect first second <> Set.empty then + Overlap(firstOnly, secondOnly) + else + CompletelyDifferent(Seq.toList first) let message = match anonInfo1.SortedNames, anonInfo2.SortedNames with - | Subset missingFields -> FSComp.SR.tcAnonRecdFieldNameSubset(string missingFields) - | Superset extraFields -> FSComp.SR.tcAnonRecdFieldNameSuperset(string extraFields) - | Overlap (missingFields, extraFields) -> FSComp.SR.tcAnonRecdFieldNameMismatch(string missingFields, string extraFields) - | CompletelyDifferent missingFields -> FSComp.SR.tcAnonRecdFieldNameDifferent(string missingFields) + | Subset missingFields -> + FSComp.SR.tcAnonRecdFieldNameSubset(string missingFields) + | Superset extraFields -> + FSComp.SR.tcAnonRecdFieldNameSuperset(string extraFields) + | Overlap (missingFields, extraFields) -> + FSComp.SR.tcAnonRecdFieldNameMismatch(string missingFields, string extraFields) + | CompletelyDifferent missingFields -> + FSComp.SR.tcAnonRecdFieldNameDifferent(string missingFields) ErrorD (ConstraintSolverError(message, csenv.m,m2)) else