diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2020-12-18 14:19:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-18 14:19:03 +0100 |
| commit | bd6ead32f8d05a9662c7fa6fde867b71da0e79c9 (patch) | |
| tree | e610f06a230cca9d89bf075ec55e520dae83ad8e /src/check_expr.cpp | |
| parent | 934809397f1f5f567c0ec668de72d2ac28e85f74 (diff) | |
| parent | 3558848da818dc330d139ff5d756bb9b9498b1d4 (diff) | |
Merge pull request #1 from odin-lang/master
update from master
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 15380e55c..63b275c99 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -7910,7 +7910,9 @@ void check_expr_with_type_hint(CheckerContext *c, Operand *o, Ast *e, Type *t) { err_str = "used as a value"; break; case Addressing_Type: - err_str = "is not an expression but a type"; + if (t == nullptr || !is_type_typeid(t)) { + err_str = "is not an expression but a type"; + } break; case Addressing_Builtin: err_str = "must be called"; @@ -8760,8 +8762,10 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type i64 lo = exact_value_to_i64(x.value); i64 hi = exact_value_to_i64(y.value); i64 max_index = hi; - if (op.kind == Token_RangeHalf) { + if (op.kind == Token_RangeHalf) { // ..< (exclusive) hi -= 1; + } else { // .. (inclusive) + max_index += 1; } bool new_range = range_cache_add_range(&rc, lo, hi); |