Эх сурвалжийг харах

Do not traverse into local functions when checking return types

Taddeus Kroes 10 жил өмнө
parent
commit
970d7b6b8d
1 өөрчлөгдсөн 3 нэмэгдсэн , 0 устгасан
  1. 3 0
      phases/typecheck.ml

+ 3 - 0
phases/typecheck.ml

@@ -190,6 +190,9 @@ let rec typecheck node =
         ret, [NodeMsg (ret, sprintf "expected return value of type %s"
           (type2str ret_type))]
 
+      (* do not traverse into local functions for return statements *)
+      | FunDef _ as node -> node, []
+
       | node -> traverse_list check_types node
     in
     let err =