aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/doc
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2012-08-20 10:11:38 +0200
committerBjörn Gustavsson <[email protected]>2012-10-09 15:24:38 +0200
commit562cf135b9518985d172d291665eb32f891032fb (patch)
treeb2bd122624ba23a6dae83a379ad652e59efea94e /lib/compiler/doc
parentb68297d347a9a041854410a77861982b1d0861d2 (diff)
downloadotp-562cf135b9518985d172d291665eb32f891032fb.tar.gz
otp-562cf135b9518985d172d291665eb32f891032fb.tar.bz2
otp-562cf135b9518985d172d291665eb32f891032fb.zip
v3_kernel: Fix match code for matched out segment size in multiple clauses
When matched variable is used as a size field in multiple clauses, as in: foo(<<L:8,A:L>>) -> A; foo(<<L:8,A:L,B:8>>) -> {A,B}. the match tree would branch out before the segment that used the matched-out variable (in this example, the tree would branch out before the matching of A:L). That happens because the pattern matching compilator did not take variable substitutions into account when grouping clauses that match the same value. That is, the generated code would work similarly to this code: foo(<<L:8,T/binary>>) -> case T of <<A:L>> -> A; _ -> case T of <<A:L,B:8>> -> %% A matched out again! {A,B} end end. We would like the matching to work more like: foo(<<L,A:L,T/binary>>) -> case T of <<>> -> A; <<B:8>> -> {A,B} end. Fix the problem by taking the substitutions into account when grouping clauses that match out the same value.
Diffstat (limited to 'lib/compiler/doc')
0 files changed, 0 insertions, 0 deletions