mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Incorrect error message when $eval is provided an invalid string. #1570
This commit is contained in:
@@ -45,6 +45,7 @@
|
|||||||
- `if (try foo)` was handled incorrectly inside a defer.
|
- `if (try foo)` was handled incorrectly inside a defer.
|
||||||
- `&self` argument not implicitly null checked. #1556.
|
- `&self` argument not implicitly null checked. #1556.
|
||||||
- `(uptr)&((Foo*)null).a` incorrectly inserts a null check. #1544
|
- `(uptr)&((Foo*)null).a` incorrectly inserts a null check. #1544
|
||||||
|
- Incorrect error message when `$eval` is provided an invalid string. #1570
|
||||||
|
|
||||||
### Stdlib changes
|
### Stdlib changes
|
||||||
- Remove unintended print of `char[]` as String
|
- Remove unintended print of `char[]` as String
|
||||||
|
|||||||
@@ -8077,7 +8077,7 @@ RETRY:
|
|||||||
case TYPE_INFO_EVALTYPE:
|
case TYPE_INFO_EVALTYPE:
|
||||||
{
|
{
|
||||||
Expr *expr = type_info->unresolved_type_expr;
|
Expr *expr = type_info->unresolved_type_expr;
|
||||||
expr = sema_ct_eval_expr(context, "$evaltype", expr, false);
|
expr = sema_ct_eval_expr(context, true, expr, false);
|
||||||
if (!expr) return NULL;
|
if (!expr) return NULL;
|
||||||
if (expr->expr_kind != EXPR_TYPEINFO)
|
if (expr->expr_kind != EXPR_TYPEINFO)
|
||||||
{
|
{
|
||||||
@@ -8869,7 +8869,7 @@ static inline bool sema_expr_analyse_ct_eval(SemaContext *context, Expr *expr, C
|
|||||||
{
|
{
|
||||||
TokenType type;
|
TokenType type;
|
||||||
Path *path = NULL;
|
Path *path = NULL;
|
||||||
Expr *result = sema_ct_eval_expr(context, "$eval", expr->inner_expr, true);
|
Expr *result = sema_ct_eval_expr(context, false, expr->inner_expr, true);
|
||||||
if (!result) return false;
|
if (!result) return false;
|
||||||
if (result->expr_kind == EXPR_TYPEINFO)
|
if (result->expr_kind == EXPR_TYPEINFO)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ static bool sema_resolve_type_identifier(SemaContext *context, TypeInfo *type_in
|
|||||||
INLINE bool sema_resolve_evaltype(SemaContext *context, TypeInfo *type_info, ResolveTypeKind resolve_kind)
|
INLINE bool sema_resolve_evaltype(SemaContext *context, TypeInfo *type_info, ResolveTypeKind resolve_kind)
|
||||||
{
|
{
|
||||||
Expr *expr = type_info->unresolved_type_expr;
|
Expr *expr = type_info->unresolved_type_expr;
|
||||||
Expr *inner = sema_ct_eval_expr(context, "$evaltype", expr, true);
|
Expr *inner = sema_ct_eval_expr(context, true, expr, true);
|
||||||
if (!inner) return type_info_poison(type_info);
|
if (!inner) return type_info_poison(type_info);
|
||||||
if (inner->expr_kind != EXPR_TYPEINFO)
|
if (inner->expr_kind != EXPR_TYPEINFO)
|
||||||
{
|
{
|
||||||
|
|||||||
10
test/test_suite/compile_time/ct_eval_wrong.c3
Normal file
10
test/test_suite/compile_time/ct_eval_wrong.c3
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import std::io;
|
||||||
|
|
||||||
|
fn void main()
|
||||||
|
{
|
||||||
|
$eval("foo()"); // #error: with $eval
|
||||||
|
}
|
||||||
|
fn void foo()
|
||||||
|
{
|
||||||
|
io::printfn("foo");
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user