elm-lang / elm-repl

A REPL for Elm
BSD 3-Clause "New" or "Revised" License
170 stars 34 forks source link

Copying and pasting code into REPL results in cryptic Deltron 3030 error #164

Open Widdershin opened 6 years ago

Widdershin commented 6 years ago

Hello,

I have encountered a strange piece of behaviour using elm-repl.

Steps to reproduce:

1) Copy the following two lines:

import List
a = []

2) Open elm-repl, and paste the contents of your clipboard.

Expected result:

> import List
> a = []
[] : List a

Actual result:

 λ elm-repl
---- elm-repl 0.18.0 -----------------------------------------------------------
 :help for help, :exit to exit, more at <https://github.com/elm-lang/elm-repl>
--------------------------------------------------------------------------------
> import List

> a = []

/Users/nickj/Projects/<redacted>/repl-temp-000.js:6
 = d_e_l_t_r_o_n_3_0_3_0
 ^
SyntaxError: Unexpected token =
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:390:7)
    at startup (bootstrap_node.js:150:9)

Strangely enough, this behaviour is only apparent when copying and pasting multiple lines of code, not when typing the lines out by hand.

Additionally, it doesn't seem to matter which library we import (List is purely an example here).

OS: macOS Sierra 10.12.6 elm version: 0.18 node version: v6.10.3

process-bot commented 6 years ago

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.