expr icon indicating copy to clipboard operation
expr copied to clipboard

Nature filter & map elem type

Open antonmedv opened this issue 1 year ago • 0 comments

filter & map returns []any type. In nature we can keep actual type and implement nature.Elem() method to get correct underlying type.

Those type checker error cases should be able to pass:

map(Any, {0})[0] + "str"
invalid operation: + (mismatched types int and string) (1:18)
 | map(Any, {0})[0] + "str"
 | .................^

map(filter(ArrayOfFoo, {true}), {.Not})
type mock.Foo has no field Not (1:35)
 | map(filter(ArrayOfFoo, {true}), {.Not})
 | ..................................^

antonmedv avatar Feb 13 '24 22:02 antonmedv