Improve inference broadly throughout REPL (#37081)
* REPL: move Options to improve inference
Moving this earlier in the load sequence allows one to annotate the
return type of some methods.
* REPL: add interfaces for abstract types and change one field type
Since MIState and others have containers with abstract typing, these interfaces
fix inference problems broadly.
* IO: improve inferrability of write and unsafe_write
* REPL: add argument typing and improve implementations
Since entire modules are marked `@nospecialize`, we need
to declare argument types anywhere we want good inference.
This also improves numerous implementations to ensure
inferrability.
For the completion methods, notice this changes typeof(ret[2]) from
UnitRange{Int64} to UnitRange{Int}. Internally, the methods are using
Int rather than Int64, so consistently supporting Int64 would require
more extensive changes.
* REPL: add argtypes to keymap functions
* REPL: test inference in LineEdit