Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit c26866a

Browse files
authored
Require and support hhast 4.158 (#36)
* Require hhvm 4.158 * The hsl is always built-in. * ext_watchman and HH\Facts are always available. * varray eq vec and darray eq dict is always true. * Parsing for varray and darray remains supported. * Update CI to 4.158 * Support autoloading with ext_watchman * Fix lint * Drop scanning for trait conflict resolutions * They have been removed from Hack
1 parent 95e885c commit c26866a

12 files changed

+32
-49
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
tests/ export-ignore
22
bin/ export-ignore
33
.hhconfig export-ignore
4+
.hhvmconfig.hdf export-ignore
45
*.hack linguist-language=Hack

.github/workflows/build-and-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
matrix:
1414
os: [ ubuntu ]
1515
hhvm:
16-
- '4.157'
16+
- '4.158'
1717
- latest
1818
- nightly
1919
runs-on: ${{matrix.os}}-latest

.hhvmconfig.hdf

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Autoload {
2+
Query = {"expression": ["allof", ["type", "f"], ["suffix", ["anyof", "hack", "php"]], ["not",["anyof",["dirname",".var"],["dirname",".git"]]]]}
3+
}

composer.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@
1111
}
1212
},
1313
"require": {
14-
"hhvm": "^4.157",
15-
"hhvm/hhvm-autoload": "^2.0|^3.0",
16-
"hhvm/hsl": "^4.0",
14+
"hhvm": "^4.158",
1715
"hhvm/type-assert": "^3.2|^4.0",
18-
"hhvm/hhast": "^4.157"
16+
"hhvm/hhast": "^4.158"
1917
},
2018
"require-dev": {
19+
"hhvm/hhvm-autoload": "^2.0|^3.0",
2120
"facebook/fbexpect": "^2.6.1",
2221
"hhvm/hacktest": "^2.0"
2322
},

hh_autoload.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
],
55
"devRoots": [
66
"tests/"
7-
]
7+
],
8+
"useFactsIfAvailable": true
89
}

src/consumers/scope_from_ast_and_ns.hack

+2-8
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,10 @@ function scope_from_ast_and_ns(
5454
$ast->getChildrenOfType(HHAST\MethodishDeclaration::class),
5555
$node ==> method_from_ast($context, $node),
5656
),
57-
/* trait use statements = */ Vec\concat(
58-
Vec\map(
57+
/* trait use statements = */ Vec\map(
5958
$ast->getChildrenOfType(HHAST\TraitUse::class),
6059
$node ==> $node->getNames()->getChildrenOfType(HHAST\Node::class),
61-
),
62-
Vec\map(
63-
$ast->getChildrenOfType(HHAST\TraitUseConflictResolution::class),
64-
$node ==> $node->getNames()->getChildrenOfType(HHAST\Node::class),
65-
),
66-
)
60+
)
6761
|> Vec\flatten($$)
6862
|> Vec\map($$, $node ==> typehint_from_ast($context, $node))
6963
|> Vec\filter_nulls($$),

src/expression/StaticDarrayExpression.hack

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ namespace Facebook\DefinitionFinder\Expression;
1111

1212
use namespace Facebook\HHAST;
1313

14-
final class StaticDarrayExpression extends Expression<darray<arraykey, mixed>> {
14+
final class StaticDarrayExpression extends Expression<dict<arraykey, mixed>> {
1515
const type TNode = HHAST\DarrayIntrinsicExpression;
1616

1717
<<__Override>>
1818
protected static function matchImpl(
1919
this::TNode $node,
20-
): ?Expression<darray<arraykey, mixed>> {
20+
): ?Expression<dict<arraykey, mixed>> {
2121
$members = $node->getMembers();
2222
$members = $members?->getChildrenOfItemsOfType(HHAST\Node::class) ?? vec[];
23-
$ret = darray[];
23+
$ret = dict[];
2424
foreach ($members as $m) {
2525
$pair = StaticElementInitializerExpression::match($m);
2626
if ($pair === null) {

src/expression/StaticListExpression.hack

+1-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ final class StaticListExpression extends Expression<vec<mixed>> {
1818
protected static function matchImpl(
1919
HHAST\NodeList<HHAST\ListItem<HHAST\Node>> $n,
2020
): ?Expression<vec<mixed>> {
21-
$items = Vec\map(
22-
$n->getChildrenOfItems(),
23-
StaticExpression::match<>,
24-
);
21+
$items = Vec\map($n->getChildrenOfItems(), StaticExpression::match<>);
2522
$out = vec[];
2623
foreach ($items as $item) {
2724
if ($item === null) {

src/expression/StaticShapeExpression.hack

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ namespace Facebook\DefinitionFinder\Expression;
1111

1212
use namespace Facebook\HHAST;
1313

14-
final class StaticShapeExpression extends Expression<darray<arraykey, mixed>> {
14+
final class StaticShapeExpression extends Expression<dict<arraykey, mixed>> {
1515
const type TNode = HHAST\ShapeExpression;
1616

1717
<<__Override>>
1818
protected static function matchImpl(
1919
this::TNode $node,
20-
): ?Expression<darray<arraykey, mixed>> {
20+
): ?Expression<dict<arraykey, mixed>> {
2121
$members = $node->getFields();
2222
$members = $members?->getChildrenOfItemsOfType(HHAST\Node::class) ?? vec[];
23-
$ret = darray[];
23+
$ret = dict[];
2424
foreach ($members as $m) {
2525
$pair = StaticFieldInitializerExpression::match($m);
2626
if ($pair === null) {

src/expression/StaticVarrayExpression.hack

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ namespace Facebook\DefinitionFinder\Expression;
1111

1212
use namespace Facebook\HHAST;
1313

14-
final class StaticVarrayExpression extends Expression<varray<mixed>> {
14+
final class StaticVarrayExpression extends Expression<vec<mixed>> {
1515
const type TNode = HHAST\VarrayIntrinsicExpression;
1616

1717
<<__Override>>
1818
protected static function matchImpl(
1919
this::TNode $node,
20-
): ?Expression<varray<mixed>> {
20+
): ?Expression<vec<mixed>> {
2121
$m = $node->getMembers();
2222
if ($m === null) {
23-
return new self(varray[]);
23+
return new self(vec[]);
2424
}
2525
$values = StaticListExpression::match($m);
2626
if ($values === null) {
2727
return null;
2828
}
29-
$out = varray[];
29+
$out = vec[];
3030
foreach ($values->getValue() as $value) {
3131
$out[] = $value;
3232
}

tests/AttributesTest.hack

+9-9
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,16 @@ class AttributesTest extends \Facebook\HackTest\HackTest {
111111
tuple('INF', \INF),
112112
tuple('+123', 123),
113113
tuple('-123', -123),
114-
tuple('varray[]', varray[]),
115-
tuple('varray[123]', varray[123]),
116-
tuple('varray[123,]', varray[123]),
117-
tuple('varray[123,456]', varray[123, 456]),
118-
tuple('varray[123,456,]', varray[123, 456]),
114+
tuple('varray[]', vec[]),
115+
tuple('varray[123]', vec[123]),
116+
tuple('varray[123,]', vec[123]),
117+
tuple('varray[123,456]', vec[123, 456]),
118+
tuple('varray[123,456,]', vec[123, 456]),
119119
tuple('1.23', 1.23),
120-
tuple('varray[123,456]', varray[123, 456]),
121-
tuple('varray[123 , 456]', varray[123, 456]),
122-
tuple('darray[123 => 456]', darray[123 => 456]),
123-
tuple('shape()', darray[]),
120+
tuple('varray[123,456]', vec[123, 456]),
121+
tuple('varray[123 , 456]', vec[123, 456]),
122+
tuple('darray[123 => 456]', dict[123 => 456]),
123+
tuple('shape()', dict[]),
124124
tuple(
125125
'shape("foo" => "bar", "herp" => 123)',
126126
shape('foo' => 'bar', 'herp' => 123),

tests/RelationshipsTest.hack

-12
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,6 @@ class RelationshipsTest extends \Facebook\HackTest\HackTest {
9090
expect($def->getTraitNames())->toBeSame(vec['Herp', 'Derp']);
9191
}
9292

93-
public async function testUseTraitWithConflictResolution(): Awaitable<void> {
94-
$data = "<?hh\n".
95-
"class MyClass {\n".
96-
" use Foo, Bar {\n".
97-
" Foo::herp insteadof Bar;\n".
98-
" Bar::herp as derp;\n".
99-
" };\n".
100-
'}';
101-
$def = (await FileParser::fromDataAsync($data))->getClass('MyClass');
102-
expect($def->getTraitNames())->toBeSame(vec['Foo', 'Bar']);
103-
}
104-
10593
public async function testUsesTraitsInNamespace(): Awaitable<void> {
10694
$data =
10795
"<?hh\n".'namespace MyNamespace;'.'class Foo { use Herp; use Derp; }';

0 commit comments

Comments
 (0)