-
Notifications
You must be signed in to change notification settings - Fork 53
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 void type #735
Add void type #735
Conversation
Looking good so far. You'll also need to add We might want to also mention |
Thank you for the feedback and direction. I will review the parser code this evening. |
@ussgarci I missed you in IRC, so just wanted to say: reading about megaparsec and parser combinators is great, don't let me stop you! But for this particular issue all you should have to do is figure out where the |
@byorgey Thank you for the tip. |
Hi @byorgey , I've pushed an initial attempt at writing a test for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good so far.
- We could add some tests just to make sure that
void
is a valid type, for example, a test likevalid "def f : void -> a = \x. undefined end"
or something like that. - We could also put a test in
TestPretty
to make sure that thevoid
type pretty-prints properly.
test/unit/TestVoid.hs
Outdated
import Swarm.Language.Types | ||
import Swarm.Language.Typecheck (isSimpleUType) | ||
|
||
testVoid :: TestTree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is fine --- good job noticing that isSimpleUType
had better return True
for void
, I wouldn't have thought of that. Fortunately, the way isSimpleUType
is implemented, we get this for free.
test/unit/Main.hs
Outdated
@@ -26,6 +26,7 @@ import TestLanguagePipeline (testLanguagePipeline) | |||
import TestModel (testModel) | |||
import TestNotification (testNotification) | |||
import TestPretty (testPrettyConst) | |||
import TestVoid (testVoid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably overkill to have a separate test module just for testing void
. I would put the void
tests in TestLanguagePipeline
, perhaps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I've moved the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. We could update the ADT calculator
description (or brainstorm other ways for the player to learn about void
) in this issue, or it might be simpler to just merge this and split out in-game documentation of void
into a separate issue.
Hi @byorgey merging this and splitting out the documentation of |
@ussgarci OK, go ahead and add the |
@byorgey I can create the issue. Unless I'm mistaken, it appears I can't add a label to this PR. |
Oh, right, I was confused and thought you were already added as a contributor. |
Oops, forgot to edit the PR description before merging, oh well 😄 |
@ussgarci , congrats on having your first PR accepted to Swarm! We appreciate the contribution and we're really glad to welcome you as part of the community. In a minute we will send you an invite to the repo (see https://github.com/swarm-game/swarm/blob/main/CONTRIBUTING.md#i-have-push-access-to-the-swarm-repository-now-what ). |
@byorgey Thank you for all your help! I'm happy to be a part of this community. 🙇 |
Add a new
void
type. Closes #665.