No error on use of `unsafe_cast`
[hiphop-php.git] / hphp / hack / test / typecheck / arithmetic_any.php
blob025e2ff0c9ce6d573516d79f2cabc75e46c4c95c
1 ////file1.php
2 <?hh // partial
4 function returnsAny() { return 5; }
6 ////file2.php
7 <?hh // strict
9 // ADDITION
10 function doAddIntAny(int $x): void {
11 $y = $x + returnsAny();
12 hh_show($y);
15 function doAddAnyInt(int $x): void {
16 $y = returnsAny() + $x;
17 hh_show($y);
20 function doAddFloatAny(float $x): void {
21 $y = $x + returnsAny();
22 hh_show($y);
25 function doAddAnyFloat(float $x): void {
26 $y = returnsAny() + $x;
27 hh_show($y);
30 function doAddAnyAny(): void {
31 $y = returnsAny() + returnsAny();
32 hh_show($y);
35 function doAddNumAny(num $x): void {
36 $y = $x + returnsAny();
37 hh_show($y);
40 function doAddAnyNum(num $x): void {
41 $y = returnsAny() + $x;
42 hh_show($y);
45 // DIVISION
46 function doDivAnyFloat(float $x): void {
47 $y = returnsAny() / 2.0;
48 hh_show($y);
51 function doDivFloatAny(float $x): void {
52 $y = 2.0 / returnsAny();
53 hh_show($y);
56 function doDivAnyAny(): void {
57 $y = returnsAny() / returnsAny();
58 hh_show($y);
62 function doDivAnyInt(int $x): void {
63 $y = returnsAny() / $x;
64 hh_show($y);
67 function doDivIntAny(int $x): void {
68 $y = $x / returnsAny();
69 hh_show($y);
72 function sorted<T>(
73 Traversable<T> $collection,
74 ?(function(T, T): int) $comparator = null,
75 ): Vector<T> {
76 return Vector {};
79 function TestSort():void {
80 $v = sorted(varray[],
81 function ($x, $y) { hh_show($x); hh_show($y); return $x - $y; });
84 function TestUnion(?int $x, bool $b):void {
85 if ($b) {
86 $x = 3;
88 /* HH_FIXME[4110] */
89 $y = $x - returnsAny();
90 hh_show($y);
93 function doMulIntFloat(int $x, float $y): void {
94 $z = $x * $y;
95 hh_show($z);