fubark / cyber

Fast and concurrent scripting.
https://cyberscript.dev
MIT License
1.16k stars 38 forks source link

Indexed Assignment Into Non-List Type Generates "Unknown Error Code" #68

Closed Capital-EX closed 11 months ago

Capital-EX commented 11 months ago

I'm doing a small game of TicTacToe with Cyber. And, I accidentally implement my play space as List[GridState] instead of List[List[GridState]]. When I assigned into this list using grid[row][col] = ..., I got the following opaque error: panic: Unknown error code. It appears to be the same message for ever type that doesn't support indexing.

The minimum code needed to recreate this is the following:

1[0] = "Kaboom!"

However, removing the assignment returns a more detailed error message:

panic: `func $index(any, int) any` can not be found in `integer`.

.../hello.cyber:1:1 main:
1[0]
fubark commented 11 months ago

This should be fixed:

panic: `func $setIndex(any, int, string) any` can not be found in `integer`.

/Users/fubar/dev/cyber/foo.cy:7:1 main:
1[0] = "Kaboom!"
^