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

Make generated code from empty services compile #5

Merged
merged 1 commit into from
Dec 23, 2021

Conversation

Baccata
Copy link
Contributor

@Baccata Baccata commented Dec 23, 2021

Fixes #3

s"case ${op.name}() => ((), ${op.name})"
if (ops.isEmpty) {
line(
s"""def endpoint[I, E, O, SI, SO](op : $opTraitName[I, E, O, SI, SO]) = sys.error("impossible")"""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the sealed trait is unpopulated, it is effectively a phantom type, therefore it is literally impossible under normal circumstances (unless runtime reflection is involved, or black magic) for this method to be called.

@Baccata Baccata merged commit 0f5cfea into main Dec 23, 2021
@Baccata Baccata deleted the prevent-empty-services-from-erroring branch December 23, 2021 21:16
Baccata added a commit that referenced this pull request May 10, 2022
…m-erroring

Make generated code from empty services compile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Service with no operations gen
2 participants