Skip to content

Commit

Permalink
Add Hash Comment Option to Repo Options
Browse files Browse the repository at this point in the history
Summary: When the disallow hash comments option is enabled, the runtime flag is not used to set the getFactsOptions bit which results in the setting not being passed to the facts parser.

Reviewed By: DavidSnider

Differential Revision: D31357394

fbshipit-source-id: 80a1bc276d5ad88fdf5c96403384941f9517a4d4
  • Loading branch information
Brett Chik authored and facebook-github-bot committed Oct 4, 2021
1 parent 5f5df6c commit ef20c5e
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hphp/runtime/base/runtime-option.cpp
Expand Up @@ -341,7 +341,8 @@ std::uint32_t RepoOptions::getFactsFlags() const {
1 << 1 | //hhvm_compat_mode
AllowNewAttributeSyntax << 2 |
EnableXHPClassModifier << 3 |
DisableXHPElementMangling << 4;
DisableXHPElementMangling << 4 |
DisallowHashComments << 5;
return flags;
}

Expand Down
22 changes: 22 additions & 0 deletions hphp/test/slow/enum_class/label_facts.php
@@ -0,0 +1,22 @@
<?hh
<<file:__EnableUnstableFeatures('enum_class_label')>>

enum class Something: mixed {
mixed a = 5;
}

function afunction(): void {
my_function(#a);
}

function my_function(
HH\EnumClass\Label<Something, mixed> $param,
): void {
echo "Hello, world.\n";
}

<<__EntryPoint>>
function main_hashbang() {
var_dump(HH\facts_parse(NULL, vec[__FILE__], true, true));
afunction();
}
39 changes: 39 additions & 0 deletions hphp/test/slow/enum_class/label_facts.php.expectf
@@ -0,0 +1,39 @@
dict(1) {
["%s/label_facts.php"]=>
dict(7) {
["constants"]=>
vec(0) {
}
["functions"]=>
vec(3) {
string(9) "afunction"
string(11) "my_function"
string(13) "main_hashbang"
}
["md5sum0"]=>
int(%s)
["md5sum1"]=>
int(%s)
["sha1sum"]=>
string(40) "%s"
["typeAliases"]=>
vec(0) {
}
["types"]=>
vec(1) {
dict(4) {
["baseTypes"]=>
vec(1) {
string(19) "HH\BuiltinEnumClass"
}
["flags"]=>
int(0)
["kindOf"]=>
string(4) "enum"
["name"]=>
string(9) "Something"
}
}
}
}
Hello, world.
2 changes: 2 additions & 0 deletions hphp/test/slow/enum_class/label_facts.php.hphp_opts
@@ -0,0 +1,2 @@
-vRuntime.Hack.Lang.AllowUnstableFeatures=1
-vRuntime.Hack.Lang.DisallowHashComments=1
Empty file.
2 changes: 2 additions & 0 deletions hphp/test/slow/enum_class/label_facts.php.opts
@@ -0,0 +1,2 @@
-vHack.Lang.AllowUnstableFeatures=1
-vHack.Lang.DisallowHashComments=1
6 changes: 6 additions & 0 deletions hphp/test/slow/hash_comment_facts.php
@@ -0,0 +1,6 @@
<?hh

<<__EntryPoint>>
function main_hashbang() {
var_dump(HH\facts_parse(__DIR__, vec['hash_comment.php'], true, true));
}
4 changes: 4 additions & 0 deletions hphp/test/slow/hash_comment_facts.php.expectf
@@ -0,0 +1,4 @@
dict(1) {
["hash_comment.php"]=>
NULL
}
1 change: 1 addition & 0 deletions hphp/test/slow/hash_comment_facts.php.hphp_opts
@@ -0,0 +1 @@
-vRuntime.Hack.Lang.DisallowHashComments=1
Empty file.
1 change: 1 addition & 0 deletions hphp/test/slow/hash_comment_facts.php.opts
@@ -0,0 +1 @@
-vHack.Lang.DisallowHashComments=1

0 comments on commit ef20c5e

Please sign in to comment.