From c5ecd7328d94c34e20a617091d9f4f094a1b6d3d Mon Sep 17 00:00:00 2001 From: Fred Emmott Date: Wed, 19 Feb 2020 10:53:59 -0800 Subject: [PATCH] Child validation: support `x:composable-element`, not just `x:element` (#217) This makes it possible to use these traits for HTML tags etc Test plan: ``` fredemmott@fredemmott-mm1 xhp-lib % ~/code/hhast/bin/hhast-migrate --add-xhp-children-declaration-method src fredemmott@fredemmott-mm1 xhp-lib % hh_client No errors! fredemmott@fredemmott-mm1 xhp-lib % vendor/bin/hacktest tests ...............................................................................S.SSS.S.S.....................SSSS......SS.... Summary: 125 test(s), 113 passed, 0 failed, 12 skipped, 0 error(s). fredemmott@fredemmott-mm1 xhp-lib % git diff src | gist -t patch https://gist.github.com/6dafcf73169756cc80078d2e765ada2c ``` Tests fail without this change. That is with https://github.com/hhvm/hhast/pull/268 --- src/children/XHPChildDeclarationConsistencyValidation.hack | 2 +- src/children/XHPChildValidation.hack | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/children/XHPChildDeclarationConsistencyValidation.hack b/src/children/XHPChildDeclarationConsistencyValidation.hack index 9a016b50..8010ed4e 100644 --- a/src/children/XHPChildDeclarationConsistencyValidation.hack +++ b/src/children/XHPChildDeclarationConsistencyValidation.hack @@ -11,7 +11,7 @@ use namespace \Facebook\XHP\ChildValidation as XHPChild; /** Verify that a new child declaration matches the legacy codegen. */ trait XHPChildDeclarationConsistencyValidation { - require extends :x:element; + require extends :x:composable-element; abstract protected static function getChildrenDeclaration( ): XHPChild\Constraint; diff --git a/src/children/XHPChildValidation.hack b/src/children/XHPChildValidation.hack index b2c73537..a27b438a 100644 --- a/src/children/XHPChildValidation.hack +++ b/src/children/XHPChildValidation.hack @@ -11,7 +11,7 @@ use namespace \Facebook\XHP\ChildValidation as XHPChild; /** Verify that a new child declaration matches the legacy codegen. */ trait XHPChildValidation { - require extends :x:element; + require extends :x:composable-element; abstract protected static function getChildrenDeclaration( ): XHPChild\Constraint;