brownplt / pyret-lang

The Pyret language.
Other
1.06k stars 106 forks source link

internal error #1234

Closed shriram closed 6 years ago

shriram commented 6 years ago

https://code.pyret.org/editor#share=0Bzqv7wmuHqw_Y2UzV01jVFBTbnM&v=c718f28

image

sorawee commented 6 years ago

I got different error

SyntaxError: missing ] after element list makeConstructor@https://d251z2akfyabv3.cloudfront.net/releases/c718f28/cpo-main.jarr.gz.js:249315:24
makeVariantConstructor/funToReturn<@https://d251z2akfyabv3.cloudfront.net/releases/c718f28/cpo-main.jarr.gz.js:249324:22
_15bba60659108158b2823fb18f401db5d8d392c40ede0b291334932471a8a995__13@https://code.pyret.org/editor#share=0Bzqv7wmuHqw_Y2UzV01jVFBTbnM&v=c718f28:652:10
_15bba60659108158b2823fb18f401db5d8d392c40ede0b291334932471a8a995__131@https://code.pyret.org/editor#share=0Bzqv7wmuHqw_Y2UzV01jVFBTbnM&v=c718f28:2455:11
_0c7f739838d9820c63f315aec95da7c9888d64abd744be6ad05d68a9be553de0__28@https://code.pyret.org/editor#share=0Bzqv7wmuHqw_Y2UzV01jVFBTbnM&v=c718f28:482:10
execThunk/</<@https://d251z2akfyabv3.cloudfront.net/releases/c718f28/cpo-main.jarr.gz.js:247800:18
run/kickoff<@https://d251z2akfyabv3.cloudfront.net/releases/c718f28/cpo-main.jarr.gz.js:247399:18
iter@https://d251z2akfyabv3.cloudfront.net/releases/c718f28/cpo-main.jarr.gz.js:247517:23
run@https://d251z2akfyabv3.cloudfront.net/releases/c718f28/cpo-main.jarr.gz.js:247616:7
execThunk/<@https://d251z2akfyabv3.cloudfront.net/releases/c718f28/cpo-main.jarr.gz.js:247799:9
iter@https://d251z2akfyabv3.cloudfront.net/releases/c718f28/cpo-main.jarr.gz.js:247543:37
run@https://d251z2akfyabv3.cloudfront.net/releases/c718f28/cpo-main.jarr.gz.js:247616:7
execThunk/<@https://d251z2akfyabv3.cloudfront.net/releases/c718f28/cpo-main.jarr.gz.js:247799:9
iter@https://d251z2akfyabv3.cloudfront.net/releases/c718f28/cpo-main.jarr.gz.js:247543:37
run@https://d251z2akfyabv3.cloudfront.net/releases/c718f28/cpo-main.jarr.gz.js:247616:7
runThunk@https://d251z2akfyabv3.cloudfront.net/releases/c718f28/cpo-main.jarr.gz.js:247778:14
runStandalone/</</</instantiated<@https://d251z2akfyabv3.cloudfront.net/releases/c718f28/cpo-main.jarr.gz.js:249174:19
_fulfilled@https://code.pyret.org/js/q.js:834:54
Promise.prototype.then/</<@https://code.pyret.org/js/q.js:863:30
Promise/promise.promiseDispatch@https://code.pyret.org/js/q.js:796:13
defer/promise.promiseDispatch/<@https://code.pyret.org/js/q.js:556:17
runSingle@https://code.pyret.org/js/q.js:137:13
flush@https://code.pyret.org/js/q.js:125:13
EventHandlerNonNull*nextTick</channel.port1.onmessage@https://code.pyret.org/js/q.js:218:13
EventHandlerNonNull*nextTick<@https://code.pyret.org/js/q.js:216:9
@https://code.pyret.org/js/q.js:101:16
@https://code.pyret.org/js/q.js:66:20
@https://code.pyret.org/js/q.js:29:2
blerner commented 6 years ago

I'm guessing maybe the chaff3 file that's being included has been modified? (This is an annoying potential frustration mode for debugging important internal errors like these!) @shriram is is possible to email the student who wrote this, and ask for their older buggy version too? Otherwise we can't reproduce this...

jpolitz commented 6 years ago

I know what's happening. It's an escaping error in some fancy optimization that uses an eval.

Remove the apostrophe from the filename that's being included (...doesn't-...) and it will work. I'll add a fix soon.

Whoever owns the "doesn't-work-if..." file can open it using

https://code.pyret.org/editor#program=0Bzqv7wmuHqw_MVBKMm9pYnJBOEU

Use file ->rename it by removing the ', and it should fix it for anyone who is importing it.

blerner commented 6 years ago

Wow. That's...impressive debugging for so few clues :) Also, Little Bobby Tables seems to strike again.

jpolitz commented 6 years ago

This one's totally my fault, and has actually been in the system for between 1 and 2 years now. It's in the logic that lazily creates constructors at runtime on their first call, rather than generating all the code statically.

It includes source information in the string it creates, and it appears I was careless.

jpolitz commented 6 years ago

(Everyone repeat after me: filenames are untrusted user input, filenames are untrusted user input)

sorawee commented 6 years ago

@jpolitz are you sure that sharing a renamed file will really make the file rename (sorry for a confusing sentence)? I tried that in the past and it doesn't work.

filenames are untrusted user input, filenames are untrusted user input

jpolitz commented 6 years ago

The edit I'm suggesting is to rename the already-published file, rather than re-publishing the file.

I guess this will make users have to change the name (since the import checks the name against the "real name" of the file).

I didn't think of that; it might be best to just have users change the import line to something new.