Skip to content

Uniform semantic errors in string slicing . #615

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 2 commits into from
Jun 17, 2022

Conversation

faze-geek
Copy link
Contributor

Semantic error thrown only for upper index on master , error messages for lower index and step value added.

s="abcdefg"
print(s[1.5:7])
semantic error: slice indices must be integers or None
 --> try.py:4:13
  |
4 |     print(s[1.5:7])
  |             ^^^ 

print(s[1:7:0.5])
semantic error: slice indices must be integers or None
 --> try.py:4:17
  |
4 |     print(s[1:7:0.5])
  |                 ^^^ 

Test and reference files ( for invalid upper index ) had been added in #347 , so I'll add them if they are essentially required.

@certik
Copy link
Contributor

certik commented Jun 16, 2022

Perfect. Can you please add tests for the error messages? Just add the failing test into tests/errors, register them in tests.yaml, and do "./run_tests -u", which will generate reference results and commit them.

@faze-geek
Copy link
Contributor Author

Perfect. Can you please add tests for the error messages?

@certik I have done the following . I guess this is good to go in once the tests pass .

Copy link
Collaborator

@namannimmo10 namannimmo10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@czgdp1807
Copy link
Collaborator

LGTM as well.

@czgdp1807 czgdp1807 added the asr ASR related changes label Jun 17, 2022
@czgdp1807 czgdp1807 self-requested a review June 17, 2022 13:29
@namannimmo10 namannimmo10 merged commit 7f22dab into lcompilers:main Jun 17, 2022
@certik
Copy link
Contributor

certik commented Jun 18, 2022

Thanks, looks good.

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

Successfully merging this pull request may close these issues.

4 participants