From 8db6c68b2d748e4a72445959f205d8d6c4dd18ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20G=C3=B6m=C3=B6ri?= Date: Thu, 13 Oct 2016 23:02:37 +0200 Subject: dbg:fun2ms: allow empty list as head Running 'dbg:fun2ms(fun([]) -> return_trace() end' resulted in an error "dbg:fun2ms requires fun with single variable or list parameter" But the empty list is actually a list and it is a valid value as a match-spec head (matching on arity-0 functions). Although its practical use is questionable this commit eliminates a small limitation of ms_transform which is not present in the match-spec grammar. --- lib/stdlib/src/ms_transform.erl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/stdlib/src') diff --git a/lib/stdlib/src/ms_transform.erl b/lib/stdlib/src/ms_transform.erl index c0eea652e7..98745b13f3 100644 --- a/lib/stdlib/src/ms_transform.erl +++ b/lib/stdlib/src/ms_transform.erl @@ -451,6 +451,8 @@ check_type(_,[{record,_,_,_}],ets) -> ok; check_type(_,[{cons,_,_,_}],dbg) -> ok; +check_type(_,[{nil,_}],dbg) -> + ok; check_type(Line0,[{match,_,{var,_,_},X}],Any) -> check_type(Line0,[X],Any); check_type(Line0,[{match,_,X,{var,_,_}}],Any) -> -- cgit v1.2.3