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
6 changes: 3 additions & 3 deletions src/Compiler/Checking/CheckExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1822,19 +1822,19 @@ let BuildFieldMap (cenv: cenv) env isPartial ty (flds: ((Ident list * Ident) * '
rfinfo1.TypeInst, rfinfo1.TyconRef

let fldsmap, rfldsList =
((Map.empty, []), fldResolutions) ||> List.fold (fun (fs, rfldsList) (fld, frefs, fldExpr) ->
((Map.empty, []), fldResolutions) ||> List.fold (fun (fs, rfldsList) ((_, ident), frefs, fldExpr) ->
match frefs |> List.filter (fun (FieldResolution(rfinfo2, _)) -> tyconRefEq g tcref rfinfo2.TyconRef) with
| [FieldResolution(rfinfo2, showDeprecated)] ->

// Record the precise resolution of the field for intellisense
let item = Item.RecdField(rfinfo2)
CallNameResolutionSink cenv.tcSink ((snd fld).idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, ad)
CallNameResolutionSink cenv.tcSink (ident.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, ad)

let fref2 = rfinfo2.RecdFieldRef

CheckRecdFieldAccessible cenv.amap m env.eAccessRights fref2 |> ignore

CheckFSharpAttributes g fref2.PropertyAttribs m |> CommitOperationResult
CheckFSharpAttributes g fref2.PropertyAttribs ident.idRange |> CommitOperationResult

if Map.containsKey fref2.FieldName fs then
errorR (Error(FSComp.SR.tcFieldAppearsTwiceInRecord(fref2.FieldName), m))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ let c = { X = 0 }
|> compile
|> shouldFail
|> withDiagnostics [
(Error 101, Line 7, Col 9, Line 7, Col 18, "This construct is deprecated. Use B instead")
(Error 101, Line 7, Col 11, Line 7, Col 12, "This construct is deprecated. Use B instead")
]

[<Fact>]
Expand Down Expand Up @@ -373,7 +373,7 @@ type ButtonExtensions =
|> compile
|> shouldFail
|> withDiagnostics [
(Error 101, Line 13, Col 9, Line 13, Col 34, "This construct is deprecated. Use B instead")
(Error 101, Line 13, Col 21, Line 13, Col 25, "This construct is deprecated. Use B instead")
]

[<Fact>]
Expand All @@ -397,7 +397,7 @@ type ButtonExtensions =
|> shouldFail
|> withDiagnostics [
(Error 101, Line 12, Col 37, Line 12, Col 43, "This construct is deprecated. Use B instead");
(Error 101, Line 13, Col 9, Line 13, Col 34, "This construct is deprecated. Use B instead")
(Error 101, Line 13, Col 21, Line 13, Col 25, "This construct is deprecated. Use B instead")
]

[<Fact>]
Expand All @@ -416,7 +416,7 @@ module Button =
|> compile
|> shouldFail
|> withDiagnostics [
(Error 101, Line 9, Col 20, Line 9, Col 36, "This construct is deprecated. Use B instead")
(Error 101, Line 9, Col 22, Line 9, Col 26, "This construct is deprecated. Use B instead")
]


Expand All @@ -437,7 +437,7 @@ module Button =
|> compile
|> shouldFail
|> withDiagnostics [
(Error 101, Line 10, Col 20, Line 10, Col 36, "This construct is deprecated. Use B instead")
(Error 101, Line 10, Col 22, Line 10, Col 26, "This construct is deprecated. Use B instead")
]

[<Fact>]
Expand All @@ -462,7 +462,7 @@ type ButtonExtensions =
|> compile
|> shouldFail
|> withDiagnostics [
(Error 101, Line 9, Col 20, Line 9, Col 36, "This construct is deprecated. Use B instead")
(Error 101, Line 9, Col 22, Line 9, Col 26, "This construct is deprecated. Use B instead")
]

[<Fact>]
Expand Down Expand Up @@ -607,9 +607,10 @@ let a = { DeprecatedField= "23" ; JustField = "" }
|> compile
|> shouldFail
|> withDiagnostics [
(Error 101, Line 4, Col 9, Line 4, Col 51, "This construct is deprecated. Deprecated Field")
(Error 101, Line 4, Col 11, Line 4, Col 26, "This construct is deprecated. Deprecated Field")
]

// This should only report one warning but instead show two. Related issue https://github.com/dotnet/fsharp/issues/14203
[<Fact>]
let ``Obsolete attribute warning is taken into account when used in one the record properties`` () =
Fsx """
Expand All @@ -620,6 +621,7 @@ let a = { DeprecatedField= "23" ; JustField = "" }
|> compile
|> shouldFail
|> withDiagnostics [
(Warning 44, Line 4, Col 11, Line 4, Col 26, "This construct is deprecated. Deprecated Field")
(Warning 44, Line 4, Col 9, Line 4, Col 51, "This construct is deprecated. Deprecated Field")
]

Expand Down