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 TCAppL and TCAppR typechecking stack frames, and remove TCBind{L,R} #2220

Merged
merged 6 commits into from
Dec 17, 2024

Conversation

byorgey
Copy link
Member

@byorgey byorgey commented Dec 13, 2024

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 byorgey requested review from xsebek and kostmo December 13, 2024 18:59
Copy link
Member

@xsebek xsebek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, the error message for a function argument looks better. 👍

What happens with id 3 3? Is that a RHS of LHS? 🤔

src/swarm-lang/Swarm/Language/Typecheck.hs Show resolved Hide resolved
@byorgey
Copy link
Member Author

byorgey commented Dec 17, 2024

What happens with id 3 3? Is that a RHS of LHS? 🤔

id 3 3 reports that id 3 was expected to have a function type but actually has type Int, while checking the LHS of the application _ 3.

Maybe an example of what you were thinking of would be something like "hi" + 2, which now reports

1:1: Type mismatch:
  From context, expected `"hi"` to have type `Int`,
  but it actually has type `Text`

  - While checking the argument to a function: (+) _
  - While checking a function applied to an argument: _ 2

@byorgey byorgey added the merge me Trigger the merge process of the Pull request. label Dec 17, 2024
@mergify mergify bot merged commit 7e1e3d8 into main Dec 17, 2024
12 checks passed
@mergify mergify bot deleted the more-stack-frames branch December 17, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Trigger the merge process of the Pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants