From 475021248412e92b80e98ff073a6e6d8c4d29896 Mon Sep 17 00:00:00 2001 From: Dave Holoway Date: Sun, 7 Jun 2020 15:59:12 +0100 Subject: [PATCH] improve invalid array expression message add AnyType array element to prevent cascading errors --- langserver/java/body-parser3.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/langserver/java/body-parser3.js b/langserver/java/body-parser3.js index 833048d..0cbeedf 100644 --- a/langserver/java/body-parser3.js +++ b/langserver/java/body-parser3.js @@ -1702,7 +1702,8 @@ function arrayElementOrConstructor(tokens, open_array, matches, index) { const types = matches.types.map(t => t instanceof ArrayType ? new ArrayType(t.base, t.arrdims+1) : new ArrayType(t, 1)); if (!variables[0] && !types[0]) { - addproblem(tokens, ParseProblem.Error(open_array, `Invalid array expression`)); + addproblem(tokens, ParseProblem.Error(open_array, `Invalid array expression: '${matches.source}' is not an array type`)); + variables.push(new ArrayElement(new Value(matches.source, new ArrayType(AnyType.Instance, 1)), index)); } return new ResolvedIdent(ident, variables, [], types); }