Add declarations for internal keyword in direct decl and legacy parsers
[hiphop-php.git] / hphp / hack / test / typecheck / modules / module_enums.php
blobf93d854872a2184595b6e0cd77c92b074f4cabb1
1 //// modules.php
2 <?hh
3 <<file:__EnableUnstableFeatures('modules')>>
5 module X {}
6 module Y {}
7 //// X.php
8 <?hh
9 // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
10 <<file:__EnableUnstableFeatures('modules'), __Module('X')>>
12 <<__Internal>>
13 enum X: int {
14 A = 0;
15 B = 1;
16 C = 2;
19 <<__Internal>>
20 function f1(X $x): void {} // ok
22 function f2(X $x): void {} // error
24 <<__Internal>>
25 function f5(): void {
26 $x = X::A; // ok
29 function f6(): void {
30 $x = X::A; // ok
34 //// Y.php
35 <?hh
36 // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
37 <<file:__EnableUnstableFeatures('modules'), __Module('Y')>>
39 function f3(X $x): void {} // error
41 function f7(): void {
42 $x = X::A; // error
45 //// no-module.php
46 <?hh
47 // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
49 function f4(X $x): void {} // error
51 function f8(): void {
52 $x = X::A; // error