diff options
author | Björn-Egil Dahlberg <[email protected]> | 2014-03-26 14:19:55 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2014-03-26 14:19:55 +0100 |
commit | c5e3c774bd12cc15a04dd9880cad6eb66d2541be (patch) | |
tree | f2794368409e9af8854cd6a87c5c1e90c64ab97b /lib/compiler/test/warnings_SUITE.erl | |
parent | dbd429512ba3fe2db4dcca1a8d9357d173718e63 (diff) | |
parent | 2d95280094fa6429081a9b9df3c73705819e2461 (diff) | |
download | otp-c5e3c774bd12cc15a04dd9880cad6eb66d2541be.tar.gz otp-c5e3c774bd12cc15a04dd9880cad6eb66d2541be.tar.bz2 otp-c5e3c774bd12cc15a04dd9880cad6eb66d2541be.zip |
Merge branch 'egil/maps-compiler-coverage'
* egil/maps-compiler-coverage:
compiler: Do not evaluate map expressions with bad keys
compiler: Throw 'nomatch' on matching with bad binary keys
compiler: Variable keys are not allowed in Maps
compiler: Strengthen Maps warnings tests
compiler: map_pair cannot be a type clause in v3_life
compiler: Remove redudant code in v3_codegen
compiler: Test deep map structure
compiler: Remove redundant clause in v3_codegen
compiler: Cover #{ [] => Var } in testcase
Diffstat (limited to 'lib/compiler/test/warnings_SUITE.erl')
-rw-r--r-- | lib/compiler/test/warnings_SUITE.erl | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/lib/compiler/test/warnings_SUITE.erl b/lib/compiler/test/warnings_SUITE.erl index c3b02819f9..ad4ad91f74 100644 --- a/lib/compiler/test/warnings_SUITE.erl +++ b/lib/compiler/test/warnings_SUITE.erl @@ -573,7 +573,48 @@ maps(Config) when is_list(Config) -> ">>, [], {warnings,[{3,sys_core_fold,no_clause_match}, - {9,sys_core_fold,nomatch_clause_type}]}}], + {9,sys_core_fold,nomatch_clause_type}]}}, + {bad_map_src1, + <<" + t() -> + M = {a,[]}, + {'EXIT',{badarg,_}} = (catch(M#{ a => 1})), + ok. + ">>, + [], + {warnings,[{4,v3_kernel,bad_map}]}}, + {bad_map_src2, + <<" + t() -> + M = id({a,[]}), + {'EXIT',{badarg,_}} = (catch(M#{ a => 1})), + ok. + id(I) -> I. + ">>, + [inline], + {warnings,[{4,v3_kernel,bad_map}]}}, + {bad_map_src3, + <<" + t() -> + {'EXIT',{badarg,_}} = (catch <<>>#{ a := 1}), + ok. + ">>, + [], + {warnings,[{3,v3_core,bad_map}]}}, + {bad_map_literal_key, + <<" + t() -> + V = id(1), + M = id(#{ <<$h,$i>> => V }), + V = case M of + #{ <<0:257>> := Val } -> Val; + #{ <<$h,$i>> := Val } -> Val + end, + ok. + id(I) -> I. + ">>, + [], + {warnings,[{6,v3_core,nomatch}]}}], run(Config, Ts), ok. |