dbuenzli / down

An OCaml toplevel (REPL) upgrade
http://erratique.ch/software/down
ISC License
81 stars 3 forks source link

Exception on List.<tab> with OCaml 4.08.0 #1

Closed verbosemode closed 5 years ago

verbosemode commented 5 years ago

Typing List. followed by pressing Tab for the completion, results in an Invalid_argument exception.

Fatal error: exception Invalid_argument("String.sub / Bytes.sub")

It only happens on 4.08.0. I've tested it with 4.05.0, 4.07.1 and 4.08.0 in clean new local switches.

Here are some details about my setup:

Operating System: Debian GNU/Linux 10 (buster) Kernel: Linux 4.19.0-5-amd64 Architecture: x86-64

The steps to reproduce the issue are the following:

mkdir downtest
cd downtest
opam switch create . 4.08.0
opam pin add https://github.com/dbuenzli/down.git
opam install ocp-index
echo '#use "down.top"' > ocamlinit
ocaml -init ocamlinit
> List.<tab>

Regards,

Jochen

dbuenzli commented 5 years ago

Thanks for the report !

This is due to a parse error of ocp-index's output, 4.08 has the :: symbol

> ocp-index complete -f "%q : %t" List. # 4.08 switch
List.[] : -
List.:: : 'a * 'a list
List.length : 'a list -> int
...

Which don't seem to be reported in earlier versions:

> ocp-index complete -f "%q : %t" List. # 4.07 switch 
List.length : 'a list -> int
List.compare_lengths : 'a list -> 'b list -> int