Permalink
Browse files

Fix an hhbbc crash with late-init trait properties

Summary:
The code was checking for properties that need dynamic initialization
by checking for KindOfUninit. LateInit props also have KindOfUninit,
but don't need dynamic initialization.

Reviewed By: leikahing

Differential Revision: D10121291

fbshipit-source-id: 0c1abc576952a07d38a72b17faead25350c35b92
  • Loading branch information...
markw65 authored and hhvm-bot committed Sep 30, 2018
1 parent f72f0ac commit 81018972a1c74a0fde4ddea0bc2d9448d0fed955
@@ -2117,7 +2117,9 @@ bool merge_xinits(Attr attr,
auto const needsXinit = [&] {
for (auto const& p : cinfo->traitProps) {
if (xinitMatch(p.attrs) && p.val.m_type == KindOfUninit) {
if (xinitMatch(p.attrs) &&
p.val.m_type == KindOfUninit &&
!(p.attrs & AttrLateInit)) {
ITRACE(5, "merge_xinits: {}: Needs merge for {}{}prop `{}'\n",
cls->name, attr & AttrStatic ? "static " : "",
attr & AttrLSB ? "lsb " : "", p.name);
@@ -2162,9 +2164,7 @@ bool merge_xinits(Attr attr,
}
}
// TODO reimplement assertion check after fixing T34583281
//assertx(xinit);
if (!xinit) return true;
assertx(xinit);
if (empty) {
ITRACE(5, "merge_xinits: adding {}::{} to method table\n",
xinit->cls->name, xinit->name);
@@ -0,0 +1,11 @@
<?hh
trait T {
<<__LateInit>> public property $p;
};
class C {
use T;
}
echo "OK\n";

0 comments on commit 8101897

Please sign in to comment.