Skip to content

Commit

Permalink
remove __Pure interfaces from HackLibTestTraversables
Browse files Browse the repository at this point in the history
Summary: This is due to push order issues with hack server and this is super unecessary anyway

Reviewed By: dneiter

Differential Revision: D26705356

fbshipit-source-id: 5ac9c183368876f314343444658d5a1c9e778379
  • Loading branch information
DavidSnider authored and facebook-github-bot committed Feb 27, 2021
1 parent 7008393 commit 8d47005
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
14 changes: 3 additions & 11 deletions tests/HackLibTestForwardOnlyIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,35 @@
* Hack.Lang.AutoprimeGenerators is false
*/
final class HackLibTestForwardOnlyIterator<Tk as arraykey, Tv>
implements \HH\Rx\Iterator<Tv>, \HH\Rx\KeyedIterator<Tk, Tv> {
implements \HH\Iterator<Tv>, \HH\KeyedIterator<Tk, Tv> {
private bool $used = false;
private int $keyIdx = 0;
private vec<Tk> $keys;

<<__Pure>>
public function __construct(private dict<Tk, Tv> $data)[] {
/* HH_FIXME[4387] Will get autocleaned up after coeffecs migration */
$this->keys = Vec\keys($data);
}

<<__Pure, __MaybeMutable>>
public function current()[]: Tv {
return $this->data[$this->keys[$this->keyIdx]];
}

<<__Pure, __MaybeMutable>>
public function key()[]: Tk {
return $this->keys[$this->keyIdx];
}

<<__Pure, __Mutable>>
public function rewind()[]: void {
public function rewind()[write_props]: void {
if ($this->used) {
$this->next();
$this->used = false;
}
}

<<__Pure, __MaybeMutable>>
public function valid()[]: bool {
/* HH_FIXME[4387] Will get autocleaned up after coeffecs migration */
return C\contains_key($this->keys, $this->keyIdx);
}

<<__Pure, __Mutable>>
public function next()[]: void {
public function next()[write_props]: void {
$this->used = true;
$this->keyIdx++;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/HackLibTestTraversables.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
abstract final class HackLibTestTraversables {

// For testing functions that accept Traversables
public static function getIterator<T>(Traversable<T> $ary): \HH\Rx\Iterator<T> {
public static function getIterator<T>(Traversable<T> $ary): \HH\Iterator<T> {
$dict = dict[];
$i = 0;
foreach ($ary as $v) {
Expand All @@ -30,7 +30,7 @@ public static function getIterator<T>(Traversable<T> $ary): \HH\Rx\Iterator<T> {
// For testing functions that accept KeyedTraversables
public static function getKeyedIterator<Tk as arraykey, Tv>(
KeyedTraversable<Tk, Tv> $ary,
): \HH\Rx\KeyedIterator<Tk, Tv> {
): \HH\KeyedIterator<Tk, Tv> {
return new HackLibTestForwardOnlyIterator(dict($ary));
}
}

0 comments on commit 8d47005

Please sign in to comment.