-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: introduce types.ftl.go
to register sumtypes, which fixes encoding in unit tests
#1909
Conversation
8a88bd9
to
8fa58ec
Compare
7785c2d
to
4afcf6c
Compare
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.
Awesome. Have you played with it? What are the ergonomics like as you're updating the code/modifying the sum types?
subpackage test add failing integration test move tests up to parent package test passes lint encoding test put main init back rebuild add new gened file to gitignore rm gened file from git fix path simplify fix discover test comment fix
9ae07d9
to
006c94c
Compare
It's been unintrusive, so good! Though I haven't tried it out in an IDE. Hopefully it works with everyone's workflows... |
Fixes #1577
This change introduces a new generated file
types.ftl.go
in the user-defined package itself to make sure sumtype registrations get called when running unit tests.Notes:
subpackage
in the test data that is not yet unit tested. Unit tests should be added (identical to the parent package's unit tests) after Can't define enums in sub-packages #1903 is resolved. Some work will also need to be done to extend thetypes.ftl.go
generation to working on subpackages.mainModuleContext
, which means that code now generates not only just the literalmain
package, but also the conceptual main package's additional artifacts. I couldn't come up with a name that would be better, so it's left as-is in this PR, but please let me know if you think of something better.