mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
Fix type inference overrides parameterization #2761. Remove support for ^io::EOF
This commit is contained in:
@@ -34,7 +34,7 @@ fn usz? available(InStream s)
|
||||
s.seek(curr, Seek.SET)!;
|
||||
return len - curr;
|
||||
}
|
||||
return ^io::UNSUPPORTED_OPERATION;
|
||||
return io::UNSUPPORTED_OPERATION~;
|
||||
}
|
||||
|
||||
macro bool @is_instream(#expr) @const
|
||||
|
||||
@@ -731,23 +731,6 @@ static Expr *parse_raise_expr_suffix(ParseContext *c, Expr *left_side, SourceSpa
|
||||
return expr;
|
||||
}
|
||||
|
||||
static Expr *parse_raise_expr(ParseContext *c, Expr *left, SourceSpan lhs_start UNUSED)
|
||||
{
|
||||
ASSERT(!left && "Did not expect a left hand side!");
|
||||
|
||||
Expr *opt = EXPR_NEW_TOKEN(EXPR_OPTIONAL);
|
||||
advance(c);
|
||||
Expr *right_side = parse_precedence(c, PREC_UNARY);
|
||||
CHECK_EXPR_OR_RET(right_side);
|
||||
if (right_side->expr_kind == EXPR_TYPEINFO)
|
||||
{
|
||||
PRINT_ERROR_AT(right_side, "Expected a fault after '^'.");
|
||||
return poisoned_expr;
|
||||
}
|
||||
opt->inner_expr = right_side;
|
||||
RANGE_EXTEND_PREV(opt);
|
||||
return opt;
|
||||
}
|
||||
|
||||
/**
|
||||
* post_unary_expr ::= <expr> unary_op
|
||||
@@ -2230,7 +2213,7 @@ ParseRule rules[TOKEN_EOF + 1] = {
|
||||
[TOKEN_BANG] = { parse_unary_expr, parse_rethrow_expr, PREC_CALL },
|
||||
[TOKEN_BYTES] = { parse_bytes_expr, NULL, PREC_NONE },
|
||||
[TOKEN_BIT_NOT] = { parse_unary_expr, parse_raise_expr_suffix, PREC_CALL },
|
||||
[TOKEN_BIT_XOR] = { parse_raise_expr, parse_binary, PREC_BIT },
|
||||
[TOKEN_BIT_XOR] = { NULL, parse_binary, PREC_BIT },
|
||||
[TOKEN_BIT_OR] = { NULL, parse_binary, PREC_BIT },
|
||||
[TOKEN_AMP] = { parse_unary_expr, parse_binary, PREC_BIT },
|
||||
[TOKEN_EQEQ] = { NULL, parse_binary, PREC_RELATIONAL },
|
||||
|
||||
@@ -5269,6 +5269,7 @@ Decl *sema_analyse_parameterized_identifier(SemaContext *context, Path *decl_pat
|
||||
unsigned id = generic->generic_decl.id;
|
||||
FOREACH(Decl *, g, alias->unit->module->generic_sections)
|
||||
{
|
||||
if (g->generic_decl.id != id) continue;
|
||||
FOREACH (Decl *, candidate, g->generic_decl.instances)
|
||||
{
|
||||
if (candidate->name == suffix)
|
||||
|
||||
14
test/test_suite/generic/overlapping_generic.c3t
Normal file
14
test/test_suite/generic/overlapping_generic.c3t
Normal file
@@ -0,0 +1,14 @@
|
||||
import std;
|
||||
struct Result @generic(WithType2)
|
||||
{
|
||||
fault error;
|
||||
}
|
||||
macro Result{WithType} err(fault error) @generic(WithType) => { .error = error };
|
||||
|
||||
faultdef TESTIN;
|
||||
|
||||
fn int main()
|
||||
{
|
||||
Result{int} x = err{int}(TESTIN);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user