Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit39fd7b8

Browse files
forkiKevinRansom
authored andcommitted
Remove one "impossible" error (dotnet#5746)
* Remove one "impossible" error -fixesdotnet#5745* Fix tests* Add test fordotnet#5745* Fix "build from source"
1 parente42cea2 commit39fd7b8

File tree

22 files changed

+298
-48
lines changed

22 files changed

+298
-48
lines changed

‎src/buildfromsource/FSharp.Compiler.Private/FSComp.fs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3916,6 +3916,15 @@ type internal SR private() =
39163916
/// Union case/exception '%s' does not have field named '%s'.
39173917
/// (Originally from ..\FSComp.txt:1296)
39183918
static membertcUnionCaseConstructorDoesNotHaveFieldWithGivenName(a0:System.String,a1:System.String)=(3174, GetStringFunc("tcUnionCaseConstructorDoesNotHaveFieldWithGivenName",",,,%s,,,%s,,,") a0 a1)
3919+
/// The exception '%s' does not have a field named '%s'.
3920+
/// (Originally from ..\FSComp.txt:1297)
3921+
static membertcExceptionConstructorDoesNotHaveFieldWithGivenName(a0:System.String,a1:System.String)=(3174, GetStringFunc("tcExceptionConstructorDoesNotHaveFieldWithGivenName",",,,%s,,,%s,,,") a0 a1)
3922+
/// Active patterns do not have fields. This syntax is invalid.
3923+
/// (Originally from ..\FSComp.txt:1298)
3924+
static membertcActivePatternsDoNotHaveFields()=(3174, GetStringFunc("tcActivePatternsDoNotHaveFields",",,,"))
3925+
/// The constructor does not have a field named '%s'.
3926+
/// (Originally from ..\FSComp.txt:1299)
3927+
static membertcConstructorDoesNotHaveFieldWithGivenName(a0:System.String)=(3174, GetStringFunc("tcConstructorDoesNotHaveFieldWithGivenName",",,,%s,,,") a0)
39193928
/// Union case/exception field '%s' cannot be used more than once.
39203929
/// (Originally from ..\FSComp.txt:1297)
39213930
static membertcUnionCaseFieldCannotBeUsedMoreThanOnce(a0:System.String)=(3175, GetStringFunc("tcUnionCaseFieldCannotBeUsedMoreThanOnce",",,,%s,,,") a0)

‎src/buildfromsource/FSharp.Compiler.Private/FSComp.resx‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3916,7 +3916,16 @@
39163916
<value>Array method '{0}' 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.</value>
39173917
</data>
39183918
<dataname="tcUnionCaseConstructorDoesNotHaveFieldWithGivenName"xml:space="preserve">
3919-
<value>Union case/exception '{0}' does not have field named '{1}'.</value>
3919+
<value>The union case '{0}' does not have a field named '{1}'.</value>
3920+
</data>
3921+
<dataname="tcExceptionConstructorDoesNotHaveFieldWithGivenName"xml:space="preserve">
3922+
<value>The exception '{0}' does not have a field named '{1}'.</value>
3923+
</data>
3924+
<dataname="tcActivePatternsDoNotHaveFields"xml:space="preserve">
3925+
<value>Active patterns do not have fields. This syntax is invalid.</value>
3926+
</data>
3927+
<dataname="tcConstructorDoesNotHaveFieldWithGivenName"xml:space="preserve">
3928+
<value>The constructor does not have a field named '{0}'.</value>
39203929
</data>
39213930
<dataname="tcUnionCaseFieldCannotBeUsedMoreThanOnce"xml:space="preserve">
39223931
<value>Union case/exception field '{0}' cannot be used more than once.</value>

‎src/fsharp/FSComp.txt‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,10 @@ descriptionUnavailable,"(description unavailable...)"
12931293
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 = ...'."
12941294
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'."
12951295
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."
1296-
3174,tcUnionCaseConstructorDoesNotHaveFieldWithGivenName,"Union case/exception '%s' does not have field named '%s'."
1296+
3174,tcUnionCaseConstructorDoesNotHaveFieldWithGivenName,"The union case '%s' does not have a field named '%s'."
1297+
3174,tcExceptionConstructorDoesNotHaveFieldWithGivenName,"The exception '%s' does not have a field named '%s'."
1298+
3174,tcActivePatternsDoNotHaveFields,"Active patterns do not have fields. This syntax is invalid."
1299+
3174,tcConstructorDoesNotHaveFieldWithGivenName,"The constructor does not have a field named '%s'."
12971300
3175,tcUnionCaseFieldCannotBeUsedMoreThanOnce,"Union case/exception field '%s' cannot be used more than once."
12981301
3176,tcFieldNameIsUsedModeThanOnce,"Named field '%s' is used more than once."
12991302
3176,tcFieldNameConflictsWithGeneratedNameForAnonymousField,"Named field '%s' conflicts with autogenerated name for anonymous field."

‎src/fsharp/TypeChecker.fs‎

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5316,12 +5316,14 @@ and TcPat warnOnUpper cenv env topValInfo vFlags (tpenv, names, takenNames) ty p
53165316
for (id, pat) in pairs do
53175317
match argNames |> List.tryFindIndex (fun id2 -> id.idText = id2.idText) with
53185318
| None ->
5319-
let caseName =
5320-
match item with
5321-
| Item.UnionCase(uci, _) -> uci.Name
5322-
| Item.ExnCase tcref -> tcref.DisplayName
5323-
| _ -> failwith "impossible"
5324-
error(Error(FSComp.SR.tcUnionCaseConstructorDoesNotHaveFieldWithGivenName(caseName, id.idText), id.idRange))
5319+
match item with
5320+
| Item.UnionCase(uci, _) ->
5321+
error(Error(FSComp.SR.tcUnionCaseConstructorDoesNotHaveFieldWithGivenName(uci.Name, id.idText), id.idRange))
5322+
| Item.ExnCase tcref ->
5323+
error(Error(FSComp.SR.tcExceptionConstructorDoesNotHaveFieldWithGivenName(tcref.DisplayName, id.idText), id.idRange))
5324+
| _ ->
5325+
error(Error(FSComp.SR.tcConstructorDoesNotHaveFieldWithGivenName(id.idText), id.idRange))
5326+
53255327
| Some idx ->
53265328
match box result.[idx] with
53275329
| null ->
@@ -8644,13 +8646,16 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del
86448646
assert (isNull(box fittedArgs.[currentIndex]))
86458647
fittedArgs.[currentIndex] <- List.item currentIndex args // grab original argument, not item from the list of named parameters
86468648
currentIndex <- currentIndex + 1
8647-
else
8648-
let caseName =
8649-
match item with
8650-
| Item.UnionCase(uci, _) -> uci.Name
8651-
| Item.ExnCase tcref -> tcref.DisplayName
8652-
| _ -> failwith "impossible"
8653-
error(Error(FSComp.SR.tcUnionCaseConstructorDoesNotHaveFieldWithGivenName(caseName, id.idText), id.idRange))
8649+
else
8650+
match item with
8651+
| Item.UnionCase(uci, _) ->
8652+
error(Error(FSComp.SR.tcUnionCaseConstructorDoesNotHaveFieldWithGivenName(uci.Name, id.idText), id.idRange))
8653+
| Item.ExnCase tcref ->
8654+
error(Error(FSComp.SR.tcExceptionConstructorDoesNotHaveFieldWithGivenName(tcref.DisplayName, id.idText), id.idRange))
8655+
| Item.ActivePatternResult(_,_,_,_) ->
8656+
error(Error(FSComp.SR.tcActivePatternsDoNotHaveFields(), id.idRange))
8657+
| _ ->
8658+
error(Error(FSComp.SR.tcConstructorDoesNotHaveFieldWithGivenName(id.idText), id.idRange))
86548659

86558660
assert (Seq.forall (box >> ((<>) null) ) fittedArgs)
86568661
List.ofArray fittedArgs

‎src/fsharp/xlf/FSComp.txt.cs.xlf‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6328,8 +6328,8 @@
63286328
<note />
63296329
</trans-unit>
63306330
<trans-unitid="tcUnionCaseConstructorDoesNotHaveFieldWithGivenName">
6331-
<source>Unioncase/exception '{0}' does not have field named '{1}'.</source>
6332-
<targetstate="translated">Výjimka nebo případ typu union {0} nemá pole s názvem {1}.</target>
6331+
<source>The unioncase '{0}' does not have a field named '{1}'.</source>
6332+
<targetstate="needs-review-translation">Výjimka nebo případ typu union {0} nemá pole s názvem {1}.</target>
63336333
<note />
63346334
</trans-unit>
63356335
<trans-unitid="tcUnionCaseFieldCannotBeUsedMoreThanOnce">
@@ -7067,6 +7067,21 @@
70677067
<targetstate="new">This type does not inherit Attribute, it will not work correctly with other .NET languages.</target>
70687068
<note />
70697069
</trans-unit>
7070+
<trans-unitid="tcExceptionConstructorDoesNotHaveFieldWithGivenName">
7071+
<source>The exception '{0}' does not have a field named '{1}'.</source>
7072+
<targetstate="new">The exception '{0}' does not have a field named '{1}'.</target>
7073+
<note />
7074+
</trans-unit>
7075+
<trans-unitid="tcConstructorDoesNotHaveFieldWithGivenName">
7076+
<source>The constructor does not have a field named '{0}'.</source>
7077+
<targetstate="new">The constructor does not have a field named '{0}'.</target>
7078+
<note />
7079+
</trans-unit>
7080+
<trans-unitid="tcActivePatternsDoNotHaveFields">
7081+
<source>Active patterns do not have fields. This syntax is invalid.</source>
7082+
<targetstate="new">Active patterns do not have fields. This syntax is invalid.</target>
7083+
<note />
7084+
</trans-unit>
70707085
</body>
70717086
</file>
70727087
</xliff>

‎src/fsharp/xlf/FSComp.txt.de.xlf‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6328,8 +6328,8 @@
63286328
<note />
63296329
</trans-unit>
63306330
<trans-unit id="tcUnionCaseConstructorDoesNotHaveFieldWithGivenName">
6331-
<source>Unioncase/exception '{0}' does not have field named '{1}'.</source>
6332-
<target state="translated">Union-Fall/Ausnahme '{0}' verfügt nicht über ein Feld mit dem Namen '{1}'.</target>
6331+
<source>The unioncase '{0}' does not have a field named '{1}'.</source>
6332+
<target state="needs-review-translation">Union-Fall/Ausnahme '{0}' verfügt nicht über ein Feld mit dem Namen '{1}'.</target>
63336333
<note />
63346334
</trans-unit>
63356335
<trans-unit id="tcUnionCaseFieldCannotBeUsedMoreThanOnce">
@@ -7067,6 +7067,21 @@
70677067
<target state="new">This type does not inherit Attribute, it will not work correctly with other .NET languages.</target>
70687068
<note />
70697069
</trans-unit>
7070+
<trans-unit id="tcExceptionConstructorDoesNotHaveFieldWithGivenName">
7071+
<source>The exception '{0}' does not have a field named '{1}'.</source>
7072+
<target state="new">The exception '{0}' does not have a field named '{1}'.</target>
7073+
<note />
7074+
</trans-unit>
7075+
<trans-unit id="tcConstructorDoesNotHaveFieldWithGivenName">
7076+
<source>The constructor does not have a field named '{0}'.</source>
7077+
<target state="new">The constructor does not have a field named '{0}'.</target>
7078+
<note />
7079+
</trans-unit>
7080+
<trans-unit id="tcActivePatternsDoNotHaveFields">
7081+
<source>Active patterns do not have fields. This syntax is invalid.</source>
7082+
<target state="new">Active patterns do not have fields. This syntax is invalid.</target>
7083+
<note />
7084+
</trans-unit>
70707085
</body>
70717086
</file>
70727087
</xliff>

‎src/fsharp/xlf/FSComp.txt.en.xlf‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6328,8 +6328,8 @@
63286328
<note />
63296329
</trans-unit>
63306330
<trans-unitid="tcUnionCaseConstructorDoesNotHaveFieldWithGivenName">
6331-
<source>Unioncase/exception '{0}' does not have field named '{1}'.</source>
6332-
<targetstate="new">Unioncase/exception '{0}' does not have field named '{1}'.</target>
6331+
<source>The unioncase '{0}' does not have a field named '{1}'.</source>
6332+
<targetstate="new">The unioncase '{0}' does not have a field named '{1}'.</target>
63336333
<note />
63346334
</trans-unit>
63356335
<trans-unitid="tcUnionCaseFieldCannotBeUsedMoreThanOnce">
@@ -7067,6 +7067,21 @@
70677067
<targetstate="new">This type does not inherit Attribute, it will not work correctly with other .NET languages.</target>
70687068
<note />
70697069
</trans-unit>
7070+
<trans-unitid="tcExceptionConstructorDoesNotHaveFieldWithGivenName">
7071+
<source>The exception '{0}' does not have a field named '{1}'.</source>
7072+
<targetstate="new">The exception '{0}' does not have a field named '{1}'.</target>
7073+
<note />
7074+
</trans-unit>
7075+
<trans-unitid="tcConstructorDoesNotHaveFieldWithGivenName">
7076+
<source>The constructor does not have a field named '{0}'.</source>
7077+
<targetstate="new">The constructor does not have a field named '{0}'.</target>
7078+
<note />
7079+
</trans-unit>
7080+
<trans-unitid="tcActivePatternsDoNotHaveFields">
7081+
<source>Active patterns do not have fields. This syntax is invalid.</source>
7082+
<targetstate="new">Active patterns do not have fields. This syntax is invalid.</target>
7083+
<note />
7084+
</trans-unit>
70707085
</body>
70717086
</file>
70727087
</xliff>

‎src/fsharp/xlf/FSComp.txt.es.xlf‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6328,8 +6328,8 @@
63286328
<note />
63296329
</trans-unit>
63306330
<trans-unit id="tcUnionCaseConstructorDoesNotHaveFieldWithGivenName">
6331-
<source>Unioncase/exception '{0}' does not have field named '{1}'.</source>
6332-
<targetstate="translated">La excepción o el caso de unión '{0}' no tiene un campo denominado '{1}'.</target>
6331+
<source>The unioncase '{0}' does not have a field named '{1}'.</source>
6332+
<target state="needs-review-translation">La excepción o el caso de unión '{0}' no tiene un campo denominado '{1}'.</target>
63336333
<note />
63346334
</trans-unit>
63356335
<trans-unit id="tcUnionCaseFieldCannotBeUsedMoreThanOnce">
@@ -7067,6 +7067,21 @@
70677067
<target state="new">This type does not inherit Attribute, it will not work correctly with other .NET languages.</target>
70687068
<note />
70697069
</trans-unit>
7070+
<trans-unit id="tcExceptionConstructorDoesNotHaveFieldWithGivenName">
7071+
<source>The exception '{0}' does not have a field named '{1}'.</source>
7072+
<target state="new">The exception '{0}' does not have a field named '{1}'.</target>
7073+
<note />
7074+
</trans-unit>
7075+
<trans-unit id="tcConstructorDoesNotHaveFieldWithGivenName">
7076+
<source>The constructor does not have a field named '{0}'.</source>
7077+
<target state="new">The constructor does not have a field named '{0}'.</target>
7078+
<note />
7079+
</trans-unit>
7080+
<trans-unit id="tcActivePatternsDoNotHaveFields">
7081+
<source>Active patterns do not have fields. This syntax is invalid.</source>
7082+
<target state="new">Active patterns do not have fields. This syntax is invalid.</target>
7083+
<note />
7084+
</trans-unit>
70707085
</body>
70717086
</file>
70727087
</xliff>

‎src/fsharp/xlf/FSComp.txt.fr.xlf‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6328,8 +6328,8 @@
63286328
<note />
63296329
</trans-unit>
63306330
<trans-unit id="tcUnionCaseConstructorDoesNotHaveFieldWithGivenName">
6331-
<source>Unioncase/exception '{0}' does not have field named '{1}'.</source>
6332-
<target state="translated">Le cas ou l'exception d'union '{0}' ne possède pas de champ nommé '{1}'.</target>
6331+
<source>The unioncase '{0}' does not have a field named '{1}'.</source>
6332+
<target state="needs-review-translation">Le cas ou l'exception d'union '{0}' ne possède pas de champ nommé '{1}'.</target>
63336333
<note />
63346334
</trans-unit>
63356335
<trans-unit id="tcUnionCaseFieldCannotBeUsedMoreThanOnce">
@@ -7067,6 +7067,21 @@
70677067
<target state="new">This type does not inherit Attribute, it will not work correctly with other .NET languages.</target>
70687068
<note />
70697069
</trans-unit>
7070+
<trans-unit id="tcExceptionConstructorDoesNotHaveFieldWithGivenName">
7071+
<source>The exception '{0}' does not have a field named '{1}'.</source>
7072+
<target state="new">The exception '{0}' does not have a field named '{1}'.</target>
7073+
<note />
7074+
</trans-unit>
7075+
<trans-unit id="tcConstructorDoesNotHaveFieldWithGivenName">
7076+
<source>The constructor does not have a field named '{0}'.</source>
7077+
<target state="new">The constructor does not have a field named '{0}'.</target>
7078+
<note />
7079+
</trans-unit>
7080+
<trans-unit id="tcActivePatternsDoNotHaveFields">
7081+
<source>Active patterns do not have fields. This syntax is invalid.</source>
7082+
<target state="new">Active patterns do not have fields. This syntax is invalid.</target>
7083+
<note />
7084+
</trans-unit>
70707085
</body>
70717086
</file>
70727087
</xliff>

‎src/fsharp/xlf/FSComp.txt.it.xlf‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6328,8 +6328,8 @@
63286328
<note />
63296329
</trans-unit>
63306330
<trans-unit id="tcUnionCaseConstructorDoesNotHaveFieldWithGivenName">
6331-
<source>Unioncase/exception '{0}' does not have field named '{1}'.</source>
6332-
<target state="translated">Il case di unione/eccezione '{0}' non contiene il campo denominato '{1}'.</target>
6331+
<source>The unioncase '{0}' does not have a field named '{1}'.</source>
6332+
<target state="needs-review-translation">Il case di unione/eccezione '{0}' non contiene il campo denominato '{1}'.</target>
63336333
<note />
63346334
</trans-unit>
63356335
<trans-unit id="tcUnionCaseFieldCannotBeUsedMoreThanOnce">
@@ -7067,6 +7067,21 @@
70677067
<target state="new">This type does not inherit Attribute, it will not work correctly with other .NET languages.</target>
70687068
<note />
70697069
</trans-unit>
7070+
<trans-unit id="tcExceptionConstructorDoesNotHaveFieldWithGivenName">
7071+
<source>The exception '{0}' does not have a field named '{1}'.</source>
7072+
<target state="new">The exception '{0}' does not have a field named '{1}'.</target>
7073+
<note />
7074+
</trans-unit>
7075+
<trans-unit id="tcConstructorDoesNotHaveFieldWithGivenName">
7076+
<source>The constructor does not have a field named '{0}'.</source>
7077+
<target state="new">The constructor does not have a field named '{0}'.</target>
7078+
<note />
7079+
</trans-unit>
7080+
<trans-unit id="tcActivePatternsDoNotHaveFields">
7081+
<source>Active patterns do not have fields. This syntax is invalid.</source>
7082+
<target state="new">Active patterns do not have fields. This syntax is invalid.</target>
7083+
<note />
7084+
</trans-unit>
70707085
</body>
70717086
</file>
70727087
</xliff>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp