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

Array access operator applied to string results in internal compiler error #823

Closed
supercooldave opened this issue Jun 14, 2017 · 3 comments · Fixed by #832
Closed

Array access operator applied to string results in internal compiler error #823

supercooldave opened this issue Jun 14, 2017 · 3 comments · Fixed by #832
Labels

Comments

@supercooldave
Copy link

supercooldave commented Jun 14, 2017

Compiling the following class

active class Main
  def main() : unit
    val str = "foo"
    str(0)
  end 
end

results in the internal error

encorec: No match in record selector argTypes

I suspect this is due to trying to use array access (0) on the string.
(It would be nice to use str(n) to access elements of the string.)

@TobiasWrigstad
Copy link
Contributor

Notably, strings are not arrays. They are objects. Eventually, strings should and will support this operations if we chose to go ahead with RFC #591.

@supercooldave
Copy link
Author

Parsing strings is hard. But I now see that I can convert a string into an array of chars.

@TobiasWrigstad
Copy link
Contributor

(Obviously, this has nothing to do with your compiler error which is weird.)

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

Successfully merging a pull request may close this issue.

2 participants