brownplt / pyret-lang

The Pyret language.
Other
1.07k stars 111 forks source link

internal error #1720

Closed shriram closed 6 months ago

shriram commented 1 year ago
include tables

r = [raw-row: 1, 2]

Internal errors prevented this error message from being shown. Please report this as a bug.

blerner commented 6 months ago

This is because raw-row currently expects you to provide an array of pairs {"col-name"; value}. This is documented, at https://pyret.org/docs/latest/tables.html#%28part._tables_raw-row%29. The easiest way for me to fix this is to add annotations to raw-row.make# to ensure the arguments are tuples. It'll generate somewhat ugly errors though: image I can't think of any easy way to make those errors better, though...

blerner commented 6 months ago

@jpolitz the only way I can think to improve these errors is to define new annotations in JS, akin to how we define annListColor in the image libraries. But table.js is a JSModuleReturn, not a normal ModuleReturn, and I'm not sure how much would need to change to fix that...