Emit a better error when expecting a compile-time constant, fixes #222

This commit is contained in:
dcode
2019-02-07 23:04:57 +01:00
parent 9a8ed25b19
commit 47b2f33564
3 changed files with 5 additions and 2 deletions

View File

@ -3444,7 +3444,7 @@ function evaluateConstantOffset(compiler: Compiler, expression: Expression): i32
(value = getConstValueI64Low(expr)) < 0
) {
compiler.error(
DiagnosticCode.Operation_not_supported,
DiagnosticCode.Expression_must_be_a_compile_time_constant,
expression.range
);
value = -1;
@ -3457,7 +3457,7 @@ function evaluateConstantOffset(compiler: Compiler, expression: Expression): i32
(value = getConstValueI32(expr)) < 0
) {
compiler.error(
DiagnosticCode.Operation_not_supported,
DiagnosticCode.Expression_must_be_a_compile_time_constant,
expression.range
);
value = -1;