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

union type bug #3543

Open
damon-kwok opened this issue May 8, 2020 · 2 comments
Open

union type bug #3543

damon-kwok opened this issue May 8, 2020 · 2 comments
Labels
bug Something isn't working needs investigation This needs to be looked into before its "ready for work"

Comments

@damon-kwok
Copy link
Contributor

damon-kwok commented May 8, 2020

use "collections"

primitive Seqx[A: Seq[B] ref = Array[I32], B: Comparable[B] #read = I32]
  fun each(a: A, f: ({(B)} val | {(B): B} val) ): A^ => a
  fun map(a: A, f: ({(B): B} val | {(USize, B): B} val)): A^ =>  a

primitive Num[A: (Real[A] val & Number) = I32]
  fun print(a: A): A => a

actor Main
  new create(env: Env) =>
    let arr_i: Array[I32] ref = [1; 2; 3]
    Seqx.>map(arr_i, Num~print())   // allow
    //Seqx.each(arr_i, Num~print()) // don't allow
@SeanTAllen
Copy link
Member

@damon-kwok please include all the information in the issue rather than referring to Zulip otherwise people will have to refer to the zulip and someone else will have to copy it over. You can provide a link for additional context but enough information to start addressing the issue should be included. This is missing valuable information.

Thanks.

@damon-kwok
Copy link
Contributor Author

Here are some zulip discussions that may be helpful in analyzing bugs:

@jasoncarr0
To add onto this: it does not work with:
fun each(a: A, f: ({(B)} val | {(B): B} val) ): A^ => a
but does work with:
fun each(a: A, f: ({(B): B} val) ): A^ => a
So I think there's an issue with unions here as the former should accept more arguments

@SeanTAllen: Yeah it appears to be a bug with the union type there, as it is rejecting it because it doesnt match one of them, rather than accepting it.

@SeanTAllen SeanTAllen added bug: 1 - needs investigation needs investigation This needs to be looked into before its "ready for work" bug Something isn't working and removed bug: 1 - needs investigation labels May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs investigation This needs to be looked into before its "ready for work"
Projects
None yet
Development

No branches or pull requests

2 participants