From e0c6766a79ad2233ffa3a4300a6eabfb2de31c17 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 21 Feb 2020 18:55:18 +0100 Subject: [PATCH] make "unreachable code" a warning in non-prod builds --- vlib/compiler/aparser.v | 2 +- vlib/v/fmt/tests/simple_expected.vv | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/vlib/compiler/aparser.v b/vlib/compiler/aparser.v index 51bb1c9cfa..c5c4405419 100644 --- a/vlib/compiler/aparser.v +++ b/vlib/compiler/aparser.v @@ -1424,7 +1424,7 @@ fn (p mut Parser) gen(s string) { fn (p mut Parser) statement(add_semi bool) string { p.expected_type = '' if p.returns { - p.error('unreachable code') + p.warn_or_error('unreachable code') } // if !p.in_dispatch { p.cgen.is_tmp = false diff --git a/vlib/v/fmt/tests/simple_expected.vv b/vlib/v/fmt/tests/simple_expected.vv index df17c630a3..da2d668b52 100644 --- a/vlib/v/fmt/tests/simple_expected.vv +++ b/vlib/v/fmt/tests/simple_expected.vv @@ -76,6 +76,5 @@ fn get_user() ?User { fn get_user_ptr() &User { return &User{ - } }