Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
Fix Node::__construct $children type
Browse files Browse the repository at this point in the history
Hack now typechecks XHP constructors (facebook/hhvm@af6f350)
which revealed this error.
  • Loading branch information
jjergus committed Feb 18, 2021
1 parent 074b88b commit 7d2d31e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/Node.hack
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ abstract xhp class node implements \XHPChild {
*/
final public function __construct(
KeyedTraversable<string, mixed> $attributes,
Traversable<\XHPChild> $children,
Traversable<?\XHPChild> $children,
dynamic ...$debug_info
) {
invariant(
Expand Down
5 changes: 5 additions & 0 deletions tests/BasicsTest.hack
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ class BasicsTest extends Facebook\HackTest\HackTest {
expect(await $xhp->toStringAsync())->toEqual('<div>herpderp</div>');
}

public async function testScalarChildren(): Awaitable<void> {
$xhp = <div>{42}{' str '}{3.14}{null}</div>;
expect(await $xhp->toStringAsync())->toEqual('<div>42 str 3.14</div>');
}

public async function testEscaping(): Awaitable<void> {
$xhp = <div>{'foo<SCRIPT>bar'}</div>;
expect(await $xhp->toStringAsync())->toEqual(
Expand Down

0 comments on commit 7d2d31e

Please sign in to comment.