Skip to content

Commit 9003f60

Browse files
committed
Example.
1 parent 210ead3 commit 9003f60

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

examples/deadcode/src/Exn.bs.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/deadcode/src/Exn.re

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,14 @@ let wrongCatch2 = b =>
6161
| exception A => ()
6262
| exception B => ()
6363
| [] => ()
64-
};
64+
};
65+
66+
[@raises (A, B, C)]
67+
let raise2Annotate3 = (x, y) => {
68+
if (x) {
69+
raise(A);
70+
};
71+
if (y) {
72+
raise(B);
73+
};
74+
};

examples/deadcode/src/deadcode.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,7 @@
10881088
addValueDeclaration +sequencing Exn.re:46:4 path:+Exn
10891089
addValueDeclaration +wrongCatch Exn.re:53:4 path:+Exn
10901090
addValueDeclaration +wrongCatch2 Exn.re:59:4 path:+Exn
1091+
addValueDeclaration +raise2Annotate3 Exn.re:67:4 path:+Exn
10911092
addValueReference Exn.re:22:4 --> Exn.re:20:4
10921093
addValueReference Exn.re:25:4 --> Exn.re:20:4
10931094
addValueReference Exn.re:29:4 --> Exn.re:29:22
@@ -1101,6 +1102,10 @@
11011102
addTypeReference Exn.re:60:31 --> Exn.re:58:10
11021103
addTypeReference Exn.re:60:20 --> Exn.re:35:10
11031104
addValueReference Exn.re:59:4 --> Exn.re:59:18
1105+
addTypeReference Exn.re:72:10 --> Exn.re:35:10
1106+
addValueReference Exn.re:67:4 --> Exn.re:67:26
1107+
addTypeReference Exn.re:69:10 --> Exn.re:34:10
1108+
addValueReference Exn.re:67:4 --> Exn.re:67:23
11041109
Scanning /Users/cristianoc/reasonml/reanalyze/examples/deadcode/lib/bs/src/ImmutableArray.cmti
11051110
addValueDeclaration +get ImmutableArray.rei:5:15 path:ImmutableArray.Array
11061111
addValueDeclaration +fromArray ImmutableArray.rei:7:0 path:ImmutableArray
@@ -1910,6 +1915,7 @@ File References
19101915
Live Value +EverythingLiveHere.+z: 0 references () [0]
19111916
Live Value +EverythingLiveHere.+y: 0 references () [0]
19121917
Live Value +EverythingLiveHere.+x: 0 references () [0]
1918+
Dead Value +Exn.+raise2Annotate3: 0 references () [0]
19131919
Dead Value +Exn.+wrongCatch2: 0 references () [0]
19141920
Dead Value +Exn.+wrongCatch: 0 references () [0]
19151921
Dead Value +Exn.+sequencing: 0 references () [0]
@@ -2925,6 +2931,12 @@ File References
29252931
<-- line 59
29262932
[@dead "+wrongCatch2"] let wrongCatch2 = b =>
29272933

2934+
Warning Dead Value
2935+
File "/Users/cristianoc/reasonml/reanalyze/examples/deadcode/src/Exn.re", line 66, characters 0-115
2936+
+raise2Annotate3 is never used
2937+
<-- line 67
2938+
[@dead "+raise2Annotate3"] [@raises (A, B, C)]
2939+
29282940
Warning Dead Type
29292941
File "/Users/cristianoc/reasonml/reanalyze/examples/deadcode/src/FirstClassModulesInterface.re", line 2, characters 2-8
29302942
record.x is a record label never used to read a value

examples/deadcode/src/exception.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@
3838
Exception Analysis
3939
File "/Users/cristianoc/reasonml/reanalyze/examples/deadcode/src/Exn.re", line 59, characters 4-15
4040
wrongCatch2 might raise C Match_failure and is not annotated with @raises C Match_failure
41+
42+
Exception Analysis
43+
File "/Users/cristianoc/reasonml/reanalyze/examples/deadcode/src/Exn.re", line 67, characters 4-19
44+
raise2Annotate3 might raise A B and is annotated with redundant @raises C

0 commit comments

Comments
 (0)