Created
January 15, 2016 15:41
-
-
Save pbl64k/adbf1c035e21efc6a4d2 to your computer and use it in GitHub Desktop.
Hack typechecker disagrees with run-time re at() signature in ConstIndexAccess
This file contains hidden or 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
<?hh // strict | |
final class Dummy<Tx> implements ConstIndexAccess<int, Tx> | |
{ | |
final public function __construct(private Tx $x) { } | |
final public function at(int $ix): Tx | |
{ | |
return $this->x; | |
} | |
final public function get(int $ix): ?Tx | |
{ | |
return $this->at($ix); | |
} | |
final public function containsKey<Tu super int>(Tu $ix): bool | |
{ | |
return true; | |
} | |
} |
This file contains hidden or 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
<?hh // partial | |
require_once(__DIR__.'/Dummy.hh'); | |
$d = new Dummy(1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment