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

Code Generation problems with Bounded Polymorphic Functions #852

Open
supercooldave opened this issue Jul 10, 2017 · 0 comments
Open

Code Generation problems with Bounded Polymorphic Functions #852

supercooldave opened this issue Jul 10, 2017 · 0 comments
Assignees
Labels

Comments

@supercooldave
Copy link

The following function, which uses a bounded polymorphic type argument, results in invalid C:

fun arreq[t : Eq[t]](arr1 : [t], arr2 : [t]) : bool
  repeat i <- |arr1| do
    if arr1(i) != arr2(i) then
      return false
    end
  end
  true
end

active class Main
  def main() : unit
    ()
  end
end

The resulting error is (one warning removed):

BugReportPlay_src/shared.c:190:110: error: invalid operands to binary expression
      ('void *' and 'encore_arg_t')
  ...({encore_arg_t _access_14 = array_get(_enc__arg_arr1, _i_10); _access_14.p;}) == ((encore_arg_t) ({encore_arg_t _access_15 = array_get(_enc__arg_arr2, _i_10); _access_15.p;}))...
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants