Lee icon indicating copy to clipboard operation
Lee copied to clipboard

Lee CLI (or typerefl?) doesn't desugar types before running them through from_string

Open k32 opened this issue 1 year ago • 0 comments

This works:

            #{ apps =>
                 {[value, cli_positional],
                  #{ type => list(atom())
                   , default => []
                   , cli_arg_position => rest
                   }}

This doesn't:

            #{ apps =>
                 {[value, cli_positional],
                  #{ type => [atom()]
                   , default => []
                   , cli_arg_position => rest
                   }}

Exception:

escript: exception error: no match of right hand side value 
                 [{'$type_refl',#{name => "atom()",
                                  check => fun erlang:is_atom/1,
                                  from_string => #Fun<typerefl.1.20223721>}}]
  in function  typerefl:from_string/2 (vendor/typerefl/src/typerefl.erl, line 176)
  in call from typerefl:from_string_/2 (vendor/typerefl/src/typerefl.erl, line 211)
  in call from lee:from_strings/3 (vendor/lee/src/framework/lee.erl, line 268)
  in call from lee_cli:zip_positionals/4 (vendor/lee/src/metatypes/lee_cli.erl, line 395)
  in call from lee_cli:parse_args/3 (vendor/lee/src/metatypes/lee_cli.erl, line 380)
  in call from lee_cli:parse_command/3 (vendor/lee/src/metatypes/lee_cli.erl, line 333)
  in call from lee_cli:'-read/2-fun-0-'/4 (vendor/lee/src/metatypes/lee_cli.erl, line 180)
  in call from lists:foldl/3 (lists.erl, line 1594)
[me@Strelizia 01:59:05]~/Documents/personal/anvl

k32 avatar Mar 03 '24 01:03 k32