Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
3 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); |
8 changes: 8 additions & 0 deletions
8
hphp/test/slow/object_property/system_initial_value.php.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
object(HH\ImmMap)#202 (1) { | ||
["a"]=> | ||
int(42) | ||
} | ||
object(HH\ImmMap)#203 (1) { | ||
["a"]=> | ||
int(24) | ||
} |