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

Commit 95e885c

Browse files
authored
Merge pull request #38 from alexeyt/alexeyt-update-hhast
Support and require hhvm and hhast 4.157
2 parents aa0fe7c + 4335722 commit 95e885c

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

.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.102'
16+
- '4.157'
1717
- latest
1818
- nightly
1919
runs-on: ${{matrix.os}}-latest

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
}
1212
},
1313
"require": {
14-
"hhvm": "^4.102",
14+
"hhvm": "^4.157",
1515
"hhvm/hhvm-autoload": "^2.0|^3.0",
1616
"hhvm/hsl": "^4.0",
1717
"hhvm/type-assert": "^3.2|^4.0",
18-
"hhvm/hhast": "^4.21.4"
18+
"hhvm/hhast": "^4.157"
1919
},
2020
"require-dev": {
2121
"facebook/fbexpect": "^2.6.1",

src/consumers/type_constant_from_ast.hack

+9-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ function type_constant_from_ast(
2020
$node->getModifiers()?->getChildren() ?? vec[],
2121
$t ==> $t is HHAST\AbstractToken,
2222
);
23+
if ($is_abstract) {
24+
// multiple type constraints are supported at the syntax level
25+
// but they do not typecheck yet; grab the first one for now
26+
$constraints = $node->getTypeConstraints()?->getChildren() ?? vec[];
27+
$typehint = C\first($constraints)?->getType();
28+
} else {
29+
$typehint = $node->getTypeSpecifier();
30+
}
2331
return (
2432
new ScannedTypeConstant(
2533
$node,
@@ -28,9 +36,7 @@ function type_constant_from_ast(
2836
/* docblock = */ null,
2937
typehint_from_ast(
3038
$context,
31-
$is_abstract
32-
? $node->getTypeConstraint()?->getType()
33-
: $node->getTypeSpecifier(),
39+
$typehint,
3440
),
3541
$is_abstract
3642
? AbstractnessToken::IS_ABSTRACT

0 commit comments

Comments
 (0)