From 2383ff0e393b7ff767b03a193435efe55de65db7 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Tue, 9 Oct 2018 09:19:26 +0200 Subject: [PATCH] Remove one "impossible" error - fixes #5745 --- src/fsharp/FSComp.txt | 5 ++++- src/fsharp/TypeChecker.fs | 31 ++++++++++++++++----------- src/fsharp/xlf/FSComp.txt.cs.xlf | 19 ++++++++++++++-- src/fsharp/xlf/FSComp.txt.de.xlf | 19 ++++++++++++++-- src/fsharp/xlf/FSComp.txt.en.xlf | 19 ++++++++++++++-- src/fsharp/xlf/FSComp.txt.es.xlf | 19 ++++++++++++++-- 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 ++++++++++++++-- 16 files changed, 260 insertions(+), 42 deletions(-) diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index b8b72353118..a3f5f82d0ea 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1293,7 +1293,10 @@ descriptionUnavailable,"(description unavailable...)" 3171,tcGeneratedTypesShouldBeInternalOrPrivate,"The provided types generated by this use of a type provider may not be used from other F# assemblies and should be marked internal or private. Consider using 'type internal TypeName = ...' or 'type private TypeName = ...'." 3172,chkGetterAndSetterHaveSamePropertyType,"A property's getter and setter must have the same type. Property '%s' has getter of type '%s' but setter of type '%s'." 3173,tcRuntimeSuppliedMethodCannotBeUsedInUserCode,"Array method '%s' is supplied by the runtime and cannot be directly used in code. For operations with array elements consider using family of GetArray/SetArray functions from LanguagePrimitives.IntrinsicFunctions module." -3174,tcUnionCaseConstructorDoesNotHaveFieldWithGivenName,"Union case/exception '%s' does not have field named '%s'." +3174,tcUnionCaseConstructorDoesNotHaveFieldWithGivenName,"The union case '%s' does not have a field named '%s'." +3174,tcExceptionConstructorDoesNotHaveFieldWithGivenName,"The exception '%s' does not have a field named '%s'." +3174,tcActivePatternsDoNotHaveFields,"Active patterns do not have fields. This syntax is invalid." +3174,tcConstructorDoesNotHaveFieldWithGivenName,"The constructor does not have a field named '%s'." 3175,tcUnionCaseFieldCannotBeUsedMoreThanOnce,"Union case/exception field '%s' cannot be used more than once." 3176,tcFieldNameIsUsedModeThanOnce,"Named field '%s' is used more than once." 3176,tcFieldNameConflictsWithGeneratedNameForAnonymousField,"Named field '%s' conflicts with autogenerated name for anonymous field." diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 7f5d834a519..c558602ffa9 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -5316,12 +5316,14 @@ and TcPat warnOnUpper cenv env topValInfo vFlags (tpenv, names, takenNames) ty p for (id, pat) in pairs do match argNames |> List.tryFindIndex (fun id2 -> id.idText = id2.idText) with | None -> - let caseName = - match item with - | Item.UnionCase(uci, _) -> uci.Name - | Item.ExnCase tcref -> tcref.DisplayName - | _ -> failwith "impossible" - error(Error(FSComp.SR.tcUnionCaseConstructorDoesNotHaveFieldWithGivenName(caseName, id.idText), id.idRange)) + match item with + | Item.UnionCase(uci, _) -> + error(Error(FSComp.SR.tcUnionCaseConstructorDoesNotHaveFieldWithGivenName(uci.Name, id.idText), id.idRange)) + | Item.ExnCase tcref -> + error(Error(FSComp.SR.tcExceptionConstructorDoesNotHaveFieldWithGivenName(tcref.DisplayName, id.idText), id.idRange)) + | _ -> + error(Error(FSComp.SR.tcConstructorDoesNotHaveFieldWithGivenName(id.idText), id.idRange)) + | Some idx -> match box result.[idx] with | null -> @@ -8644,13 +8646,16 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del assert (isNull(box fittedArgs.[currentIndex])) fittedArgs.[currentIndex] <- List.item currentIndex args // grab original argument, not item from the list of named parameters currentIndex <- currentIndex + 1 - else - let caseName = - match item with - | Item.UnionCase(uci, _) -> uci.Name - | Item.ExnCase tcref -> tcref.DisplayName - | _ -> failwith "impossible" - error(Error(FSComp.SR.tcUnionCaseConstructorDoesNotHaveFieldWithGivenName(caseName, id.idText), id.idRange)) + else + match item with + | Item.UnionCase(uci, _) -> + error(Error(FSComp.SR.tcUnionCaseConstructorDoesNotHaveFieldWithGivenName(uci.Name, id.idText), id.idRange)) + | Item.ExnCase tcref -> + error(Error(FSComp.SR.tcExceptionConstructorDoesNotHaveFieldWithGivenName(tcref.DisplayName, id.idText), id.idRange)) + | Item.ActivePatternResult(_,_,_,_) -> + error(Error(FSComp.SR.tcActivePatternsDoNotHaveFields(), id.idRange)) + | _ -> + error(Error(FSComp.SR.tcConstructorDoesNotHaveFieldWithGivenName(id.idText), id.idRange)) assert (Seq.forall (box >> ((<>) null) ) fittedArgs) List.ofArray fittedArgs diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 05d6ee76c54..1c840d2c66e 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -6328,8 +6328,8 @@ - Union case/exception '{0}' does not have field named '{1}'. - Výjimka nebo případ typu union {0} nemá pole s názvem {1}. + The union case '{0}' does not have a field named '{1}'. + Výjimka nebo případ typu union {0} nemá pole s názvem {1}. @@ -7067,6 +7067,21 @@ This type does not inherit Attribute, it will not work correctly with other .NET languages. + + The exception '{0}' does not have a field named '{1}'. + The exception '{0}' does not have a field named '{1}'. + + + + The constructor does not have a field named '{0}'. + The constructor does not have a field named '{0}'. + + + + Active patterns do not have fields. This syntax is invalid. + Active patterns do not have fields. This syntax is invalid. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index fdce970796c..cd09b539e4b 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -6328,8 +6328,8 @@ - Union case/exception '{0}' does not have field named '{1}'. - Union-Fall/Ausnahme '{0}' verfügt nicht über ein Feld mit dem Namen '{1}'. + The union case '{0}' does not have a field named '{1}'. + Union-Fall/Ausnahme '{0}' verfügt nicht über ein Feld mit dem Namen '{1}'. @@ -7067,6 +7067,21 @@ This type does not inherit Attribute, it will not work correctly with other .NET languages. + + The exception '{0}' does not have a field named '{1}'. + The exception '{0}' does not have a field named '{1}'. + + + + The constructor does not have a field named '{0}'. + The constructor does not have a field named '{0}'. + + + + Active patterns do not have fields. This syntax is invalid. + Active patterns do not have fields. This syntax is invalid. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.en.xlf b/src/fsharp/xlf/FSComp.txt.en.xlf index c56232af4bd..69e90b775be 100644 --- a/src/fsharp/xlf/FSComp.txt.en.xlf +++ b/src/fsharp/xlf/FSComp.txt.en.xlf @@ -6328,8 +6328,8 @@ - Union case/exception '{0}' does not have field named '{1}'. - Union case/exception '{0}' does not have field named '{1}'. + The union case '{0}' does not have a field named '{1}'. + The union case '{0}' does not have a field named '{1}'. @@ -7067,6 +7067,21 @@ This type does not inherit Attribute, it will not work correctly with other .NET languages. + + The exception '{0}' does not have a field named '{1}'. + The exception '{0}' does not have a field named '{1}'. + + + + The constructor does not have a field named '{0}'. + The constructor does not have a field named '{0}'. + + + + Active patterns do not have fields. This syntax is invalid. + Active patterns do not have fields. This syntax is invalid. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index c6a73702da9..cab140a050a 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -6328,8 +6328,8 @@ - Union case/exception '{0}' does not have field named '{1}'. - La excepción o el caso de unión '{0}' no tiene un campo denominado '{1}'. + The union case '{0}' does not have a field named '{1}'. + La excepción o el caso de unión '{0}' no tiene un campo denominado '{1}'. @@ -7067,6 +7067,21 @@ This type does not inherit Attribute, it will not work correctly with other .NET languages. + + The exception '{0}' does not have a field named '{1}'. + The exception '{0}' does not have a field named '{1}'. + + + + The constructor does not have a field named '{0}'. + The constructor does not have a field named '{0}'. + + + + Active patterns do not have fields. This syntax is invalid. + Active patterns do not have fields. This syntax is invalid. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index f78d170be49..0ef363d31e4 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -6328,8 +6328,8 @@ - Union case/exception '{0}' does not have field named '{1}'. - Le cas ou l'exception d'union '{0}' ne possède pas de champ nommé '{1}'. + The union case '{0}' does not have a field named '{1}'. + Le cas ou l'exception d'union '{0}' ne possède pas de champ nommé '{1}'. @@ -7067,6 +7067,21 @@ This type does not inherit Attribute, it will not work correctly with other .NET languages. + + The exception '{0}' does not have a field named '{1}'. + The exception '{0}' does not have a field named '{1}'. + + + + The constructor does not have a field named '{0}'. + The constructor does not have a field named '{0}'. + + + + Active patterns do not have fields. This syntax is invalid. + Active patterns do not have fields. This syntax is invalid. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index 5a499b9e702..5c224442175 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -6328,8 +6328,8 @@ - Union case/exception '{0}' does not have field named '{1}'. - Il case di unione/eccezione '{0}' non contiene il campo denominato '{1}'. + The union case '{0}' does not have a field named '{1}'. + Il case di unione/eccezione '{0}' non contiene il campo denominato '{1}'. @@ -7067,6 +7067,21 @@ This type does not inherit Attribute, it will not work correctly with other .NET languages. + + The exception '{0}' does not have a field named '{1}'. + The exception '{0}' does not have a field named '{1}'. + + + + The constructor does not have a field named '{0}'. + The constructor does not have a field named '{0}'. + + + + Active patterns do not have fields. This syntax is invalid. + Active patterns do not have fields. This syntax is invalid. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index 782c0613974..168cd7d6efb 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -6328,8 +6328,8 @@ - Union case/exception '{0}' does not have field named '{1}'. - 共用体ケース/例外 '{0}' には、'{1}' という名前のフィールドがありません。 + The union case '{0}' does not have a field named '{1}'. + 共用体ケース/例外 '{0}' には、'{1}' という名前のフィールドがありません。 @@ -7067,6 +7067,21 @@ This type does not inherit Attribute, it will not work correctly with other .NET languages. + + The exception '{0}' does not have a field named '{1}'. + The exception '{0}' does not have a field named '{1}'. + + + + The constructor does not have a field named '{0}'. + The constructor does not have a field named '{0}'. + + + + Active patterns do not have fields. This syntax is invalid. + Active patterns do not have fields. This syntax is invalid. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index e00fdb729bd..3dd8fa16415 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -6328,8 +6328,8 @@ - Union case/exception '{0}' does not have field named '{1}'. - 공용 구조체 케이스/예외 '{0}'에 이름이 '{1}'인 필드가 없습니다. + The union case '{0}' does not have a field named '{1}'. + 공용 구조체 케이스/예외 '{0}'에 이름이 '{1}'인 필드가 없습니다. @@ -7067,6 +7067,21 @@ This type does not inherit Attribute, it will not work correctly with other .NET languages. + + The exception '{0}' does not have a field named '{1}'. + The exception '{0}' does not have a field named '{1}'. + + + + The constructor does not have a field named '{0}'. + The constructor does not have a field named '{0}'. + + + + Active patterns do not have fields. This syntax is invalid. + Active patterns do not have fields. This syntax is invalid. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index c07c9316f30..a2e4ad8a2b5 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -6328,8 +6328,8 @@ - Union case/exception '{0}' does not have field named '{1}'. - Przypadek unii/wyjątek „{0}” nie ma pola o nazwie „{1}”. + The union case '{0}' does not have a field named '{1}'. + Przypadek unii/wyjątek „{0}” nie ma pola o nazwie „{1}”. @@ -7067,6 +7067,21 @@ This type does not inherit Attribute, it will not work correctly with other .NET languages. + + The exception '{0}' does not have a field named '{1}'. + The exception '{0}' does not have a field named '{1}'. + + + + The constructor does not have a field named '{0}'. + The constructor does not have a field named '{0}'. + + + + Active patterns do not have fields. This syntax is invalid. + Active patterns do not have fields. This syntax is invalid. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index 8956263b4da..b81572e3a73 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -6328,8 +6328,8 @@ - Union case/exception '{0}' does not have field named '{1}'. - O caso união/exceção '{0}' não possui um campo chamado '{1}'. + The union case '{0}' does not have a field named '{1}'. + O caso união/exceção '{0}' não possui um campo chamado '{1}'. @@ -7067,6 +7067,21 @@ This type does not inherit Attribute, it will not work correctly with other .NET languages. + + The exception '{0}' does not have a field named '{1}'. + The exception '{0}' does not have a field named '{1}'. + + + + The constructor does not have a field named '{0}'. + The constructor does not have a field named '{0}'. + + + + Active patterns do not have fields. This syntax is invalid. + Active patterns do not have fields. This syntax is invalid. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index b658c0ec23f..e3b2d9f4b51 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -6328,8 +6328,8 @@ - Union case/exception '{0}' does not have field named '{1}'. - Ветвь объединения/исключение "{0}" не содержит поля с именем "{1}". + The union case '{0}' does not have a field named '{1}'. + Ветвь объединения/исключение "{0}" не содержит поля с именем "{1}". @@ -7067,6 +7067,21 @@ This type does not inherit Attribute, it will not work correctly with other .NET languages. + + The exception '{0}' does not have a field named '{1}'. + The exception '{0}' does not have a field named '{1}'. + + + + The constructor does not have a field named '{0}'. + The constructor does not have a field named '{0}'. + + + + Active patterns do not have fields. This syntax is invalid. + Active patterns do not have fields. This syntax is invalid. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index ae8e758dfd0..9c9f740dcb7 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -6328,8 +6328,8 @@ - Union case/exception '{0}' does not have field named '{1}'. - {0}' birleşim durumu/özel durumunda '{1}' adlı alan yok. + The union case '{0}' does not have a field named '{1}'. + {0}' birleşim durumu/özel durumunda '{1}' adlı alan yok. @@ -7067,6 +7067,21 @@ This type does not inherit Attribute, it will not work correctly with other .NET languages. + + The exception '{0}' does not have a field named '{1}'. + The exception '{0}' does not have a field named '{1}'. + + + + The constructor does not have a field named '{0}'. + The constructor does not have a field named '{0}'. + + + + Active patterns do not have fields. This syntax is invalid. + Active patterns do not have fields. This syntax is invalid. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index e3273d74087..180d2f95b6a 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -6328,8 +6328,8 @@ - Union case/exception '{0}' does not have field named '{1}'. - 联合用例/异常“{0}”没有名为“{1}”的字段。 + The union case '{0}' does not have a field named '{1}'. + 联合用例/异常“{0}”没有名为“{1}”的字段。 @@ -7067,6 +7067,21 @@ This type does not inherit Attribute, it will not work correctly with other .NET languages. + + The exception '{0}' does not have a field named '{1}'. + The exception '{0}' does not have a field named '{1}'. + + + + The constructor does not have a field named '{0}'. + The constructor does not have a field named '{0}'. + + + + Active patterns do not have fields. This syntax is invalid. + Active patterns do not have fields. This syntax is invalid. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index 835390456ac..6e0f7e50c20 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -6328,8 +6328,8 @@ - Union case/exception '{0}' does not have field named '{1}'. - 等位/例外狀況 '{0}' 沒有名為 '{1}' 的欄位。 + The union case '{0}' does not have a field named '{1}'. + 等位/例外狀況 '{0}' 沒有名為 '{1}' 的欄位。 @@ -7067,6 +7067,21 @@ This type does not inherit Attribute, it will not work correctly with other .NET languages. + + The exception '{0}' does not have a field named '{1}'. + The exception '{0}' does not have a field named '{1}'. + + + + The constructor does not have a field named '{0}'. + The constructor does not have a field named '{0}'. + + + + Active patterns do not have fields. This syntax is invalid. + Active patterns do not have fields. This syntax is invalid. + + \ No newline at end of file