Commit fa92cf3
committed
Make handling of bigint/numberic unions, overloads more strict
If a string like "100000000000000000000000001" or "3.2" is passed to
a method which has both a numeric and a bigint overload. API users
may expect all cases to magically be handled correctly without
information loss in both cases, but this behavior would require the
type of the result to be based on the contents of the string.
This patch avoids the issue with the following tweaks to BigInt
WebIDL integration:
- bigint and numeric types are marked as "indistinguishable", so it
is not permitted to have an overload between bigint and a numeric
type as the distinguishing argument.
- In the es-to-union algorithm, if the type is a union containing
bigint and a numeric type, and no more specific member applies
for the conversion directly, then a TypeError is thrown.1 parent 471ec88 commit fa92cf3
1 file changed
+6
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3522 | 3522 | | |
3523 | 3523 | | |
3524 | 3524 | | |
3525 | | - | |
| 3525 | + | |
3526 | 3526 | | |
3527 | 3527 | | |
3528 | 3528 | | |
| |||
8077 | 8077 | | |
8078 | 8078 | | |
8079 | 8079 | | |
8080 | | - | |
8081 | | - | |
8082 | | - | |
| 8080 | + | |
| 8081 | + | |
| 8082 | + | |
| 8083 | + | |
| 8084 | + | |
8083 | 8085 | | |
8084 | 8086 | | |
8085 | 8087 | | |
| |||
0 commit comments