Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix AttrSystemInitialValue on overridden properties
Summary: If its set on the parent prop, but not on the child, we need to explicitly clear it on the child's property. Reviewed By: ricklavoie Differential Revision: D13084126 fbshipit-source-id: 3de06f6239f770efe60a3da582060c5fbab6d4dc
- Loading branch information
Showing
with
50 additions
and 6 deletions.
@@ -0,0 +1,36 @@ | ||
<?hh | ||
|
||
class Y { | ||
const A = 'a'; | ||
} | ||
|
||
class A { | ||
public ImmMap $pub; | ||
protected ImmMap $prot; | ||
} | ||
|
||
class X extends A { | ||
public ImmMap $pub = ImmMap { | ||
Y::A => 42, | ||
}; | ||
protected ImmMap $prot = ImmMap { | ||
Y::A => 24, | ||
}; | ||
|
||
function getPub() { return $this->pub; } | ||
function getProt() { return $this->prot; } | ||
} | ||
|
||
function test() { | ||
return new X; | ||
} | ||
|
||
function main() { | ||
for ($i = 1; $i < 100; $i++) { | ||
test(); | ||
} | ||
$x = test(); | ||
var_dump($x->getPub(), $x->getProt()); | ||
} | ||
|
||
main(); |
@@ -0,0 +1,8 @@ | ||
object(HH\ImmMap)#202 (1) { | ||
["a"]=> | ||
int(42) | ||
} | ||
object(HH\ImmMap)#203 (1) { | ||
["a"]=> | ||
int(24) | ||
} |