@abaplint/cli 2.120.86 → 2.120.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/build/cli.js +70 -6
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -28802,6 +28802,7 @@ const expressions_1 = __webpack_require__(/*! ../2_statements/expressions */ "..
28802
28802
  const _builtin_1 = __webpack_require__(/*! ./_builtin */ "../core/build/src/abap/5_syntax/_builtin.js");
28803
28803
  const position_1 = __webpack_require__(/*! ../../position */ "../core/build/src/position.js");
28804
28804
  const _syntax_input_1 = __webpack_require__(/*! ./_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
28805
+ const version_1 = __webpack_require__(/*! ../../version */ "../core/build/src/version.js");
28805
28806
  class BasicTypes {
28806
28807
  constructor(input) {
28807
28808
  this.input = input;
@@ -29027,7 +29028,14 @@ class BasicTypes {
29027
29028
  }
29028
29029
  const chainText = typeName.concatTokens().toUpperCase();
29029
29030
  const f = this.input.scope.getDDIC().lookupBuiltinType(chainText, length, decimals, qualifiedName);
29030
- if (f !== undefined) {
29031
+ if (f instanceof Types.Integer8Type
29032
+ && !(0, version_1.releaseAtLeast)(this.input.scope.getRelease(), version_1.Release.v750)
29033
+ && !this.input.scope.getOpenABAP()) {
29034
+ const message = "Type INT8 requires 7.50";
29035
+ this.input.issues.push((0, _syntax_input_1.syntaxIssue)(this.input, typeName.getFirstToken(), message));
29036
+ return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
29037
+ }
29038
+ else if (f !== undefined) {
29031
29039
  return f;
29032
29040
  }
29033
29041
  const typ = this.input.scope.findType(chainText);
@@ -43511,6 +43519,10 @@ class InsertInternal {
43511
43519
  if (sourceType instanceof basic_1.IntegerType && targetType instanceof basic_1.Integer8Type) {
43512
43520
  error = true;
43513
43521
  }
43522
+ else if (targetType instanceof basic_1.TableType && targetType.isWithHeader() && sourceType instanceof basic_1.TableType) {
43523
+ // LINES OF into a table with header line, compare the row types
43524
+ error = new _type_utils_1.TypeUtils(input.scope).isAssignable(sourceType.getRowType(), targetType.getRowType()) === false;
43525
+ }
43514
43526
  else if (new _type_utils_1.TypeUtils(input.scope).isAssignable(sourceType, targetType) === false) {
43515
43527
  error = true;
43516
43528
  }
@@ -72662,7 +72674,7 @@ class Registry {
72662
72674
  }
72663
72675
  static abaplintVersion() {
72664
72676
  // magic, see build script "version.js"
72665
- return "2.120.86";
72677
+ return "2.120.87";
72666
72678
  }
72667
72679
  getDDICReferences() {
72668
72680
  return this.ddicReferences;
@@ -76319,6 +76331,7 @@ const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/ex
76319
76331
  const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
76320
76332
  const Structures = __importStar(__webpack_require__(/*! ../abap/3_structures/structures */ "../core/build/src/abap/3_structures/structures/index.js"));
76321
76333
  const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
76334
+ const tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
76322
76335
  class AlignTypeExpressionsConf extends _basic_rule_config_1.BasicRuleConfig {
76323
76336
  constructor() {
76324
76337
  super(...arguments);
@@ -76486,12 +76499,18 @@ ENDINTERFACE.`,
76486
76499
  let column = 0;
76487
76500
  const st = t.findDirectStatements(Statements.Type);
76488
76501
  for (const s of st) {
76489
- const name = s.getChildren()[1];
76502
+ const children = s.getChildren();
76503
+ const length = s.findDirectExpression(Expressions.ConstantFieldLength);
76504
+ const nameEnd = (length !== null && length !== void 0 ? length : children[1]).getLastToken().getEnd();
76505
+ const after = children[length ? 3 : 2];
76506
+ if (after === undefined || after.getFirstToken() instanceof tokens_1.Punctuation) {
76507
+ continue; // no TYPE clause, eg. "foo(1)," with implicit type
76508
+ }
76490
76509
  fields.push({
76491
- nameEnd: name.getLastToken().getEnd(),
76492
- after: s.getChildren()[2].getFirstToken().getStart()
76510
+ nameEnd: nameEnd,
76511
+ after: after.getFirstToken().getStart()
76493
76512
  });
76494
- column = Math.max(column, name.getFirstToken().getEnd().getCol() + 1);
76513
+ column = Math.max(column, nameEnd.getCol() + 1);
76495
76514
  }
76496
76515
  issues.push(...this.check(fields, column, file));
76497
76516
  }
@@ -84437,6 +84456,17 @@ Make sure to test the downported code, it might not always be completely correct
84437
84456
  }
84438
84457
  }
84439
84458
  }
84459
+ // INSERT with a 702 built-in function as the operand parses in the low version, but 702
84460
+ // reads the function as a method call, "Method SUBSTRING does not exist"
84461
+ if (ret.length === 0) {
84462
+ for (let i = 0; i < lowStatements.length; i++) {
84463
+ const issue = this.outlineInsertBuiltin(lowStatements[i], highStatements[i], lowFile, highSyntax);
84464
+ if (issue) {
84465
+ ret.push(issue);
84466
+ break;
84467
+ }
84468
+ }
84469
+ }
84440
84470
  // INTO after WHERE parses as a valid SELECT in the low version, but is only allowed in
84441
84471
  // strict SQL syntax, so move it also when the statement is no longer Unknown
84442
84472
  if (ret.length === 0) {
@@ -85269,6 +85299,40 @@ ${indentation}`);
85269
85299
  }
85270
85300
  return undefined;
85271
85301
  }
85302
+ /** INSERT substring( ... ) INTO TABLE tab, the operand is outlined into a variable */
85303
+ outlineInsertBuiltin(low, high, lowFile, highSyntax) {
85304
+ var _a;
85305
+ if (!(high.get() instanceof Statements.InsertInternal)) {
85306
+ return undefined;
85307
+ }
85308
+ else if (this.lowReg.getConfig().isOpenABAP()) {
85309
+ return undefined;
85310
+ }
85311
+ else if (low.getFirstToken().getStart() instanceof virtual_position_1.VirtualPosition) {
85312
+ return undefined;
85313
+ }
85314
+ // the whole operand is the call, a longer expression is outlined by replaceInsertExpression
85315
+ const source = high.getChildren()[1];
85316
+ if (!(source instanceof nodes_1.ExpressionNode)
85317
+ || !(source.get() instanceof Expressions.SimpleSource4 || source.get() instanceof Expressions.Source)
85318
+ || source.getChildren().length !== 1
85319
+ || !(((_a = source.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.MethodCallChain)) {
85320
+ return undefined;
85321
+ }
85322
+ const type = this.builtinReturnType(source, lowFile, highSyntax);
85323
+ if (type === undefined) {
85324
+ return undefined;
85325
+ }
85326
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
85327
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
85328
+ const code = `DATA ${uniqueName} TYPE ${type}.\n` +
85329
+ indentation + `${uniqueName} = ${source.concatTokens()}.\n` +
85330
+ indentation;
85331
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
85332
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);
85333
+ const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
85334
+ return issue_1.Issue.atToken(lowFile, source.getFirstToken(), "Outline built-in function in INSERT", this.getMetadata().key, this.conf.severity, fix);
85335
+ }
85272
85336
  /** the ABAP type returned by the built-in function this Source starts with, or undefined
85273
85337
  * if it does not start with one, or with one that predates 702 */
85274
85338
  builtinReturnType(source, lowFile, highSyntax) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.86",
3
+ "version": "2.120.87",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.120.86",
42
+ "@abaplint/core": "^2.120.87",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",