You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// These should be OK since variadic tuples (rest can go anywhere)// versions 4.2.3 ~ 4.8 dev.{typeT12=["^", ...(string|boolean|undefined)[],"$"]constt12a:T12=["^","$"];// Should not be an errorconstt12b:T12=["^",true,"$"];// Should not be an error}
π Actual behavior
As shown.
π Expected behavior
Not errors, because a match exists.
Additional Info
I examined the code. checkArrayLiteral in checker.ts performs a unidirection (left to right) search only,
However, the output from createNormalizedTupleType outputs a normalized type that can have a single tuple in the middle (like the one in the example).
That requires a bidirectional search to get the right results.
Alternatively, createNormalizedTupleType could be forced to roll up everything after the first rest into a single rest. But such an algorithm would result in more false postives (false passes) than necessary. So a bidirectional search is preferable.
I can provide more details if necessary. (I even have bi-directional search code that passes all the baselines tests). Just ask if you want it.
The text was updated successfully, but these errors were encountered:
Bug Report
π Search Terms
variadic tuple bug
π Version & Regression Information
The same behavior is visible from 4.2.3 through 4.8dev
although it it as only been a bug since variadic tuples.
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
As shown.
π Expected behavior
Not errors, because a match exists.
Additional Info
I examined the code.
checkArrayLiteral
inchecker.ts
performs a unidirection (left to right) search only,However, the output from
createNormalizedTupleType
outputs a normalized type that can have a single tuple in the middle (like the one in the example).That requires a bidirectional search to get the right results.
Alternatively,
createNormalizedTupleType
could be forced to roll up everything after the first rest into a single rest. But such an algorithm would result in more false postives (false passes) than necessary. So a bidirectional search is preferable.I can provide more details if necessary. (I even have bi-directional search code that passes all the baselines tests). Just ask if you want it.
The text was updated successfully, but these errors were encountered: