You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Eliminate intermediate flow provenance when reporting Arith_ret_[XXX] errors
Summary: Ensures that the claim for `Arith_ret_[XXX]` errors is the same under extended reasons by traversing to the first element of a flow appearing inside one of these reasons.
Reviewed By: madgen
Differential Revision: D63456760
fbshipit-source-id: 6eea7b60b7634e7046d4b688a0b37caec7033a4a
Copy file name to clipboardExpand all lines: hphp/hack/test/extended_reasons/num.php.debug.exp
-126Lines changed: 0 additions & 126 deletions
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,6 @@ error: Typing[4110] Invalid return type
2
2
3
3
File "num.php", line 9, character 10 - line 9, character 15:
4
4
5
-
5 | $x = 5 + $x;
6
-
6 | $x = $x + 5;
7
-
7 | $x = 5 + $x;
8
5
8 | $x = 5 + $x;
9
6
9 | return »5 + $x«;
10
7
10 | }
@@ -16,82 +13,22 @@ File "num.php", line 3, character 23 - line 3, character 28:
16
13
3 | function foo(num $n): »string« {
17
14
4 | $x = 5 + $n;
18
15
5 | $x = 5 + $x;
19
-
6 | $x = $x + 5;
20
-
7 | $x = 5 + $x;
21
16
22
17
But got `float` because this is the result of an arithmetic operation with a `num` as the second argument, and no `float`s.
23
18
24
19
File "num.php", line 9, character 10 - line 9, character 15:
25
20
26
-
5 | $x = 5 + $x;
27
-
6 | $x = $x + 5;
28
-
7 | $x = 5 + $x;
29
21
8 | $x = 5 + $x;
30
22
9 | return »5 + $x«;
31
23
10 | }
32
24
33
-
Here is why I think the argument is a `num`: this is a `num` because this is the result of an arithmetic operation with a `num` as the second argument, and no `float`s.
34
-
35
-
File "num.php", line 8, character 8 - line 8, character 13:
36
-
37
-
5 | $x = 5 + $x;
38
-
6 | $x = $x + 5;
39
-
7 | $x = 5 + $x;
40
-
8 | $x = »5 + $x«;
41
-
9 | return 5 + $x;
42
-
10 | }
43
-
44
-
Here is why I think the argument is a `num`: this is a `num` because this is the result of an arithmetic operation with a `num` as the second argument, and no `float`s.
45
-
46
-
File "num.php", line 7, character 8 - line 7, character 13:
47
-
48
-
5 | $x = 5 + $x;
49
-
6 | $x = $x + 5;
50
-
7 | $x = »5 + $x«;
51
-
8 | $x = 5 + $x;
52
-
9 | return 5 + $x;
53
-
10 | }
54
-
55
-
Here is why I think the argument is a `num`: this is a `num` because this is the result of an arithmetic operation with a `num` as the first argument, and no `float`s.
56
-
57
-
File "num.php", line 6, character 8 - line 6, character 13:
58
-
59
-
5 | $x = 5 + $x;
60
-
6 | $x = »$x + 5«;
61
-
7 | $x = 5 + $x;
62
-
8 | $x = 5 + $x;
63
-
9 | return 5 + $x;
64
-
10 | }
65
-
66
-
Here is why I think the argument is a `num`: this is a `num` because this is the result of an arithmetic operation with a `num` as the second argument, and no `float`s.
67
-
68
-
File "num.php", line 5, character 8 - line 5, character 13:
69
-
70
-
3 | function foo(num $n): string {
71
-
4 | $x = 5 + $n;
72
-
5 | $x = »5 + $x«;
73
-
6 | $x = $x + 5;
74
-
7 | $x = 5 + $x;
75
-
76
-
Here is why I think the argument is a `num`: this is a `num` because this is the result of an arithmetic operation with a `num` as the second argument, and no `float`s.
77
-
78
-
File "num.php", line 4, character 8 - line 4, character 13:
79
-
80
-
3 | function foo(num $n): string {
81
-
4 | $x = »5 + $n«;
82
-
5 | $x = 5 + $x;
83
-
6 | $x = $x + 5;
84
-
7 | $x = 5 + $x;
85
-
86
25
Here is why I think the argument is a `num`: this is a `num`
87
26
88
27
File "num.php", line 3, character 14 - line 3, character 16:
89
28
90
29
3 | function foo(»num« $n): string {
91
30
4 | $x = 5 + $n;
92
31
5 | $x = 5 + $x;
93
-
6 | $x = $x + 5;
94
-
7 | $x = 5 + $x;
95
32
96
33
Derivation:
97
34
{
@@ -747,9 +684,6 @@ error: Typing[4110] Invalid return type
747
684
748
685
File "num.php", line 9, character 10 - line 9, character 15:
749
686
750
-
5 | $x = 5 + $x;
751
-
6 | $x = $x + 5;
752
-
7 | $x = 5 + $x;
753
687
8 | $x = 5 + $x;
754
688
9 | return »5 + $x«;
755
689
10 | }
@@ -761,82 +695,22 @@ File "num.php", line 3, character 23 - line 3, character 28:
761
695
3 | function foo(num $n): »string« {
762
696
4 | $x = 5 + $n;
763
697
5 | $x = 5 + $x;
764
-
6 | $x = $x + 5;
765
-
7 | $x = 5 + $x;
766
698
767
699
But got `int` because this is the result of an arithmetic operation with a `num` as the second argument, and no `float`s.
768
700
769
701
File "num.php", line 9, character 10 - line 9, character 15:
770
702
771
-
5 | $x = 5 + $x;
772
-
6 | $x = $x + 5;
773
-
7 | $x = 5 + $x;
774
703
8 | $x = 5 + $x;
775
704
9 | return »5 + $x«;
776
705
10 | }
777
706
778
-
Here is why I think the argument is a `num`: this is a `num` because this is the result of an arithmetic operation with a `num` as the second argument, and no `float`s.
779
-
780
-
File "num.php", line 8, character 8 - line 8, character 13:
781
-
782
-
5 | $x = 5 + $x;
783
-
6 | $x = $x + 5;
784
-
7 | $x = 5 + $x;
785
-
8 | $x = »5 + $x«;
786
-
9 | return 5 + $x;
787
-
10 | }
788
-
789
-
Here is why I think the argument is a `num`: this is a `num` because this is the result of an arithmetic operation with a `num` as the second argument, and no `float`s.
790
-
791
-
File "num.php", line 7, character 8 - line 7, character 13:
792
-
793
-
5 | $x = 5 + $x;
794
-
6 | $x = $x + 5;
795
-
7 | $x = »5 + $x«;
796
-
8 | $x = 5 + $x;
797
-
9 | return 5 + $x;
798
-
10 | }
799
-
800
-
Here is why I think the argument is a `num`: this is a `num` because this is the result of an arithmetic operation with a `num` as the first argument, and no `float`s.
801
-
802
-
File "num.php", line 6, character 8 - line 6, character 13:
803
-
804
-
5 | $x = 5 + $x;
805
-
6 | $x = »$x + 5«;
806
-
7 | $x = 5 + $x;
807
-
8 | $x = 5 + $x;
808
-
9 | return 5 + $x;
809
-
10 | }
810
-
811
-
Here is why I think the argument is a `num`: this is a `num` because this is the result of an arithmetic operation with a `num` as the second argument, and no `float`s.
812
-
813
-
File "num.php", line 5, character 8 - line 5, character 13:
814
-
815
-
3 | function foo(num $n): string {
816
-
4 | $x = 5 + $n;
817
-
5 | $x = »5 + $x«;
818
-
6 | $x = $x + 5;
819
-
7 | $x = 5 + $x;
820
-
821
-
Here is why I think the argument is a `num`: this is a `num` because this is the result of an arithmetic operation with a `num` as the second argument, and no `float`s.
822
-
823
-
File "num.php", line 4, character 8 - line 4, character 13:
824
-
825
-
3 | function foo(num $n): string {
826
-
4 | $x = »5 + $n«;
827
-
5 | $x = 5 + $x;
828
-
6 | $x = $x + 5;
829
-
7 | $x = 5 + $x;
830
-
831
707
Here is why I think the argument is a `num`: this is a `num`
832
708
833
709
File "num.php", line 3, character 14 - line 3, character 16:
0 commit comments