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

Maybe type inference for return types is not working. #357

Closed
TheGrandmother opened this issue Apr 4, 2016 · 6 comments · Fixed by #394
Closed

Maybe type inference for return types is not working. #357

TheGrandmother opened this issue Apr 4, 2016 · 6 comments · Fixed by #394

Comments

@TheGrandmother
Copy link
Contributor

Type inference for Maybe types doesn't work properly.

If I have:

class Bob
    def glenn() : Maybe int{
        if(true) then{
            Just 420
        }else{
            Nothing
        }
    }

I get the type error:

Type mismatch in different branches of if-statement:
  then:  Maybe int
  else:  Maybe Bottom

This is quite annoying.

@supercooldave
Copy link

It is annoying. Just add a type annotation on Nothing.

@TheGrandmother
Copy link
Contributor Author

@supercooldave Solves it.

@TobiasWrigstad
Copy link
Contributor

@TheGrandmother this is a great candidate for fixing next week during hackathon.

@TheGrandmother
Copy link
Contributor Author

@TobiasWrigstad Sure! Then i would get to learn how the parser and type checker work :)

@TobiasWrigstad
Copy link
Contributor

Dave tells me this might require some new infrastructure so maybe I was mistaken. In any case, talk it over with Elias.

@TobiasWrigstad
Copy link
Contributor

@EliasC Do the "simple fix". Also @TheGrandmother and @kikofernandez wants to join when you do.

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

Successfully merging a pull request may close this issue.

5 participants