-
Notifications
You must be signed in to change notification settings - Fork 28
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
Properly support tuple field accessors typing #69
Comments
Related JS-gen issue: #65 (comment) |
I realize the right way of doing this is to change the way field removal types act on tuples (and arrays). Currently it leaves tuples untouched:
We should add a field in TupleType and ArrayType to remember which fields have been hidden by a Without type applied on such types. (Cc @Meowcolm024.) |
Another improvement request: properly reason about intersected tuple-record types, as mentioned in #79 (comment). For example: def test: (string, 1) & { _1: "hello" }
//│ test: (string, 1,) & {_1: "hello", _2: 1} The above should simplify to Moreover in: test: { _1: 'a }
//│ res: {_1: "hello"}
test: ('a, 1)
//│ res: (string, 1,) I would have expected to get type Similarly, the following could "simplify" to error: Array[1] & { _1: int }
//│ res: Array[1] & {_1: int} |
Note: To make things simpler, we didn't go with this approach. Instead, we just convert these types to records upon removing fields from them, which is not optimal ( |
There are currently at least two ways in which they are broken:
While they work on simple types thanks to the case in
ConstraintSolver
:they don't work for more complex cases, because the normal forms don't know about them:
We can subvert them, causing a soundness problem:
The text was updated successfully, but these errors were encountered: