diff options
author | Hans Bolinder <[email protected]> | 2017-05-22 15:22:32 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2017-05-22 15:22:32 +0200 |
commit | dfbefdcc85b2785e4d2280c1b70de8fd14a6778d (patch) | |
tree | 10a062d0060eed5ae83dfffdfea290c1ef94753a | |
parent | 7247cb6fa047ca7c968b88f279832f39ea0b04f7 (diff) | |
parent | 838dde1e27ee6a6debf74cf2370b2284f618b348 (diff) | |
download | otp-dfbefdcc85b2785e4d2280c1b70de8fd14a6778d.tar.gz otp-dfbefdcc85b2785e4d2280c1b70de8fd14a6778d.tar.bz2 otp-dfbefdcc85b2785e4d2280c1b70de8fd14a6778d.zip |
Merge branch 'hasse/stdlib/linter_check_dialyzer/OTP-14323'
* hasse/stdlib/linter_check_dialyzer/OTP-14323:
stdlib: Warn for bad type variables of parameterized types
-rw-r--r-- | lib/stdlib/src/erl_parse.yrl | 3 | ||||
-rw-r--r-- | lib/stdlib/test/erl_lint_SUITE.erl | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/stdlib/src/erl_parse.yrl b/lib/stdlib/src/erl_parse.yrl index 2dcddeb8c2..733932e711 100644 --- a/lib/stdlib/src/erl_parse.yrl +++ b/lib/stdlib/src/erl_parse.yrl @@ -1052,6 +1052,9 @@ build_typed_attribute({atom,Aa,record}, build_typed_attribute({atom,Aa,Attr}, {type_def, {call,_,{atom,_,TypeName},Args}, Type}) when Attr =:= 'type' ; Attr =:= 'opaque' -> + lists:foreach(fun({var, A, '_'}) -> ret_err(A, "bad type variable"); + (_) -> ok + end, Args), case lists:all(fun({var, _, _}) -> true; (_) -> false end, Args) of diff --git a/lib/stdlib/test/erl_lint_SUITE.erl b/lib/stdlib/test/erl_lint_SUITE.erl index 02524679fa..cc3d605840 100644 --- a/lib/stdlib/test/erl_lint_SUITE.erl +++ b/lib/stdlib/test/erl_lint_SUITE.erl @@ -3978,7 +3978,11 @@ otp_14323(Config) -> {13,erl_lint,{undefined_function,{a,1}}}, {14,erl_lint,{bad_dialyzer_attribute, {nowarn_function,{a,-1}}}}], - []}}], + []}}, + {otp_14323_2, + <<"-type t(_) :: atom().">>, + [], + {errors,[{1,erl_parse,"bad type variable"}],[]}}], [] = run(Config, Ts), ok. |