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

Report auto property redux #16116

Merged
merged 24 commits into from
Nov 21, 2023
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b8ea0e3
Report property in PostInferenceChecks.
nojaf Oct 11, 2023
33d7d93
Move property item creation back to CheckDeclarations.
nojaf Oct 12, 2023
97a34b8
Use StringComparison.Ordinal
nojaf Nov 10, 2023
9e22857
Update unit test according to new world.
nojaf Nov 10, 2023
f9b5ea6
Update tests
nojaf Nov 13, 2023
4c69ba5
Update SyntaxTree tests
nojaf Nov 13, 2023
f1ab837
Update SyntaxTree tests
nojaf Nov 13, 2023
14258ec
Update unit tests
nojaf Nov 14, 2023
995959d
Return single property tooltip.
nojaf Nov 14, 2023
cef7c51
Maybe fix fsharpqa tests
nojaf Nov 14, 2023
d55e99f
Merge branch 'main' into report-auto-property-redux
nojaf Nov 14, 2023
3f0202d
Maybe fix fsharpqa tests
nojaf Nov 14, 2023
e5bdefb
Merge branch 'report-auto-property-redux' of https://github.com/nojaf…
nojaf Nov 14, 2023
c99df5f
Merge branch 'main' into report-auto-property-redux
nojaf Nov 15, 2023
1ddb15a
Update tests
nojaf Nov 15, 2023
b8ff0ef
Merge branch 'main' into report-auto-property-redux
psfinaki Nov 15, 2023
e7261e9
Merge branch 'main' into report-auto-property-redux
nojaf Nov 16, 2023
3706586
Update test
nojaf Nov 16, 2023
9daa478
Add tests for properties during critical errors.
nojaf Nov 16, 2023
b84edcb
Add test for property symbol on interface.
nojaf Nov 16, 2023
100dbc5
Revert PostInferenceChecks.fs
nojaf Nov 16, 2023
159b013
Merge branch 'main' into report-auto-property-redux
nojaf Nov 20, 2023
9187b0b
Clean up
nojaf Nov 21, 2023
5385172
Merge branch 'main' into report-auto-property-redux
nojaf Nov 21, 2023
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
Prev Previous commit
Next Next commit
Update unit tests
  • Loading branch information
nojaf committed Nov 14, 2023
commit 14258ec63e1be44e77a7bacde194e2421353804d
114 changes: 51 additions & 63 deletions tests/service/ProjectAnalysisTests.fs
Original file line number Diff line number Diff line change
@@ -3440,41 +3440,40 @@ let ``Test Project24 all symbols`` () =
allUses |> shouldEqual
[|("TypeWithProperties", "file1", ((4, 5), (4, 23)), ["defn"], ["class"]);
("``.ctor``", "file1", ((4, 5), (4, 23)), ["defn"], ["member"; "ctor"]);
("NameGetSet", "file1", ((6, 13), (6, 16)), ["defn"], ["member"; "getter"]);
("NameGetSet", "file1", ((5, 13), (5, 23)), ["defn"], ["member"; "getter"]);
("int", "file1", ((7, 20), (7, 23)), ["type"], ["abbrev"]);
("NameGetSet", "file1", ((7, 12), (7, 15)), ["defn"], ["member"; "setter"]);
("NameGet", "file1", ((10, 13), (10, 16)), ["defn"], ["member"; "getter"]);
("NameGetSet", "file1", ((5, 13), (5, 23)), ["defn"], ["member"; "setter"]);
("NameGet", "file1", ((9, 13), (9, 20)), ["defn"], ["member"; "getter"]);
("int", "file1", ((11, 20), (11, 23)), ["type"], ["abbrev"]);
("NameGet", "file1", ((11, 12), (11, 15)), ["defn"], ["member"; "setter"]);
("NameGet", "file1", ((9, 13), (9, 20)), ["defn"], ["member"; "setter"]);
("int", "file1", ((14, 21), (14, 24)), ["type"], ["abbrev"]);
("NameSet", "file1", ((13, 13), (13, 20)), ["defn"], ["member"; "setter"]);
("StaticNameGetSet", "file1", ((16, 18), (16, 34)), ["defn"],
["member"; "getter"]);
("int", "file1", ((18, 20), (18, 23)), ["type"], ["abbrev"])
("int", "file1", ((18, 20), (18, 23)), ["type"], ["abbrev"]);
("StaticNameGetSet", "file1", ((16, 18), (16, 34)), ["defn"], ["member"; "setter"]);
("StaticNameGet", "file1", ((20, 18), (20, 31)), ["defn"],
["member"; "getter"]);
("int", "file1", ((22, 20), (22, 23)), ["type"], ["abbrev"])
("int", "file1", ((22, 20), (22, 23)), ["type"], ["abbrev"]);
("StaticNameGet", "file1", ((20, 18), (20, 31)), ["defn"], ["member"; "setter"]);
("int", "file1", ((25, 21), (25, 24)), ["type"], ["abbrev"]);
("StaticNameSet", "file1", ((24, 18), (24, 31)), ["defn"],
["member"; "setter"]);
("AutoPropGet", "file1", ((27, 15), (27, 26)), ["defn"],
("AutoPropGet", "file1", ((27, 15), (27, 26)), ["defn"], ["member"; "getter"]);
("AutoPropGetSet", "file1", ((28, 15), (28, 29)), ["defn"],
["member"; "getter"]);
("AutoPropGetSet", "file1", ((28, 39), (28, 42)), ["defn"],
["member"; "getter"]);
("AutoPropGetSet", "file1", ((28, 44), (28, 47)), ["defn"], ["member"; "setter"])
("AutoPropGetSet", "file1", ((28, 15), (28, 29)), ["defn"], ["member"; "setter"]);
("StaticAutoPropGet", "file1", ((30, 22), (30, 39)), ["defn"],
["member"; "getter"]);
("StaticAutoPropGetSet", "file1", ((31, 52), (31, 55)), ["defn"],
["member"; "getter"])
("StaticAutoPropGetSet", "file1", ((31, 57), (31, 60)), ["defn"], ["member"; "setter"])
("StaticAutoPropGetSet", "file1", ((31, 22), (31, 42)), ["defn"],
["member"; "getter"]);
("StaticAutoPropGetSet", "file1", ((31, 22), (31, 42)), ["defn"], ["member"; "setter"]);
("NameGetSet", "file1", ((5, 13), (5, 23)), ["defn"], ["member"; "prop"]);
("NameGet", "file1", ((9, 13), (9, 20)), ["defn"], ["member"; "prop"])
("NameGet", "file1", ((9, 13), (9, 20)), ["defn"], ["member"; "prop"]);
("StaticNameGetSet", "file1", ((16, 18), (16, 34)), ["defn"], ["member"; "prop"]);
("StaticNameGet", "file1", ((20, 18), (20, 31)), ["defn"], ["member"; "prop"]);
("AutoPropGetSet", "file1", ((28, 15), (28, 29)), ["defn"], ["member"; "prop"])
("StaticAutoPropGetSet", "file1", ((31, 22), (31, 42)), ["defn"], ["member"; "prop"]);
("AutoPropGetSet", "file1", ((28, 15), (28, 29)), ["defn"], ["member"; "prop"]);
("StaticAutoPropGetSet", "file1", ((31, 22), (31, 42)), ["defn"], ["member"; "prop"])
("x", "file1", ((5, 11), (5, 12)), ["defn"], []);
("int", "file1", ((7, 20), (7, 23)), ["type"], ["abbrev"]);
("v", "file1", ((7, 17), (7, 18)), ["defn"], []);
@@ -3491,25 +3490,21 @@ let ``Test Project24 all symbols`` () =
("int", "file1", ((25, 21), (25, 24)), ["type"], ["abbrev"]);
("v", "file1", ((25, 18), (25, 19)), ["defn"], []);
("``AutoPropGet@``", "file1", ((27, 15), (27, 26)), [], ["compgen"]);
("``AutoPropGetSet@``", "file1", ((28, 15), (28, 29)), [], ["compgen";"mutable"]);
("v", "file1", ((28, 44), (28, 47)), ["defn"], []);
("``AutoPropGetSet@``", "file1", ((28, 15), (28, 29)), [], ["compgen"; "mutable"])
("v", "file1", ((28, 15), (28, 29)), ["defn"], []);
("``StaticAutoPropGet@``", "file1", ((30, 22), (30, 39)), [], ["compgen"]);
("``StaticAutoPropGetSet@``", "file1", ((31, 22), (31, 42)), [],
["compgen";"mutable"]); ("v", "file1", ((31, 57), (31, 60)), ["defn"], []);
["compgen"; "mutable"]); ("v", "file1", ((31, 22), (31, 42)), ["defn"], []);
("``.cctor``", "file1", ((4, 5), (4, 23)), ["defn"], ["member"]);
("TypeWithProperties", "file1", ((33, 9), (33, 27)), [],
["member"; "ctor"]);
("TypeWithProperties", "file1", ((33, 9), (33, 27)), [], ["member"; "ctor"]);
("NameGetSet", "file1", ((33, 9), (33, 40)), [], ["member"; "prop"]);
("v1", "file1", ((33, 4), (33, 6)), ["defn"], ["val"]);
("TypeWithProperties", "file1", ((34, 0), (34, 18)), [],
["member"; "ctor"]);
("TypeWithProperties", "file1", ((34, 0), (34, 18)), [], ["member"; "ctor"]);
("NameGetSet", "file1", ((34, 0), (34, 31)), [], ["member"; "prop"]);
("TypeWithProperties", "file1", ((36, 9), (36, 27)), [],
["member"; "ctor"]);
("TypeWithProperties", "file1", ((36, 9), (36, 27)), [], ["member"; "ctor"]);
("NameGet", "file1", ((36, 9), (36, 37)), [], ["member"; "prop"]);
("v2", "file1", ((36, 4), (36, 6)), ["defn"], ["val"]);
("TypeWithProperties", "file1", ((38, 0), (38, 18)), [],
["member"; "ctor"]);
("TypeWithProperties", "file1", ((38, 0), (38, 18)), [], ["member"; "ctor"]);
("NameSet", "file1", ((38, 0), (38, 28)), [], ["member"; "prop"]);
("TypeWithProperties", "file1", ((40, 9), (40, 27)), [], ["class"]);
("StaticNameGetSet", "file1", ((40, 9), (40, 44)), [], ["member"; "prop"]);
@@ -3521,27 +3516,22 @@ let ``Test Project24 all symbols`` () =
("v4", "file1", ((43, 4), (43, 6)), ["defn"], ["val"]);
("TypeWithProperties", "file1", ((45, 0), (45, 18)), [], ["class"]);
("StaticNameSet", "file1", ((45, 0), (45, 32)), [], ["member"; "prop"]);
("TypeWithProperties", "file1", ((47, 9), (47, 27)), [],
["member"; "ctor"]);
("TypeWithProperties", "file1", ((47, 9), (47, 27)), [], ["member"; "ctor"]);
("AutoPropGet", "file1", ((47, 9), (47, 41)), [], ["member"; "prop"]);
("v5", "file1", ((47, 4), (47, 6)), ["defn"], ["val"]);
("TypeWithProperties", "file1", ((49, 9), (49, 27)), [],
["member"; "ctor"]);
("TypeWithProperties", "file1", ((49, 9), (49, 27)), [], ["member"; "ctor"]);
("AutoPropGetSet", "file1", ((49, 9), (49, 44)), [], ["member"; "prop"]);
("v6", "file1", ((49, 4), (49, 6)), ["defn"], ["val"]);
("TypeWithProperties", "file1", ((50, 0), (50, 18)), [],
["member"; "ctor"]);
("TypeWithProperties", "file1", ((50, 0), (50, 18)), [], ["member"; "ctor"]);
("AutoPropGetSet", "file1", ((50, 0), (50, 35)), [], ["member"; "prop"]);
("TypeWithProperties", "file1", ((52, 9), (52, 27)), [], ["class"]);
("StaticAutoPropGet", "file1", ((52, 9), (52, 45)), [], ["member"; "prop"]);
("v7", "file1", ((52, 4), (52, 6)), ["defn"], ["val"]);
("TypeWithProperties", "file1", ((54, 9), (54, 27)), [], ["class"]);
("StaticAutoPropGetSet", "file1", ((54, 9), (54, 48)), [],
["member"; "prop"]);
("StaticAutoPropGetSet", "file1", ((54, 9), (54, 48)), [], ["member"; "prop"]);
("v8", "file1", ((54, 4), (54, 6)), ["defn"], ["val"]);
("TypeWithProperties", "file1", ((55, 0), (55, 18)), [], ["class"]);
("StaticAutoPropGetSet", "file1", ((55, 0), (55, 39)), [],
["member"; "prop"]);
("StaticAutoPropGetSet", "file1", ((55, 0), (55, 39)), [], ["member"; "prop"]);
("PropertyTest", "file1", ((2, 7), (2, 19)), ["defn"], ["module"])|]

[<Test>]
@@ -3559,39 +3549,37 @@ let ``Test symbol uses of properties with both getters and setters`` () =
getAllSymbolUses |> shouldEqual
[|("TypeWithProperties", "file1", ((4, 5), (4, 23)), ["class"]);
("``.ctor``", "file1", ((4, 5), (4, 23)), ["member"; "ctor"]);
("NameGetSet", "file1", ((6, 13), (6, 16)), ["member"; "getter"]);
("int", "file1", ((7, 20), (7, 23)), ["abbrev"])
("NameGetSet", "file1", ((7, 12), (7, 15)), ["member"; "setter"]);
("NameGet", "file1", ((10, 13), (10, 16)), ["member"; "getter"]);
("int", "file1", ((11, 20), (11, 23)), ["abbrev"])
("NameGet", "file1", ((11, 12), (11, 15)), ["member"; "setter"]);
("NameGetSet", "file1", ((5, 13), (5, 23)), ["member"; "getter"]);
("int", "file1", ((7, 20), (7, 23)), ["abbrev"]);
("NameGetSet", "file1", ((5, 13), (5, 23)), ["member"; "setter"]);
("NameGet", "file1", ((9, 13), (9, 20)), ["member"; "getter"]);
("int", "file1", ((11, 20), (11, 23)), ["abbrev"]);
("NameGet", "file1", ((9, 13), (9, 20)), ["member"; "setter"]);
("int", "file1", ((14, 21), (14, 24)), ["abbrev"]);
("NameSet", "file1", ((13, 13), (13, 20)), ["member"; "setter"]);
("StaticNameGetSet", "file1", ((16, 18), (16, 34)), ["member"; "getter"]);
("int", "file1", ((18, 20), (18, 23)), ["abbrev"])
("int", "file1", ((18, 20), (18, 23)), ["abbrev"]);
("StaticNameGetSet", "file1", ((16, 18), (16, 34)), ["member"; "setter"]);
("StaticNameGet", "file1", ((20, 18), (20, 31)), ["member"; "getter"]);
("int", "file1", ((22, 20), (22, 23)), ["abbrev"])
("int", "file1", ((22, 20), (22, 23)), ["abbrev"]);
("StaticNameGet", "file1", ((20, 18), (20, 31)), ["member"; "setter"]);
("int", "file1", ((25, 21), (25, 24)), ["abbrev"]);
("StaticNameSet", "file1", ((24, 18), (24, 31)), ["member"; "setter"]);
("AutoPropGet", "file1", ((27, 15), (27, 26)), ["member"; "getter"]);
("AutoPropGetSet", "file1", ((28, 39), (28, 42)), ["member"; "getter"])
("AutoPropGetSet", "file1", ((28, 44), (28, 47)), ["member"; "setter"]);
("AutoPropGetSet", "file1", ((28, 15), (28, 29)), ["member"; "getter"]);
("AutoPropGetSet", "file1", ((28, 15), (28, 29)), ["member"; "setter"]);
("StaticAutoPropGet", "file1", ((30, 22), (30, 39)), ["member"; "getter"]);
("StaticAutoPropGetSet", "file1", ((31, 52), (31, 55)),
["member"; "getter"])
("StaticAutoPropGetSet", "file1", ((31, 57), (31, 60)), ["member"; "setter"])
("NameGetSet", "file1", ((5, 13), (5, 23)), ["member"; "prop"])
("NameGet", "file1", ((9, 13), (9, 20)), ["member"; "prop"])
("StaticNameGetSet", "file1", ((16, 18), (16, 34)), ["member"; "prop"])
("StaticNameGet", "file1", ((20, 18), (20, 31)), ["member"; "prop"])
("AutoPropGetSet", "file1", ((28, 15), (28, 29)), ["member"; "prop"])
("StaticAutoPropGetSet", "file1", ((31, 22), (31, 42)), ["member"; "prop"])
("StaticAutoPropGetSet", "file1", ((31, 22), (31, 42)), ["member"; "getter"]);
("StaticAutoPropGetSet", "file1", ((31, 22), (31, 42)), ["member"; "setter"]);
("NameGetSet", "file1", ((5, 13), (5, 23)), ["member"; "prop"]);
("NameGet", "file1", ((9, 13), (9, 20)), ["member"; "prop"]);
("StaticNameGetSet", "file1", ((16, 18), (16, 34)), ["member"; "prop"]);
("StaticNameGet", "file1", ((20, 18), (20, 31)), ["member"; "prop"]);
("AutoPropGetSet", "file1", ((28, 15), (28, 29)), ["member"; "prop"]);
("StaticAutoPropGetSet", "file1", ((31, 22), (31, 42)), ["member"; "prop"]);
("x", "file1", ((5, 11), (5, 12)), []);
("int", "file1", ((7, 20), (7, 23)), ["abbrev"]);
("v", "file1", ((7, 17), (7, 18)), []);
("x", "file1", ((9, 11), (9, 12)), []);
("v", "file1", ((7, 17), (7, 18)), []); ("x", "file1", ((9, 11), (9, 12)), []);
("int", "file1", ((11, 20), (11, 23)), ["abbrev"]);
("v", "file1", ((11, 17), (11, 18)), []);
("x", "file1", ((13, 11), (13, 12)), []);
@@ -3604,11 +3592,11 @@ let ``Test symbol uses of properties with both getters and setters`` () =
("int", "file1", ((25, 21), (25, 24)), ["abbrev"]);
("v", "file1", ((25, 18), (25, 19)), []);
("``AutoPropGet@``", "file1", ((27, 15), (27, 26)), ["compgen"]);
("``AutoPropGetSet@``", "file1", ((28, 15), (28, 29)), ["compgen";"mutable"]);
("v", "file1", ((28, 44), (28, 47)), []);
("``AutoPropGetSet@``", "file1", ((28, 15), (28, 29)), ["compgen"; "mutable"]);
("v", "file1", ((28, 15), (28, 29)), []);
("``StaticAutoPropGet@``", "file1", ((30, 22), (30, 39)), ["compgen"]);
("``StaticAutoPropGetSet@``", "file1", ((31, 22), (31, 42)), ["compgen";"mutable"]);
("v", "file1", ((31, 57), (31, 60)), []);
("``StaticAutoPropGetSet@``", "file1", ((31, 22), (31, 42)),
["compgen"; "mutable"]); ("v", "file1", ((31, 22), (31, 42)), []);
("``.cctor``", "file1", ((4, 5), (4, 23)), ["member"]);
("TypeWithProperties", "file1", ((33, 9), (33, 27)), ["member"; "ctor"]);
("NameGetSet", "file1", ((33, 9), (33, 40)), ["member"; "prop"]);
@@ -3658,7 +3646,7 @@ let ``Test symbol uses of properties with both getters and setters`` () =

|> Array.map (fun s -> (Project24.cleanFileName s.FileName, tups s.Range))

usesOfGetSampleSymbol |> shouldEqual [|("file1", ((10, 13), (10, 16))); ("file1", ((9, 13), (9, 20))); ("file1", ((36, 9), (36, 37)))|]
usesOfGetSampleSymbol |> shouldEqual [|("file1", ((9, 13), (9, 20))); ("file1", ((36, 9), (36, 37)))|]

#if NO_CHECK_USE_OF_FSHARP_DATA_DLL
#endif