Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.23401.3">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.23402.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>f99e2f9b8aca08b8fa0877e78a448c0c0b74236d</Sha>
<Sha>3addc5d978d01e864792d2c6bce0b50ec105f857</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.SourceLink.GitHub" Version="8.0.0-beta.23361.2" CoherentParentDependency="Microsoft.DotNet.Arcade.Sdk">
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"perl": "5.32.1.1"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23401.3",
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23402.2",
"Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23255.2"
}
}
26 changes: 24 additions & 2 deletions src/Compiler/Checking/ConstraintSolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,9 @@ and SolveAnonInfoEqualsAnonInfo (csenv: ConstraintSolverEnv) m2 (anonInfo1: Anon
elif Set.intersect first second <> Set.empty then
Overlap(firstOnly, secondOnly)
else
CompletelyDifferent(Seq.toList first)
let first = Set.toList first
let second = Set.toList second
CompletelyDifferent(first, second)

let message =
match anonInfo1.SortedNames, anonInfo2.SortedNames with
Expand All @@ -1087,19 +1089,39 @@ and SolveAnonInfoEqualsAnonInfo (csenv: ConstraintSolverEnv) m2 (anonInfo1: Anon
| [missingField] ->
FSComp.SR.tcAnonRecdSingleFieldNameSubset(string missingField)
| _ ->
let missingFields = missingFields |> List.map(sprintf "'%s'")
let missingFields = String.concat ", " missingFields
FSComp.SR.tcAnonRecdMultipleFieldsNameSubset(string missingFields)
| Superset extraFields ->
match extraFields with
| [extraField] ->
FSComp.SR.tcAnonRecdSingleFieldNameSuperset(string extraField)
| _ ->
let extraFields = extraFields |> List.map(sprintf "'%s'")
let extraFields = String.concat ", " extraFields
FSComp.SR.tcAnonRecdMultipleFieldsNameSuperset(string extraFields)
| Overlap (missingFields, extraFields) ->
FSComp.SR.tcAnonRecdFieldNameMismatch(string missingFields, string extraFields)
| CompletelyDifferent missingFields ->
FSComp.SR.tcAnonRecdFieldNameDifferent(string missingFields)
let missingFields, usedFields = missingFields
match missingFields, usedFields with
| [ missingField ], [ usedField ] ->
FSComp.SR.tcAnonRecdSingleFieldNameSingleDifferent(missingField, usedField)
| [ missingField ], usedFields ->
let usedFields = usedFields |> List.map(sprintf "'%s'")
let usedFields = String.concat ", " usedFields
FSComp.SR.tcAnonRecdSingleFieldNameMultipleDifferent(missingField, usedFields)
| missingFields, [ usedField ] ->
let missingFields = missingFields |> List.map(sprintf "'%s'")
let missingFields = String.concat ", " missingFields
FSComp.SR.tcAnonRecdMultipleFieldNameSingleDifferent(missingFields, usedField)

| missingFields, usedFields ->
let missingFields = missingFields |> List.map(sprintf "'%s'")
let missingFields = String.concat ", " missingFields
let usedFields = usedFields |> List.map(sprintf "'%s'")
let usedFields = String.concat ", " usedFields
FSComp.SR.tcAnonRecdMultipleFieldNameMultipleDifferent(missingFields, usedFields)

ErrorD (ConstraintSolverError(message, csenv.m,m2))
else
Expand Down
9 changes: 6 additions & 3 deletions src/Compiler/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1396,10 +1396,13 @@ tcAnonRecdInvalid,"Invalid Anonymous Record type declaration."
tcAnonRecdCcuMismatch,"Two anonymous record types are from different assemblies '%s' and '%s'"
tcAnonRecdFieldNameMismatch,"This anonymous record does not exactly match the expected shape. Add the missing fields %s and remove the extra fields %s."
tcAnonRecdSingleFieldNameSubset,"This anonymous record is missing field '%s'."
tcAnonRecdMultipleFieldsNameSubset,"This anonymous record is missing fields '%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."
tcAnonRecdMultipleFieldsNameSuperset,"This anonymous record has extra fields. Remove fields %s."
tcAnonRecdSingleFieldNameSingleDifferent,"This anonymous record should have field '%s' but here has field '%s'."
tcAnonRecdSingleFieldNameMultipleDifferent,"This anonymous record should have field '%s' but here has fields %s."
tcAnonRecdMultipleFieldNameSingleDifferent,"This anonymous record should have fields %s; but here has field '%s'."
tcAnonRecdMultipleFieldNameMultipleDifferent,"This anonymous record should have fields %s; but here has 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: 21 additions & 0 deletions src/Compiler/Service/FSharpParseFileResults.fs
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,27 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput,
let result = SyntaxTraversal.Traverse(pos, input, visitor)
result.IsSome

member _.IsPositionWithinRecordDefinition pos =
let isWithin left right middle =
Position.posGt right left && Position.posLt middle right

let visitor =
{ new SyntaxVisitorBase<_>() with
override _.VisitRecordDefn(_, _, range) =
if pos |> isWithin range.Start range.End then
Some true
else
None

override _.VisitTypeAbbrev(_, synType, range) =
match synType with
| SynType.AnonRecd _ when pos |> isWithin range.Start range.End -> Some true
| _ -> None
}

let result = SyntaxTraversal.Traverse(pos, input, visitor)
result.IsSome

/// Get declared items and the selected item at the specified location
member _.GetNavigationItemsImpl() =
DiagnosticsScope.Protect
Expand Down
3 changes: 3 additions & 0 deletions src/Compiler/Service/FSharpParseFileResults.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ type public FSharpParseFileResults =
/// Determines if the binding at the given position is bound to a lambda expression
member IsBindingALambdaAtPosition: pos -> bool

/// Determines if the given position is bound to a record definition
member IsPositionWithinRecordDefinition: pos -> bool

/// Name of the file for which this information were created
member FileName: string

Expand Down
39 changes: 27 additions & 12 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.

39 changes: 27 additions & 12 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.

Loading