Fixed some bugs discovered by Claude Code
This commit is contained in:
parent
852ea7c0f7
commit
33cf23b221
10 changed files with 84 additions and 23 deletions
|
|
@ -8,6 +8,7 @@ import (
|
|||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"ucl.lmika.dev/ucl"
|
||||
)
|
||||
|
||||
|
|
@ -44,7 +45,7 @@ func (r *REPL) echoPrinter(ctx context.Context, w io.Writer, args []any) (err er
|
|||
}
|
||||
|
||||
_, err = fmt.Fprintln(w, res)
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *REPL) displayResult(ctx context.Context, w io.Writer, res any, concise bool) (err error) {
|
||||
|
|
@ -56,7 +57,7 @@ func (r *REPL) displayResult(ctx context.Context, w io.Writer, res any, concise
|
|||
|
||||
switch v := res.(type) {
|
||||
case nil:
|
||||
if _, err = fmt.Fprintln(os.Stdout, "(nil)"); err != nil {
|
||||
if _, err = fmt.Fprintln(w, "(nil)"); err != nil {
|
||||
return err
|
||||
}
|
||||
case ucl.Listable:
|
||||
|
|
@ -92,6 +93,10 @@ func (r *REPL) displayResult(ctx context.Context, w io.Writer, res any, concise
|
|||
}
|
||||
fmt.Fprintf(w, "]")
|
||||
} else {
|
||||
if v == nil {
|
||||
fmt.Fprintf(w, "(nil)")
|
||||
return nil
|
||||
}
|
||||
// In the off-chance that this is actually a slice of printables
|
||||
vt := reflect.SliceOf(reflect.TypeOf(v[0]))
|
||||
if tp, ok := r.typePrinters[vt]; ok {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue