Commit 3de9ae0
committed
Fix partial record matching in map generator
When attempting to match part of a record in the key of a map
generator, the entire record would be matched.
Example:
-module(t).
-export([test/0]).
-record(r, {a,b}).
f(Map) ->
[V || #r{a=N} := V <- Map, is_integer(N)].
test() ->
f(#{#r{a=1} => 1, #r{a=2,b=42} => 2}).
It would be expected that `t:test()` would return `[1,2]`, but it
returned `[1]` because the entire record was matched, instead of just
field `a`. Therefore, only the first record `#r{a=1,b=undefined}`
would match.
Fixes #78751 parent c41d424 commit 3de9ae0
File tree
2 files changed
+22
-3
lines changed- lib
- compiler/test
- stdlib/src
2 files changed
+22
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| |||
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
109 | 125 | | |
110 | 126 | | |
111 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
529 | | - | |
530 | | - | |
531 | | - | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
532 | 535 | | |
533 | 536 | | |
534 | 537 | | |
| |||
0 commit comments