Skip to content

Commit 94c3f89

Browse files
author
José Valim
committed
Ensure we list structs and requires as compile time deps
1 parent 8a48b1d commit 94c3f89

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/elixir/src/elixir_exp.erl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,9 @@ no_alias_expansion(Other) ->
515515
Other.
516516

517517
expand_require(Meta, Ref, KV, E) ->
518+
%% We always record requires when they are defined
519+
%% as they expect the reference at compile time.
520+
elixir_lexical:record_remote(Ref, nil, ?m(E, lexical_tracker)),
518521
RE = E#{requires := ordsets:add_element(Ref, ?m(E, requires))},
519522
expand_alias(Meta, false, Ref, KV, RE).
520523

lib/elixir/src/elixir_map.erl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ expand_struct(Meta, Left, Right, E) ->
1616
{[ELeft, ERight], EE} = elixir_exp:expand_args([Left, Right], E),
1717

1818
case is_atom(ELeft) of
19-
true -> ok;
19+
true ->
20+
%% We always record structs when they are expanded
21+
%% as they expect the reference at compile time.
22+
elixir_lexical:record_remote(ELeft, nil, ?m(E, lexical_tracker));
2023
false ->
2124
compile_error(Meta, ?m(E, file), "expected struct name to be a compile "
2225
"time atom or alias, got: ~ts", ['Elixir.Macro':to_string(ELeft)])

0 commit comments

Comments
 (0)