Adam Chalmers
3f3693e12d
Type ascription produces two incompatible fields ( #7355 )
...
# Symptoms
This code produces a big ugly confusing error in the frontend, see #7340 .
# Root cause
I added a new test case, with an unknown type. In `ast.snap` under `body[0].declaration.init.ty` there two different `type` fields in the AST node for the type's name, and they have conflicting values Primitive and Identifier.
<img width="602" alt="Screenshot 2025-06-03 at 4 04 55 PM" src="https://github.com/user-attachments/assets/913a0fa0-3e8d-473f-bb64-003d44915be0 " />
# Solution
Change the `enum PrimitiveType` variant from `Named(Node<Identifier>)` to `Named { name: Node<Identifier> }` so that the fields nest differently.
Now the error correctly points out to the user that the type `NotARealType` can't be found. Much better error message that shows the user the problem.
# Alternative solutions
Stop the duplicated JSON fields altogether. I tried this previously in https://github.com/KittyCAD/modeling-app/pull/4369 but it was very involved, and I didn't think it was worth it. Maybe I should reopen that PR and solve this properly.
Closes #7340
2025-06-03 20:05:40 -04:00
..
2025-05-28 16:29:23 +12:00
2025-05-26 11:17:12 +12:00
2025-05-12 03:57:31 +00:00
2025-05-20 20:50:24 -04:00
2025-05-12 03:57:31 +00:00
2025-05-19 16:50:15 +12:00
2025-05-20 20:50:24 -04:00
2025-05-12 03:57:31 +00:00
2025-04-25 19:09:03 -05:00
2025-04-22 22:58:35 +00:00
2025-05-12 03:57:31 +00:00
2025-05-12 01:30:33 -04:00
2025-05-12 01:30:33 -04:00
2025-05-12 01:30:33 -04:00
2025-05-12 01:30:33 -04:00
2025-05-19 16:50:15 +12:00
2025-05-26 11:17:12 +12:00
2025-05-19 16:50:15 +12:00
2025-05-19 16:50:15 +12:00
2025-06-03 20:05:40 -04:00
2025-05-27 23:25:27 +00:00
2025-05-27 23:25:27 +00:00
2025-05-02 16:08:12 -05:00
2025-05-22 21:25:55 +00:00
2025-05-22 21:25:55 +00:00
2025-05-19 16:50:15 +12:00
2025-05-19 16:50:15 +12:00
2025-05-22 21:25:55 +00:00
2025-05-19 16:50:15 +12:00
2025-04-22 22:58:35 +00:00
2025-04-22 22:58:35 +00:00
2025-04-22 22:58:35 +00:00
2025-05-26 11:17:12 +12:00
2025-05-28 16:29:23 +12:00
2025-05-19 16:50:15 +12:00
2025-05-19 16:50:15 +12:00
2025-04-22 22:58:35 +00:00
2025-05-14 10:04:51 -04:00
2025-05-12 03:57:31 +00:00
2025-05-28 16:29:23 +12:00
2025-05-19 16:50:15 +12:00
2025-05-19 16:50:15 +12:00
2025-05-12 01:30:33 -04:00
2025-05-19 16:50:15 +12:00
2025-05-19 14:51:44 -07:00
2025-05-20 20:50:24 -04:00
2025-05-29 19:00:16 -04:00
2025-05-20 12:43:11 -04:00
2025-05-19 16:50:15 +12:00
2025-05-28 16:29:23 +12:00
2025-05-26 11:17:12 +12:00
2025-05-19 16:50:15 +12:00
2025-05-19 16:50:15 +12:00
2025-05-19 16:50:15 +12:00
2025-05-19 16:50:15 +12:00
2025-05-19 16:50:15 +12:00
2025-04-22 22:58:35 +00:00
2025-06-02 10:32:36 -04:00
2025-04-30 16:26:46 +00:00
2025-05-02 16:08:12 -05:00
2025-04-30 16:26:46 +00:00
2025-04-29 13:38:52 +00:00
2025-04-29 13:38:52 +00:00
2025-05-27 23:25:27 +00:00
2025-06-02 13:36:41 -04:00
2025-05-06 03:40:18 +00:00
2025-06-02 10:32:36 -04:00
2025-05-20 11:43:48 -04:00
2025-05-18 06:21:10 -04:00
2025-06-02 10:32:36 -04:00
2025-06-02 10:32:36 -04:00
2025-06-02 10:32:36 -04:00
2025-05-12 03:57:31 +00:00
2025-03-01 21:59:01 +00:00
2025-06-02 10:32:36 -04:00
2025-04-22 22:58:35 +00:00
2025-04-22 22:58:35 +00:00
2025-04-28 12:08:47 -04:00
2025-05-14 10:04:51 -04:00
2025-04-28 12:08:47 -04:00
2025-04-28 12:08:47 -04:00
2025-05-26 11:17:12 +12:00
2025-06-03 08:10:37 -04:00
2025-06-02 13:36:41 -04:00
2025-05-06 03:40:18 +00:00
2025-05-19 16:50:15 +12:00
2025-05-19 16:50:15 +12:00
2025-05-06 03:40:18 +00:00
2025-05-28 16:29:23 +12:00
2025-05-26 11:17:12 +12:00
2025-05-26 11:17:12 +12:00
2025-05-01 23:55:12 -04:00
2025-06-02 10:32:36 -04:00
2025-05-28 16:29:23 +12:00
2025-05-26 11:17:12 +12:00
2025-06-02 10:32:36 -04:00
2025-05-19 16:50:15 +12:00
2025-05-27 23:25:27 +00:00
2025-05-27 23:25:27 +00:00
2025-05-27 23:25:27 +00:00
2025-04-22 22:58:35 +00:00
2025-04-28 12:08:47 -04:00
2025-05-19 16:50:15 +12:00
2025-06-03 15:15:51 +12:00
2025-05-29 10:14:04 +12:00
2025-05-26 11:17:12 +12:00
2025-05-26 11:17:12 +12:00
2025-05-19 16:50:15 +12:00
2025-06-02 18:05:46 -04:00
2025-05-19 16:50:15 +12:00
2025-05-26 11:17:12 +12:00
2025-05-06 03:40:18 +00:00
2025-05-02 16:08:12 -05:00
2025-05-28 16:29:23 +12:00
2025-05-19 14:51:44 -07:00
2025-05-19 14:51:44 -07:00
2025-05-19 16:50:15 +12:00
2025-06-02 10:32:36 -04:00
2025-06-02 10:32:36 -04:00
2025-05-19 16:50:15 +12:00
2025-05-19 16:50:15 +12:00
2025-05-26 11:17:12 +12:00
2025-05-19 16:50:15 +12:00
2025-05-19 16:50:15 +12:00
2025-05-19 16:50:15 +12:00
2025-05-19 16:50:15 +12:00
2025-06-02 10:32:36 -04:00
2025-05-19 16:50:15 +12:00
2025-05-19 16:50:15 +12:00
2025-06-02 10:32:36 -04:00
2025-05-26 11:17:12 +12:00
2025-06-02 10:32:36 -04:00
2025-06-02 10:32:36 -04:00
2025-05-28 16:29:23 +12:00
2025-05-28 16:29:23 +12:00
2025-05-28 16:29:23 +12:00
2025-06-02 10:32:36 -04:00
2025-06-02 13:36:41 -04:00
2025-06-02 13:36:41 -04:00
2025-05-28 16:29:23 +12:00
2025-05-28 16:29:23 +12:00
2025-05-28 16:29:23 +12:00
2025-06-02 13:36:41 -04:00
2025-05-28 16:29:23 +12:00
2025-06-02 13:36:41 -04:00
2025-05-28 16:29:23 +12:00
2025-06-02 10:32:36 -04:00
2025-06-02 10:32:36 -04:00
2025-03-07 22:07:16 -06:00
2025-03-07 22:07:16 -06:00
2025-05-26 11:17:12 +12:00
2025-05-26 11:17:12 +12:00
2025-05-19 16:50:15 +12:00
2025-06-02 10:32:36 -04:00
2025-06-02 10:32:36 -04:00
2025-06-03 16:46:28 +00:00
2025-05-19 16:50:15 +12:00
2025-03-18 01:53:32 +00:00