Add module declaration type checking
[hiphop-php.git] / hphp / hack / test / typecheck / modules / module_hint.php
blob0121ec3f3b7f5d9339e49b0753d164a1407688bb
1 //// modules.php
2 <?hh
3 <<file:__EnableUnstableFeatures('modules')>>
5 module here {}
6 module there {}
7 //// here.php
8 <?hh
9 // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
10 <<file:__EnableUnstableFeatures('modules'), __Module('here')>>
12 <<__Internal>>
13 class C {
14 public function bar(mixed $m):void {
15 // All not ok
16 $m as D;
17 $m as G<_>;
18 $m as (D,int);
19 $m is D;
20 $m is G<_>;
21 $m is (D,int);
22 $m as E;
23 $m is E;
24 genfun<D>(null);
25 $x = vec<D>[];
26 $x = new MyList<D>();
27 // All ok
28 $m as C;
29 $m is C;
33 //// there.php
34 <?hh
35 // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
36 <<file:__EnableUnstableFeatures('modules'), __Module('there')>>
38 <<__Internal>>
39 class D {
41 <<__Internal>>
42 class G<T> {
44 <<__Internal>>
45 enum E : int {
46 A = 1;
49 //// everywhere.php
50 <?hh
51 // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
53 function genfun<T>(?T $x):?T { return $x; }
55 class MyList<T> { }