diff --git a/src/build/build_options.c b/src/build/build_options.c index e0e4b4dce..0dd59c381 100644 --- a/src/build/build_options.c +++ b/src/build/build_options.c @@ -92,7 +92,7 @@ static void usage(bool full) print_opt("-U ", "Remove feature flag ."); PRINTF(""); print_opt("--about", "Prints a short description of C3."); - print_opt("--build-env", "Prints build environment information."); + print_opt("--build-env", "Prints build environment information (only valid with in combination with a command such as 'compile')."); print_opt("--libdir ", "Add this directory to the c3l library search paths."); print_opt("--lib ", "Add this c3l library to the compilation."); if (full) diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index 472de46c9..7e65de9e9 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -10169,9 +10169,9 @@ bool sema_expr_check_discard(SemaContext *context, Expr *expr) return true; } if (!IS_OPTIONAL(expr)) return true; - RETURN_SEMA_ERROR(expr, "An optional value may not be discarded, you can ignore it with a void cast '(void)', rethrow on optional with '!' or panic '!!' to avoid this error."); + RETURN_SEMA_ERROR(expr, "An optional value was discarded, you can assign it to a variable, ignore it with a void cast '(void)', rethrow on optional with '!' or panic '!!' to avoid this error."); ERROR_ARGS: - RETURN_SEMA_ERROR(expr, "The result of this call is optional due to its argument(s). The optional result may not be implicitly discarded. Consider using '(void)', '!' or '!!' to handle this."); + RETURN_SEMA_ERROR(expr, "The result of this call is optional due to its argument(s). This optional result may not be implicitly discarded. Please assign it to a variable, ignore it with '(void)', rethrow with '!' or panic with '!!'."); } bool sema_analyse_expr(SemaContext *context, Expr *expr) diff --git a/test/test_suite/errors/optional_designated.c3 b/test/test_suite/errors/optional_designated.c3 index 65185ae13..ca8cbceb5 100644 --- a/test/test_suite/errors/optional_designated.c3 +++ b/test/test_suite/errors/optional_designated.c3 @@ -4,7 +4,7 @@ struct Foo { int a; } struct Bar { int b; Foo f; } fn void main() { - (Bar) { .f = (Foo) { foo() } }; // #error: not be discarded + (Bar) { .f = (Foo) { foo() } }; // #error: An optional value was discarded } fn int? foo() => 1; \ No newline at end of file diff --git a/test/test_suite/errors/optional_discarded_func.c3 b/test/test_suite/errors/optional_discarded_func.c3 index f7689fba5..117b8f2b5 100644 --- a/test/test_suite/errors/optional_discarded_func.c3 +++ b/test/test_suite/errors/optional_discarded_func.c3 @@ -14,7 +14,7 @@ fn void test2() int? x; int y; abc(y); - abc(x) + 4; // #error: An optional value may not be discarded + abc(x) + 4; // #error: An optional value was discarded } fn void test3() @@ -30,7 +30,7 @@ fn void test4() int? x; int y; def2(1); - def2(x) + 4; // #error: An optional value may not be discarded + def2(x) + 4; // #error: An optional value was discarded } fn void test5() @@ -50,5 +50,5 @@ fn void test6() fn void test7() { int y; - def3(y) + 4; // #error: An optional value may not be discarded + def3(y) + 4; // #error: An optional value was discarded } diff --git a/test/test_suite/errors/optional_discarded_macro.c3 b/test/test_suite/errors/optional_discarded_macro.c3 index f33c588b0..1ad4ef90c 100644 --- a/test/test_suite/errors/optional_discarded_macro.c3 +++ b/test/test_suite/errors/optional_discarded_macro.c3 @@ -14,7 +14,7 @@ fn void test2() int? x; int y; abc(y); - abc(x) + 4; // #error: An optional value may not be discarded + abc(x) + 4; // #error: An optional value was discarded } fn void test3() @@ -30,7 +30,7 @@ fn void test4() int? x; int y; def2(1); - def2(x) + 4; // #error: An optional value may not be discarded + def2(x) + 4; // #error: An optional value was discarded } fn void test5() @@ -50,5 +50,5 @@ fn void test6() fn void test7() { int y; - def3(y) + 4; // #error: An optional value may not be discarded + def3(y) + 4; // #error: An optional value was discarded }