Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message when using wrong anon record #15732

Merged
merged 6 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Compiler/Checking/ConstraintSolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,12 @@ and SolveAnonInfoEqualsAnonInfo (csenv: ConstraintSolverEnv) m2 (anonInfo1: Anon
| Overlap (missingFields, extraFields) ->
FSComp.SR.tcAnonRecdFieldNameMismatch(string missingFields, string extraFields)
| CompletelyDifferent missingFields ->
FSComp.SR.tcAnonRecdFieldNameDifferent(string missingFields)
match missingFields with
| [missingField] ->
FSComp.SR.tcAnonRecdSingleFieldNameDifferent(missingField)
| _ ->
let missingFields = String.concat ", " missingFields
FSComp.SR.tcAnonRecdMultipleFieldNameDifferent(missingFields)

ErrorD (ConstraintSolverError(message, csenv.m,m2))
else
Expand Down
3 changes: 2 additions & 1 deletion src/Compiler/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,8 @@ tcAnonRecdSingleFieldNameSubset,"This anonymous record is missing field '%s'."
tcAnonRecdMultipleFieldsNameSubset,"This anonymous record is missing fields '%s'."
tcAnonRecdSingleFieldNameSuperset,"This anonymous record has an extra field. Remove field '%s'."
tcAnonRecdMultipleFieldsNameSuperset,"This anonymous record has extra fields. Remove fields '%s'."
tcAnonRecdFieldNameDifferent,"This is the wrong anonymous record. It should have the fields %s."
tcAnonRecdSingleFieldNameDifferent,"This anonymous record should have field '%s'."
tcAnonRecdMultipleFieldNameDifferent,"This anonymous record should have 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."
keywordDescriptionAnd,"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."
Expand Down
21 changes: 13 additions & 8 deletions src/Compiler/xlf/FSComp.txt.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 13 additions & 8 deletions src/Compiler/xlf/FSComp.txt.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 13 additions & 8 deletions src/Compiler/xlf/FSComp.txt.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 13 additions & 8 deletions src/Compiler/xlf/FSComp.txt.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 13 additions & 8 deletions src/Compiler/xlf/FSComp.txt.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading