Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

Commit

Permalink
Add an assertion for the Y10K bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Atry committed Jun 1, 2022
1 parent cc352bb commit 5271217
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/__Private/is_compatible_schema_version.hack
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ use namespace HH\Lib\Str;
* Facebook\HHAST\SCHEMA_VERSION.
*/
function is_compatible_schema_version(string $other_version): bool {
invariant(
Str\length($other_version) === Str\length(SCHEMA_VERSION) &&
Str\length($other_version) === Str\length(LATEST_BREAKING_SCHEMA_VERSION),
'%s needs updating or a Y10K bug occurs',
__FILE__,
);
return Str\compare($other_version, SCHEMA_VERSION) <= 0 &&
Str\compare($other_version, LATEST_BREAKING_SCHEMA_VERSION) >= 0;
}

0 comments on commit 5271217

Please sign in to comment.