Skip to content
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

Add more typechecking stack frame types and pretty-print them in type errors #1314

Closed
Tracked by #1297
byorgey opened this issue Jun 9, 2023 · 1 comment
Closed
Tracked by #1297
Assignees
Labels
C-Low Hanging Fruit Ideal issue for new contributors. L-Error reporting Reporting language or runtime errors to the player. L-Type inference The process of inferring the type of a Swarm expression. S-Nice to have The bug fix or feature would be nice but doesn't currently have much negative impact. Z-Feature A new feature to be added to the game. Z-User Experience This issue seeks to make the game more enjoyable to play.

Comments

@byorgey
Copy link
Member

byorgey commented Jun 9, 2023

This is a follow-up to #1308.

  • We need to add more constructors to the TCFrame type, and push them with appropriate calls to withFrame during type inference and checking. See the existing three constructors as an example.
  • Currently, pretty-printing of type error messages will simply print out every frame on the stack, but this might be overwhelming. We probably need to do some work to select which frames from the stack to actually show. At the very least we should probably show the first and last frames; beyond that maybe we can come up with some heuristics as to which additional frames are the most helpful to show.
@byorgey byorgey added Z-Feature A new feature to be added to the game. C-Low Hanging Fruit Ideal issue for new contributors. S-Nice to have The bug fix or feature would be nice but doesn't currently have much negative impact. L-Type inference The process of inferring the type of a Swarm expression. L-Error reporting Reporting language or runtime errors to the player. labels Jun 9, 2023
@byorgey byorgey added the Z-User Experience This issue seeks to make the game more enjoyable to play. label Jun 3, 2024
@byorgey byorgey self-assigned this Nov 20, 2024
mergify bot pushed a commit that referenced this issue Dec 17, 2024
…nd{L,R}` (#2220)

Towards #1314.

- It seems like it could be helpful to report that we were checking the left- or right-hand side of a function application when reporting type errors, to help give context.
- On the other hand the "checking the LHS/RHS of a semicolon" never seemed very useful, since it would always come in a big chain and didn't really help localize the error, so I removed it.
- I'm open to suggestions for other context we could provide.  There is definitely a balance here between providing helpful context and providing too much.  For example, should we add something that says "while checking the LHS/RHS of a pair"?
@byorgey
Copy link
Member Author

byorgey commented Dec 20, 2024

I'm going to close this since especially after merging #2220 I think the status quo is fine, and I can't think of anything else in particular that would unambiguously improve error messages (as opposed to just adding extra clutter). If we get reports of confusing messages or think of specific improvements then we can open separate issues in the future.

@byorgey byorgey closed this as completed Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Low Hanging Fruit Ideal issue for new contributors. L-Error reporting Reporting language or runtime errors to the player. L-Type inference The process of inferring the type of a Swarm expression. S-Nice to have The bug fix or feature would be nice but doesn't currently have much negative impact. Z-Feature A new feature to be added to the game. Z-User Experience This issue seeks to make the game more enjoyable to play.
Projects
None yet
Development

No branches or pull requests

1 participant