ds26gte / pyret-lang

The Pyret language.
Other
2 stars 0 forks source link

Well-formedness error from Wescheme code #7

Closed Emmay closed 8 years ago

Emmay commented 8 years ago

This is an old BS:2 program that runs in Wescheme, but returns well-formedness errors in Spyret. You need to delete the (require...) line at the top, but otherwise I'm not clear what the Spyret errors are. http://www.wescheme.org/view?publicId=VkWBc8DRew

The "Cannot define a data expression except at the top level of a file" error still appears if the define-struct lines are copied to the very top of the file.

schanzer commented 8 years ago

Reduced test case that also fails: (define-struct w (x)) (define-struct w2 (x2))

ds26gte commented 8 years ago

Puzzled: I'm unable to replicate. Placing these in lines either the definition or the interaction window of spyret.herokuapp.com works OK.

schanzer commented 8 years ago

How odd. I'm getting this consistently on current Chrome, Safari and Firefox, both on OSX.

schanzer commented 8 years ago

Even-more-reduced test case: (define-struct w (x)) 42

ds26gte commented 8 years ago

Fixed in ds26gte/code.pyret.org@2311e58.

Previously, first-level sub-blocks (created by define-struct, say) were being spliced out only if they were the only sub-block in the program, so they worked fine for the REPL (interactions window). The current fix generalizes the splicing, so works for the definitions window too with its possibly multiple top-level expressions.

schanzer commented 8 years ago

Confirmed fixed.