Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize away annotated types #178

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/typechecker.erl
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,8 @@ normalize({op, _, _, _Arg1, _Arg2} = Op, _TEnv) ->
erl_eval:partial_eval(Op);
normalize({type, Ann, range, [T1, T2]}, TEnv) ->
{type, Ann, range, [normalize(T1, TEnv), normalize(T2, TEnv)]};
normalize({ann_type, _, [_Name, T]}, TEnv) ->
normalize(T, TEnv);
normalize(Type, _TEnv) ->
expand_builtin_aliases(Type).

Expand Down
20 changes: 20 additions & 0 deletions test/should_pass/glb_ann_types.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-module(glb_ann_types).

-compile(export_all).

-type type() :: erl_parse:abstract_type().
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?TYPE_MOD here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed. (but this whole testcase is just temporary to help track down the issue)


-define(TYPE_MOD, erl_parse).
%%-define(TYPE_MOD, gradualizer_type).

-spec type_check_comprehension_in(
Expr :: erl_parse:abstract_expr(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?TYPE_MOD here?

Qualifiers :: [ListGen |Filter|BinGen]) ->
{map(), constraints:constraints()}
when
ListGen :: {generate, erl_anno:anno(), ?TYPE_MOD:abstract_expr(), ?TYPE_MOD:abstract_expr()},
BinGen :: {b_generate, erl_anno:anno(), ?TYPE_MOD:abstract_expr(), ?TYPE_MOD:abstract_expr()},
Filter :: ?TYPE_MOD:abstract_expr().
type_check_comprehension_in(Expr, [{generate, P_Gen, Pat, Gen} | Quals]) ->
{#{}, constraints:empty()}.