elixir-lang/elixir — pull request #1000 by mururu (2013-05-02 07:17:32+00:00)
Title: Fix unexpected error in Kernel.CLI.main

This issue similar to #961.

now:

```
$ elixir -e "あ"
{"init terminating in do_boot",{badarg,[{erlang,list_to_binary,[[12354]],[]},{'Elixir-Kernel-CLI','-main/1-lc$^0/1-0-',1,[{file,"/Users/yuki_ito/.exenv/versions/master/lib/elixir/lib/kernel/cli.ex"},{line,12}]},{'Elixir-Kernel-CLI','-main/1-lc$^0/1-0-',1,[{file,"/Users/yuki_ito/.exenv/versions/master/lib/elixir/lib/kernel/cli.ex"},{line,12}]},{'Elixir-Kernel-CLI',main,1,[{file,"/Users/yuki_ito/.exenv/versions/master/lib/elixir/lib/kernel/cli.ex"},{line,12}]},{init,start_it,1,[]},{init,start_em,1,[]}]}}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
```

```
$ elixir -e "æ"
** (FunctionClauseError) no function clause matching: :elixir.eval({:incomplete,[],<<230>>}, [], 1, {:elixir_scope,nil,false,true,false,false,false,nil,nil,[],[],nil,nil,[],nil,[],[],[],"nofile",[Kernel,Kernel.Typespec,Record],[],[{Kernel,[!: 1, !=: 2, !==: 2, &&: 2, *: 2, +: 1, +: 2, ++: 2, -: 1, -: 2, --: 2, ..: 2, /: 2, <: 2, <-: 2, <=: 2, <>: 2, ==: 2, ===: 2, =~: 2, >: 2, >=: 2, @: 1, __B__: 2, __C__: 2, __R__: 2, __W__: 2, __b__: 2, __c__: 2, __r__: 2, __w__: 2, access: 2, and: 2, apply: 2, apply: 3, atom_to_binary: 1, binary_to_atom: 1, binary_to_existing_atom: 1, binary_to_float: 1, binary_to_integer: 1, binary_to_integer: 2, case: 2, cond: 1, def: 1, def: 2, def: 4, defdelegate: 2, defexception: 2, defexception: 3, defexception: 4, defimpl: 2, defimpl: 3, defmacro: 1, defmacro: 2, defmacro: 4, defmacrop: 1, defmacrop: 2, defmacrop: 4, defmodule: 2, defoverridable: 1, defp: 1, defp: 2, defp: 4, defprotocol: 2, defrecord: 2, defrecord: 3, defrecord: 4, defrecordp: 2, delete_elem: 2, destructure: 2, div: 2, elem: 2, float_to_binary: 1, float_to_binary: 2, function: 1, function: 3, if: 2, in: 2, insert_elem: 3, inspect: 1, inspect: 2, integer_to_binary: 1, integer_to_binary: 2, is_exception: 1, is_range: 1, is_record: 1, is_record: 2, is_regex: 1, match?: 2, nil?: 1, not: 1, or: 2, receive: 1, rem: 2, set_elem: 3, setelem: 3, to_binary: 1, to_char_list: 1, try: 1, unless: 2, use: 1, use: 2, xor: 2, |>: 2, ||: 2]}],[],[{Kernel,[abs: 1, atom_to_binary: 2, atom_to_list: 1, binary_part: 3, binary_to_atom: 2, binary_to_existing_atom: 2, binary_to_list: 1, binary_to_list: 3, binary_to_term: 1, binary_to_term: 2, bit_size: 1, bitstring_to_list: 1, byte_size: 1, exit: 1, float: 1, float_to_list: 1, function_exported?: 3, hd: 1, integer_to_list: 1, integer_to_list: 2, iolist_size: 1, iolist_to_binary: 1, is_alive: 0, is_atom: 1, is_binary: 1, is_bitstring: 1, is_boolean: 1, is_float: 1, is_function: 1, is_function: 2, is_integer: 1, is_list: 1, is_number: 1, is_pid: 1, is_port: 1, is_reference: 1, is_tuple: 1, length: 1, list_to_atom: 1, list_to_binary: 1, list_to_bitstring: 1, list_to_existing_atom: 1, list_to_float: 1, list_to_integer: 1, list_to_integer: 2, list_to_pid: 1, list_to_tuple: 1, macro_exported?: 3, make_ref: 0, max: 2, min: 2, node: 0, node: 1, pid_to_list: 1, raise: 1, raise: 2, raise: 3, round: 1, self: 0, size: 1, spawn: 1, spawn: 3, spawn_link: 1, spawn_link: 3, term_to_binary: 1, term_to_binary: 2, throw: 1, tl: 1, trunc: 1, tuple_size: 1, tuple_to_list: 1]}]})
src/elixir.erl:95: :elixir.eval({:incomplete,[],<<230>>}, [], 1, {:elixir_scope,nil,false,true,false,false,false,nil,nil,[],[],nil,nil,[],nil,[],[],[],"nofile",[Kernel,Kernel.Typespec,Record],[],[{Kernel,[!: 1, !=: 2, !==: 2, &&: 2, *: 2, +: 1, +: 2, ++: 2, -: 1, -: 2, --: 2, ..: 2, /: 2, <: 2, <-: 2, <=: 2, <>: 2, ==: 2, ===: 2, =~: 2, >: 2, >=: 2, @: 1, __B__: 2, __C__: 2, __R__: 2, __W__: 2, __b__: 2, __c__: 2, __r__: 2, __w__: 2, access: 2, and: 2, apply: 2, apply: 3, atom_to_binary: 1, binary_to_atom: 1, binary_to_existing_atom: 1, binary_to_float: 1, binary_to_integer: 1, binary_to_integer: 2, case: 2, cond: 1, def: 1, def: 2, def: 4, defdelegate: 2, defexception: 2, defexception: 3, defexception: 4, defimpl: 2, defimpl: 3, defmacro: 1, defmacro: 2, defmacro: 4, defmacrop: 1, defmacrop: 2, defmacrop: 4, defmodule: 2, defoverridable: 1, defp: 1, defp: 2, defp: 4, defprotocol: 2, defrecord: 2, defrecord: 3, defrecord: 4, defrecordp: 2, delete_elem: 2, destructure: 2, div: 2, elem: 2, float_to_binary: %
```

fixed:

```
$ elixir -e " あ"
** (SyntaxError) nofile:1: invalid token: あ
:erlang.system_info({:purify,'Node: nonode@nohost'})
:init.do_boot/3
```

```
$ elixir -e "æ"
** (SyntaxError) nofile:1: invalid token: æ
:erlang.system_info({:purify,'Node: nonode@nohost'})
:init.do_boot/3
```