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

Handle conditional expressions with non-identical types #102

Open
zhiyuanshi opened this issue Mar 10, 2015 · 0 comments
Open

Handle conditional expressions with non-identical types #102

zhiyuanshi opened this issue Mar 10, 2015 · 0 comments
Assignees

Comments

@zhiyuanshi
Copy link
Contributor

Source:

if True
   then { status = "placed" }
   else { status = "cancelled", cancelledAt = "2015-03-10" }

Output:

should_compile[hotfix/issue-98] % f2j TypingIf.sf -r
TypingIf using [Naive]
Compiling to Java source code ( ./TypingIf.java )
./TypingIf.java:13: error: incompatible types: Tuple2 cannot be converted to String
      ifres1 = x2;
               ^
1 error

System FI:

if True 
   then { status = "placed" } 
   else ({ status = "cancelled" } ,, { cancelledAt = "2015-03-10" })

FCore:

if True 
   then "placed" 
   else ("cancelled", "2015-03-10")

Simplify did not generate valid a System F expression in this case.

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