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

No supertype allowed in handler return #604

Open
marzipankaiser opened this issue Sep 24, 2024 · 1 comment
Open

No supertype allowed in handler return #604

marzipankaiser opened this issue Sep 24, 2024 · 1 comment

Comments

@marzipankaiser
Copy link
Contributor

The following program gives the annotated error:

interface Done {
  def done(): Nothing
}

def main() = {
  try {
    do done()
  } with Done {
    def done() = ()   // Error: Expected Nothing but got Unit.
  }
}

Is this the behaviour we want?

Note that this also disallows, e.g., a hole instead of do done().

@b-studios
Copy link
Collaborator

b-studios commented Sep 24, 2024

What would you expect, otherwise? The answer type of the handler is Nothing unless you upcast it there.

We could of course compute the join of the different handlers and the answer type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants