syntax: warn on 'while true do' and suggests 'loop'
[nit.git] / src / syntax / typing.nit
index 70e7d5d..f9fb4a6 100644 (file)
@@ -540,6 +540,10 @@ redef class AWhileExpr
                v.enter_visit(n_expr)
                v.check_conform_expr(n_expr, v.type_bool)
 
+               if n_expr isa ATrueExpr then
+                       v.warning(self, "Warning: use 'loop' instead of 'while true do'.")
+               end
+
                # Prepare inside context (assert cond)
                v.use_if_true_variable_ctx(n_expr)