Skip to content

Error Handling: non integer indices for string slicing #347

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

Merged
merged 1 commit into from
Apr 10, 2022

Conversation

Abdullahjavednesar
Copy link
Collaborator

Handling Exceptions when str slicing index in non integer

Example:

def f():
  s: str
  s = "01234"
  print(s[1:2.2])

Now throws error while calling f()

semantic error: slice indices must be integers or None
  |
4 |     print(s[1:2.2])
  |               ^^^ 

@certik certik merged commit aa8858d into lcompilers:main Apr 10, 2022
@certik
Copy link
Contributor

certik commented Apr 10, 2022

I think this looks great, thanks!

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

Successfully merging this pull request may close these issues.

2 participants