-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BigInt typechecking #7602
BigInt typechecking #7602
Conversation
Not sure why tests fail, it is something about lsp tests |
Is there a reason that the names "bigint" and "bignum" are inconsistently used? I'd personally rather align everything with "bigint" since (as far as I understand it) that's the actual Flow type being provided. |
@mvitousek just arbitrary, BigNum in typechecker, BigInt in AST, I just copypasted |
@mvitousek is this all that bothers you? |
@mvitousek I renamed all of them to |
accc410
to
33f0535
Compare
SingletonBigNumT to SingletonBIgIntT BIgNumH to BigIntH SingletonBIgNumH to SingletonBigIntH
3cb1b98
to
6447652
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mvitousek has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
||
| BoolP (* boolean *) | ||
| FunP (* function *) | ||
| NumP (* number *) | ||
| BIgIntP (* bigint *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| BIgIntP (* bigint *) | |
| BigIntP (* bigint *) |
@@ -22,13 +22,15 @@ let string_of_pred_ctor = function | |||
| BoolP -> "BoolP" | |||
| StrP -> "StrP" | |||
| NumP -> "NumP" | |||
| BIgIntP -> "BIgIntP" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| BIgIntP -> "BIgIntP" | |
| BigIntP -> "BigIntP" |
@@ -1388,6 +1400,7 @@ and json_of_pred_impl json_cx p = Hh_json.( | |||
| StrP | |||
| SymbolP | |||
| NumP | |||
| BIgIntP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| BIgIntP | |
| BigIntP |
(* typeof _ ~ "bigint" *) | ||
(***********************) | ||
|
||
| BIgIntP -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| BIgIntP -> | |
| BigIntP -> |
| BIgIntP -> | ||
rec_flow_t cx trace (Type_filter.bigint l, t) | ||
|
||
| NotP BIgIntP -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| NotP BIgIntP -> | |
| NotP BigIntP -> |
@@ -5537,6 +5649,7 @@ and predicates_of_condition cx e = Ast.(Expression.( | |||
| "boolean" -> Some BoolP | |||
| "function" -> Some FunP | |||
| "number" -> Some NumP | |||
| "bigint" -> Some BIgIntP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "bigint" -> Some BIgIntP | |
| "bigint" -> Some BigIntP |
@@ -201,156 +201,7 @@ export default suite(({ addFile, addFiles, addCode }) => [ | |||
const valid_neg_small = -100n; | |||
type ValidSmall = 100n; | |||
type ValidNegSmall = -1n; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests for BigInts with numeric separators are missing here. Parser already support them.
BigInt is now supported as of 0.194 |
Fixes #6639
Library definitions #7534 (BigInt builtin and typed arrays)
Probably signature verification should be rewritten too, but I don't know what it does.
There maybe missing cases in something like refinements, assignment operators (especially since they seem untyped)
Adds
sketchy-null-bigint
lint rule and supportsbigint
type insketchy-number
with different lint message