skogsbaer / write-your-python-program

BSD 3-Clause "New" or "Revised" License
1 stars 4 forks source link

Bug with nonempty_list() and nonempty_string() #162

Closed skogsbaer closed 2 days ago

skogsbaer commented 2 days ago
-module(nonempty_list).

-compile(export_all).
-compile(nowarn_export_all).

-spec id(nonempty_list(integer())) -> nonempty_list(integer()).
id(S) -> S.

-spec foo() -> list(integer()).
foo() -> id([1,2,3]).

wrongly fails with

test_files/tycheck/nonempty_list.erl:10:13: Type error: expression failed to type check
%   10| foo() -> id([1,2,3]).
%     |

Similarly,

-module(nonempty_string).

-compile(export_all).
-compile(nowarn_export_all).

-spec id(nonempty_string()) -> nonempty_string().
id(S) -> S.

-spec foo() -> string().
foo() -> id("blub").

wrongly fails with

test_files/tycheck/nonempty_string.erl:10:13: Type error: expression failed to type check
%   10| foo() -> id("blub").
%     |
skogsbaer commented 2 days ago

wrong repo