aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-03-15 12:46:51 +0100
committerGitHub <[email protected]>2017-03-15 12:46:51 +0100
commit97dc553f9d6f73abccfbb3fe4985b097d7ebe8c2 (patch)
tree5068d7bc5428739cbd5787d4c69ec5801154a476 /lib/compiler/test
parent6cebbc8b9b5f2d18d0b142f26b4495235a60dd21 (diff)
parentb837f46ba4c3662b93bb79b56b415dce75e3d71e (diff)
downloadotp-97dc553f9d6f73abccfbb3fe4985b097d7ebe8c2.tar.gz
otp-97dc553f9d6f73abccfbb3fe4985b097d7ebe8c2.tar.bz2
otp-97dc553f9d6f73abccfbb3fe4985b097d7ebe8c2.zip
Merge pull request #1374 from bjorng/bjorn/compiler/fix-beam_type
beam_type: Avoid an internal consistency check failure
Diffstat (limited to 'lib/compiler/test')
-rw-r--r--lib/compiler/test/beam_type_SUITE.erl22
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/compiler/test/beam_type_SUITE.erl b/lib/compiler/test/beam_type_SUITE.erl
index 492067ef00..7ca544a537 100644
--- a/lib/compiler/test/beam_type_SUITE.erl
+++ b/lib/compiler/test/beam_type_SUITE.erl
@@ -22,7 +22,7 @@
-export([all/0,suite/0,groups/0,init_per_suite/1,end_per_suite/1,
init_per_group/2,end_per_group/2,
integers/1,coverage/1,booleans/1,setelement/1,cons/1,
- tuple/1]).
+ tuple/1,record_float/1]).
suite() -> [{ct_hooks,[ts_install_cth]}].
@@ -37,7 +37,8 @@ groups() ->
booleans,
setelement,
cons,
- tuple
+ tuple,
+ record_float
]}].
init_per_suite(Config) ->
@@ -126,5 +127,22 @@ tuple(_Config) ->
do_tuple() ->
{0, _} = {necessary}.
+-record(x, {a}).
+
+record_float(_Config) ->
+ 17.0 = record_float(#x{a={0}}, 1700),
+ 23.0 = record_float(#x{a={0}}, 2300.0),
+ {'EXIT',{if_clause,_}} = (catch record_float(#x{a={1}}, 88)),
+ {'EXIT',{if_clause,_}} = (catch record_float(#x{a={}}, 88)),
+ {'EXIT',{if_clause,_}} = (catch record_float(#x{}, 88)),
+ ok.
+
+record_float(R, N0) ->
+ N = N0 / 100,
+ if element(1, R#x.a) =:= 0 ->
+ N
+ end.
+
+
id(I) ->
I.