Fix AttrNoImplicitNullable inference in HHBBC
commitb7e358d59cf9f1f26f96378609a071709edce62b
authorRick Lavoie <rlavoie@fb.com>
Thu, 3 Jan 2019 06:39:58 +0000 (2 22:39 -0800)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Thu, 3 Jan 2019 06:42:56 +0000 (2 22:42 -0800)
treeea705dc5f1e00a7f764f255e3caeee838b04a31e
parentd4cfe583b2dcac9009d163431ccab599f150546f
Fix AttrNoImplicitNullable inference in HHBBC

Summary:
The algorithm was ignoring static or private properties entirely (because those
cannot be overridden). This ignores the fact that even for static or private
properties, the JIT uses AttrNoImplicitNullable to determine whether InitNull
needs to be unioned into the assumed type of a property. Therefore, properties
which need the "implicit null" (like ones that hold collections) would not
receive it, causing assertions and crashed when hard prop type-hint enforcement
is enabled.

Fix this by not setting AttrNoImplicitNullable if the property has a system
initial value which is KindOfNull, regardless of whether its static or private.

Reviewed By: markw65

Differential Revision: D13568847

fbshipit-source-id: 1d1bf32ffb2e981cf347688b8ba3cc863aafb00c
hphp/hhbbc/index.cpp
hphp/runtime/vm/class.cpp
hphp/test/slow/prop-type-hints/implicit-nullable.php [new file with mode: 0644]
hphp/test/slow/prop-type-hints/implicit-nullable.php.expect [new file with mode: 0644]
hphp/test/slow/prop-type-hints/implicit-nullable.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/prop-type-hints/implicit-nullable.php.opts [new file with mode: 0644]