From: Jean Privat Date: Fri, 28 Aug 2009 15:40:39 +0000 (-0400) Subject: syntax: warn on 'while true do' and suggests 'loop' X-Git-Tag: v0.3~5 X-Git-Url: http://nitlanguage.org syntax: warn on 'while true do' and suggests 'loop' Signed-off-by: Jean Privat --- diff --git a/src/syntax/typing.nit b/src/syntax/typing.nit index 70e7d5d..f9fb4a6 100644 --- a/src/syntax/typing.nit +++ b/src/syntax/typing.nit @@ -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)