Add module declaration type checking
[hiphop-php.git] / hphp / hack / test / typecheck / modules / module_methods_basic.php
blobccb1eb1d6e38e3c5261bdade35a5ef57e8ebc415
1 //// modules.php
2 <?hh
3 <<file:__EnableUnstableFeatures('modules')>>
5 module A {}
6 module B {}
7 //// A.php
8 <?hh
9 // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
10 <<file:__EnableUnstableFeatures('modules'), __Module('A')>>
12 class A {
13 <<__Internal>>
14 public function f(): void {}
16 public function g(): void { $this->f(); /* ok */ }
20 function a(A $a): void { $a->f(); /* ok */ }
22 //// B.php
23 <?hh
24 // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
25 <<file:__EnableUnstableFeatures('modules'), __Module('B')>>
27 class B {
28 public function f(A $a): void {
29 $a->f(); // error
33 function b(A $a): void { $a->f(); /* error */ }
35 //// main.php
36 <?hh
37 function main(A $a): void { $a->f(); /* error */ }