diff options
-rw-r--r-- | perl_checker.src/parser_helper.ml | 9 | ||||
-rw-r--r-- | perl_checker.src/test/context.t | 2 | ||||
-rw-r--r-- | perl_checker.src/types.mli | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml index ca28aa8..9eca21a 100644 --- a/perl_checker.src/parser_helper.ml +++ b/perl_checker.src/parser_helper.ml @@ -370,13 +370,14 @@ let word_alone esp = | "hex" | "length" | "time" | "fork" | "getppid" -> M_int | "eof" | "wantarray" -> M_int | "stat" | "lstat" -> M_list - | "arch" | "quotemeta" | "lc" | "lcfirst" | "uc" | "ucfirst" -> M_string + | "arch" | "quotemeta" | "join" | "lc" | "lcfirst" | "uc" | "ucfirst" -> M_string | "split" -> M_array | "shift" | "pop" -> M_scalar | "die" | "return" | "redo" | "next" | "last" -> M_unknown | "caller" -> M_mixed [M_string ; M_list] - + | "undef" -> M_undef + | "ref" -> M_ref M_scalar | _ -> M_unknown in mcontext, e @@ -1044,6 +1045,7 @@ let rec mcontext2s = function | M_string -> "string" | M_ref c -> "ref(" ^ mcontext2s c ^ ")" | M_revision -> "revision" + | M_undef -> "undef" | M_sub -> "sub" | M_scalar -> "scalar" @@ -1057,7 +1059,7 @@ let rec mcontext2s = function | M_mixed l -> String.concat " | " (List.map mcontext2s l) let mcontext_is_scalar = function - | M_int | M_float | M_string | M_ref _ | M_revision + | M_int | M_float | M_string | M_ref _ | M_revision | M_undef | M_scalar | M_array -> true | _ -> false @@ -1075,6 +1077,7 @@ let rec mcontext_lower c1 c2 = | M_ref _, M_scalar | M_ref _, M_list | M_string, M_string | M_string, M_scalar | M_string, M_list | M_revision, M_revision | M_revision, M_scalar | M_revision, M_list + | M_undef, M_undef | M_undef, M_scalar | M_undef, M_list | M_scalar, M_scalar | M_scalar, M_list -> true diff --git a/perl_checker.src/test/context.t b/perl_checker.src/test/context.t index 5fd7809..edb0452 100644 --- a/perl_checker.src/test/context.t +++ b/perl_checker.src/test/context.t @@ -13,3 +13,5 @@ length @l never use "length @l", it returns the l 'xxx' > 'yyy' you should use a string operator, not the number operator ">" 1 cmp 2 you should use a number operator, not the string operator "cmp" (or replace the number with a string) + +$xxx == undef context undef is not compatible with context float diff --git a/perl_checker.src/types.mli b/perl_checker.src/types.mli index e10e8f5..bff90ca 100644 --- a/perl_checker.src/types.mli +++ b/perl_checker.src/types.mli @@ -17,7 +17,7 @@ type maybe_context = | M_none | M_bool - | M_int | M_float | M_string | M_ref of maybe_context | M_revision | M_sub + | M_int | M_float | M_string | M_ref of maybe_context | M_revision | M_sub | M_undef | M_scalar | M_tuple of maybe_context list |