aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/io_proto_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2010-03-12 09:39:23 +0100
committerBjörn Gustavsson <[email protected]>2010-06-02 11:51:25 +0200
commit7ac0808979534a94617c3391503c961d1ef72755 (patch)
treef929be0d00318569bef8d37ecf316512b17a1b19 /lib/stdlib/test/io_proto_SUITE.erl
parent1858cb81391d2bce29b4b7620574ca60128cebf7 (diff)
downloadotp-7ac0808979534a94617c3391503c961d1ef72755.tar.gz
otp-7ac0808979534a94617c3391503c961d1ef72755.tar.bz2
otp-7ac0808979534a94617c3391503c961d1ef72755.zip
Evaluate element/2 at compile-time using type information
The erl_expand_records compiler pass translates the following code: h(X) when X#r1.a =:= 1 -> ok. to (essentially): h({r1,V1,V2}=X) when element(2, X) =:= 1 -> ok. Since the guard can only be executed when the pattern matching has succeeded, we know that the second element in the tuple X must have been bound to V2. Thus we can eliminate the call to element/2 like this: h({r1,V1,V2}=X) when V1 =:= 1 -> ok.
Diffstat (limited to 'lib/stdlib/test/io_proto_SUITE.erl')
0 files changed, 0 insertions, 0 deletions