Skip to content

Commit

Permalink
remove lies_we_tell_hack.hhi from HSL (#83)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebookarchive/fbshipit#83

Pull Request resolved: hhvm/hsl-experimental#76

Pull Request resolved: #98

In HSL and open-source projects that depend on it, most of these "lies" are unneeded, and the remaining places that depend on them can be avoided by changing `\HH\InvariantException` to `InvariantException`. Without namespace, it will always be correctly resolved to wherever HHVM autoimports it from.

"wherever HHVM autoimports it from" is actually changing (it used to be `\InvariantException` but is `\HH\InvariantException` as of a few days ago), which is the reason why this file is problematic. Before the HHVM change, and without the diff, the file was needed -- but after the HHVM change, the file causes Hack errors in HSL and [anything that depends on it](https://travis-ci.org/hhvm/)).

Reviewed By: fredemmott

Differential Revision: D18121499

fbshipit-source-id: abd73c9f72401755ae1250302bb4c515faf23e75
  • Loading branch information
jjergus authored and facebook-github-bot committed Oct 24, 2019
1 parent 4f075c9 commit 82343bc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
vendor/
*.hhast.parser-cache
*.swp
*~
composer.lock
21 changes: 0 additions & 21 deletions src/lies_we_tell_hack.hhi

This file was deleted.

13 changes: 8 additions & 5 deletions tests/regex/RegexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use function Facebook\FBExpect\expect; // @oss-enable
use type Facebook\HackTest\{DataProvider, HackTest}; // @oss-enable
use type HH\InvariantException as InvariantViolationException; // @oss-enable

// @oss-disable: <<Oncalls('hack')>>
final class RegexTest extends HackTest {
Expand All @@ -25,13 +24,15 @@ public static function checkThrowsOnInvalidOffset<T>(
expect(() ==> $fn('Hello', re"/Hello/", -5))->notToThrow();
expect(() ==> $fn('Hello', re"/Hello/", 6))->
toThrow(
InvariantViolationException::class,
InvariantException::class, // @oss-enable
// @oss-disable: InvariantViolationException::class,
null,
'Invalid offset should throw an exception',
);
expect(() ==> $fn('Hello', re"/Hello/", -6))->
toThrow(
InvariantViolationException::class,
InvariantException::class, // @oss-enable
// @oss-disable: InvariantViolationException::class,
null,
'Invalid offset should throw an exception',
);
Expand Down Expand Up @@ -375,8 +376,10 @@ public function testSplit(
}

public function testSplitInvalidLimit(): void {
expect(() ==> Regex\split('hello world', re"/x/", 1))
->toThrow(InvariantViolationException::class);
expect(() ==> Regex\split('hello world', re"/x/", 1))->toThrow(
InvariantException::class, // @oss-enable
// @oss-disable: InvariantViolationException::class,
);
}

public static function provideToString(
Expand Down

0 comments on commit 82343bc

Please sign in to comment.