mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- has_tagof on tagged lambdas returns false #2432
This commit is contained in:
@@ -63,6 +63,7 @@
|
|||||||
- Taking the address of a label would cause a crash. #2430
|
- Taking the address of a label would cause a crash. #2430
|
||||||
- `@tag` was not allowed to repeat.
|
- `@tag` was not allowed to repeat.
|
||||||
- Lambdas on the top level were not exported by default. #2428
|
- Lambdas on the top level were not exported by default. #2428
|
||||||
|
- `has_tagof` on tagged lambdas returns false #2432
|
||||||
|
|
||||||
### Stdlib changes
|
### Stdlib changes
|
||||||
- Add `==` to `Pair`, `Triple` and TzDateTime. Add print to `Pair` and `Triple`.
|
- Add `==` to `Pair`, `Triple` and TzDateTime. Add print to `Pair` and `Triple`.
|
||||||
|
|||||||
@@ -4341,6 +4341,12 @@ INLINE bool expr_is_const_fault(Expr *expr)
|
|||||||
return expr->expr_kind == EXPR_CONST && expr->const_expr.const_kind == CONST_FAULT;
|
return expr->expr_kind == EXPR_CONST && expr->const_expr.const_kind == CONST_FAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INLINE bool expr_is_const_ref(Expr *expr)
|
||||||
|
{
|
||||||
|
ASSERT(expr->resolve_status == RESOLVE_DONE);
|
||||||
|
return expr->expr_kind == EXPR_CONST && expr->const_expr.const_kind == CONST_REF;
|
||||||
|
}
|
||||||
|
|
||||||
INLINE bool expr_is_const_pointer(Expr *expr)
|
INLINE bool expr_is_const_pointer(Expr *expr)
|
||||||
{
|
{
|
||||||
ASSERT(expr->resolve_status == RESOLVE_DONE);
|
ASSERT(expr->resolve_status == RESOLVE_DONE);
|
||||||
|
|||||||
@@ -5972,9 +5972,9 @@ static inline bool sema_expr_analyse_access(SemaContext *context, Expr *expr, bo
|
|||||||
{
|
{
|
||||||
return sema_expr_analyse_type_access(context, expr, parent->type_expr->type, identifier, missing_ref);
|
return sema_expr_analyse_type_access(context, expr, parent->type_expr->type, identifier, missing_ref);
|
||||||
}
|
}
|
||||||
if (parent->expr_kind == EXPR_IDENTIFIER)
|
if (parent->expr_kind == EXPR_IDENTIFIER || expr_is_const_ref(parent))
|
||||||
{
|
{
|
||||||
Decl *decl = parent->ident_expr;
|
Decl *decl = parent->expr_kind == EXPR_IDENTIFIER ? parent->ident_expr : parent->const_expr.global_ref;
|
||||||
switch (decl->decl_kind)
|
switch (decl->decl_kind)
|
||||||
{
|
{
|
||||||
case DECL_FUNC:
|
case DECL_FUNC:
|
||||||
|
|||||||
14
test/unit/regression/function_tag.c3
Normal file
14
test/unit/regression/function_tag.c3
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
module function_tag;
|
||||||
|
|
||||||
|
macro bool @has_tagof_1(#function)
|
||||||
|
{
|
||||||
|
return #function.has_tagof("some-tag");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn void tagged_function() @tag("some-tag", true) {}
|
||||||
|
|
||||||
|
fn void function_tag() @test
|
||||||
|
{
|
||||||
|
assert(@has_tagof_1(tagged_function));
|
||||||
|
assert(@has_tagof_1(fn void() @tag("some-tag", true) {} ));
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user