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

[BUG] block in block error message should not show without repeat/if #3270

Closed
Felienne opened this issue Sep 9, 2022 · 5 comments · Fixed by #5283
Closed

[BUG] block in block error message should not show without repeat/if #3270

Felienne opened this issue Sep 9, 2022 · 5 comments · Fixed by #5283
Assignees
Labels
error messages Issues related to Error messages when code is wrong language Issues related to the Hedy language level7

Comments

@Felienne
Copy link
Member

Felienne commented Sep 9, 2022

Describe the bug
A block in a block error is given when we do not use a repeat.

Paste the Hedy code & level
Level 7

repeat 5 times
  print 'Hello folks'
    print 'This will be printed 5 times'
print 'We are done now'

Add a screenshot (optional)
image

@Felienne Felienne added level7 error messages Issues related to Error messages when code is wrong language Issues related to the Hedy language labels Sep 9, 2022
@Felienne
Copy link
Member Author

Felienne commented Sep 9, 2022

Related but slightly different:

image

@Felienne Felienne self-assigned this Jan 26, 2024
@Felienne
Copy link
Member Author

Also for @boryanagoncharenko ?

@boryanagoncharenko boryanagoncharenko self-assigned this Feb 24, 2024
@boryanagoncharenko
Copy link
Collaborator

@Felienne What errors should we display to the user in both cases?

In the first error, instead of
You are using a block in a block! That is awesome, but a block in a block is not unlocked yet! It will be unlocked in a later level we could show You used too many spaces in line 3. You used 4 spaces, which is too much. Start every new block with 2 spaces more than the line before. However, this is also a bit misleading because the last sentence does talk about "every new block". Maybe we could just show You used too many spaces in line 3. You used 4 spaces, which is too much.?

The second error cannot be replicated anymore. Now we show the message You used too many spaces in line 4. You used 2 spaces, which is too much. Start every new block with 2 spaces more than the line before. This message seems correct but, again, I find the last sentence confusing because it directs the user to a 'new block'. Perhaps we could remove the last sentence for level 8?

@Felienne
Copy link
Member Author

Felienne commented Mar 9, 2024

@Felienne What errors should we display to the user in both cases?

In the first error, instead of You are using a block in a block! That is awesome, but a block in a block is not unlocked yet! It will be unlocked in a later level we could show You used too many spaces in line 3. You used 4 spaces, which is too much. Start every new block with 2 spaces more than the line before. However, this is also a bit misleading because the last sentence does talk about "every new block". Maybe we could just show You used too many spaces in line 3. You used 4 spaces, which is too much.?

Yes, I think You used too many spaces in line 3. You used 4 spaces, which is too much. would be a perfect error message if we can get that to work!

The second error cannot be replicated anymore.

Ah I guess @akseron fixed that already (or maybe I did it?)

Now we show the message You used too many spaces in line 4. You used 2 spaces, which is too much. Start every new block with 2 spaces more than the line before. This message seems correct but, again, I find the last sentence confusing because it directs the user to a 'new block'. Perhaps we could remove the last sentence for level 8?

Yeah I agree that final sentence can be removed in this case! But maybe not in all cases? I am not sure if there are cases where it should remain. What do you think?

@akseron
Copy link
Collaborator

akseron commented Mar 9, 2024

@Felienne What errors should we display to the user in both cases?
In the first error, instead of You are using a block in a block! That is awesome, but a block in a block is not unlocked yet! It will be unlocked in a later level we could show You used too many spaces in line 3. You used 4 spaces, which is too much. Start every new block with 2 spaces more than the line before. However, this is also a bit misleading because the last sentence does talk about "every new block". Maybe we could just show You used too many spaces in line 3. You used 4 spaces, which is too much.?

Yes, I think You used too many spaces in line 3. You used 4 spaces, which is too much. would be a perfect error message if we can get that to work!

The second error cannot be replicated anymore.

Ah I guess @akseron fixed that already (or maybe I did it?)

Now we show the message You used too many spaces in line 4. You used 2 spaces, which is too much. Start every new block with 2 spaces more than the line before. This message seems correct but, again, I find the last sentence confusing because it directs the user to a 'new block'. Perhaps we could remove the last sentence for level 8?

Yeah I agree that final sentence can be removed in this case! But maybe not in all cases? I am not sure if there are cases where it should remain. What do you think?

Yes I remember looking at it, however it was already solved in #4351 😄

@mergify mergify bot closed this as completed in #5283 Mar 22, 2024
mergify bot pushed a commit that referenced this issue Mar 22, 2024
Fixes #3270
Level 8 introduces indentation and allows single blocks while later levels allow nested blocks. Therefore, level 8 requires slightly different error messages.

Please consider whether the error messages could have better text.

**How to test**
Run Hedy locally and run the following snippets in level 8. The error messages should be meaningful and should not mention 'block in a block':
```
print 'test'
    print 'Hello folks'
```
```
repeat 5 times
print 'Hello folks'
```
```
repeat 5 times
    print 'test'
        print 'Hello folks'
```
```
repeat 5 times
    print 'test'
      print 'Hello folks'
```
```
repeat 5 times
    print 'test'
  print 'Hello folks'
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error messages Issues related to Error messages when code is wrong language Issues related to the Hedy language level7
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants