diff options
| -rw-r--r-- | src/actualize.c | 15 | ||||
| -rw-r--r-- | tests/struct_pub_generic_cont/struct.ek | 2 | ||||
| -rw-r--r-- | tests/struct_pub_generic_cont/struct_pub_generic_cont.ek | 5 |
3 files changed, 16 insertions, 6 deletions
diff --git a/src/actualize.c b/src/actualize.c index a6155b9..9e36553 100644 --- a/src/actualize.c +++ b/src/actualize.c @@ -2441,6 +2441,21 @@ static int actualize_struct_cont(struct act_state *state, struct scope *scope, struct ast *node) { assert(node->k == AST_STRUCT_CONT_DEF); + struct ast *base = chain_base(node); + assert(base); + + /** @todo this is arguably kind of a hack to sidestep issues + * with 'which implementation of this trait should be used', but + * it kind of has some nice properties in and of itself, will + * have to think about this a bit more. */ + if (ast_flags(node, AST_FLAG_PUBLIC) != ast_flags(base, AST_FLAG_PUBLIC)) { + /** @todo should the error report mention that this is possibly + * a temporary hack? */ + semantic_error(scope->fctx, node, "different publicity flags than base"); + semantic_info(scope->fctx, base, "previous here"); + return -1; + } + struct ast *up = node->chain; assert(up); diff --git a/tests/struct_pub_generic_cont/struct.ek b/tests/struct_pub_generic_cont/struct.ek index 85f1711..5abbe38 100644 --- a/tests/struct_pub_generic_cont/struct.ek +++ b/tests/struct_pub_generic_cont/struct.ek @@ -3,7 +3,7 @@ pub typedef i27 {} pub typedef struct[any T] {} /* private definition of some function */ -continue struct[any T] { +pub continue struct[any T] { do_something(){} } diff --git a/tests/struct_pub_generic_cont/struct_pub_generic_cont.ek b/tests/struct_pub_generic_cont/struct_pub_generic_cont.ek index 905bdf9..1712669 100644 --- a/tests/struct_pub_generic_cont/struct_pub_generic_cont.ek +++ b/tests/struct_pub_generic_cont/struct_pub_generic_cont.ek @@ -1,13 +1,8 @@ import "struct.ek" -continue struct[any T] { - do_something(){} -} - main() { mut p = struct![i27]{}; - /* should be different from do_something() defined in struct.ek */ p.do_something(); some_func(); |
