Skip to content

Commit e01f958

Browse files
author
José Valim
committed
Allow match syntax on nested records, closes #871
1 parent 35d0edb commit e01f958

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/elixir/src/elixir_macros.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ translate({defmodule, Meta, [Ref, KV]}, S) ->
215215
{ TRef, S }
216216
end,
217217

218-
{ elixir_module:translate(Meta, FRef, Block, S#elixir_scope{check_clauses=true}), FS };
218+
{ elixir_module:translate(Meta, FRef, Block, FS#elixir_scope{check_clauses=true}), FS };
219219

220220
translate({Kind, Meta, [Call]}, S) when ?FUNS(Kind) ->
221221
translate({Kind, Meta, [Call, nil]}, S);

lib/elixir/test/elixir/record_test.exs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ end
3333
defmodule RecordTest.Macros do
3434
defrecordp :_user, name: "José", age: 25
3535

36+
defrecord Nested do
37+
def nested_record_alias?(Nested[]) do
38+
true
39+
end
40+
end
41+
3642
def new() do
3743
_user()
3844
end

0 commit comments

Comments
 (0)