diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-06-26 21:34:54 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-06-26 21:34:54 +0100 |
| commit | 260089431e069d2ce21ce74ff17c56c45fa7785e (patch) | |
| tree | b6e787060a0e42ab3c7cfebf2b2e3c81155f18be /src/check_decl.cpp | |
| parent | d0d8da8c084e0c6306aad5741e320c1a74bd4f7d (diff) | |
Write demo for v0.5.0
Diffstat (limited to 'src/check_decl.cpp')
| -rw-r--r-- | src/check_decl.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp index d3f82b1d3..8d375d548 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -45,6 +45,11 @@ Type *check_init_variable(Checker *c, Entity *e, Operand *operand, String contex } t = default_type(t); } + if (is_type_gen_proc(t)) { + error(e->token, "Invalid use of a generic procedure in %.*s", LIT(context_name)); + e->type = t_invalid; + return NULL; + } if (is_type_bit_field_value(t)) { t = default_bit_field_value_type(t); } @@ -361,7 +366,12 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) { if (pt->is_generic) { if (pd->body == NULL) { - error(e->token, "Generic procedures must have a body"); + error(e->token, "Polymorphic procedures must have a body"); + } + + if (is_foreign) { + error(e->token, "A foreign procedures cannot be a polymorphic"); + return; } } @@ -387,6 +397,8 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) { pt->require_results = is_require_results; } + + if (is_foreign) { String name = e->token.string; if (pd->link_name.len > 0) { |