@abaplint/core 2.97.8 → 2.97.10

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.
@@ -1286,7 +1286,7 @@ export declare class CurrentScope {
1286
1286
  findTypePoolConstant(name: string | undefined): TypedIdentifier | undefined;
1287
1287
  findTypePoolType(name: string): TypedIdentifier | undefined;
1288
1288
  /** Lookup interface in local and global scope */
1289
- findInterfaceDefinition(name: string): IInterfaceDefinition | undefined;
1289
+ findInterfaceDefinition(name: string | undefined): IInterfaceDefinition | undefined;
1290
1290
  findFormDefinition(name: string): IFormDefinition | undefined;
1291
1291
  findType(name: string | undefined): TypedIdentifier | undefined;
1292
1292
  findExtraLikeType(name: string | undefined): TypedIdentifier | undefined;
@@ -251,6 +251,9 @@ class CurrentScope {
251
251
  /** Lookup interface in local and global scope */
252
252
  findInterfaceDefinition(name) {
253
253
  var _a;
254
+ if (name === undefined) {
255
+ return undefined;
256
+ }
254
257
  const ilocal = (_a = this.current) === null || _a === void 0 ? void 0 : _a.findInterfaceDefinition(name);
255
258
  if (ilocal) {
256
259
  return ilocal;
@@ -190,14 +190,32 @@ class TypeUtils {
190
190
  // todo
191
191
  return true;
192
192
  }
193
+ structureContainsString(structure) {
194
+ for (const c of structure.getComponents()) {
195
+ if (c.type instanceof basic_1.StringType) {
196
+ return true;
197
+ }
198
+ }
199
+ return false;
200
+ }
193
201
  isAssignableStrict(source, target) {
194
202
  var _a;
203
+ /*
204
+ console.dir(source);
205
+ console.dir(target);
206
+ */
195
207
  if (source instanceof basic_1.CharacterType && target instanceof basic_1.CharacterType) {
196
208
  if (((_a = source.getAbstractTypeData()) === null || _a === void 0 ? void 0 : _a.derivedFromConstant) === true) {
197
209
  return source.getLength() <= target.getLength();
198
210
  }
199
211
  return source.getLength() === target.getLength();
200
212
  }
213
+ else if (source instanceof basic_1.StringType && target instanceof basic_1.StructureType) {
214
+ if (this.structureContainsString(target)) {
215
+ return false;
216
+ }
217
+ return true;
218
+ }
201
219
  return this.isAssignable(source, target);
202
220
  }
203
221
  isAssignable(source, target) {
@@ -209,12 +227,14 @@ class TypeUtils {
209
227
  if (target.isWithHeader()) {
210
228
  return this.isAssignable(source, target.getRowType());
211
229
  }
212
- if (source instanceof basic_1.TableType
213
- || source instanceof basic_1.VoidType
230
+ if (source instanceof basic_1.VoidType
214
231
  || source instanceof basic_1.AnyType
215
232
  || source instanceof basic_1.UnknownType) {
216
233
  return true;
217
234
  }
235
+ else if (source instanceof basic_1.TableType) {
236
+ return this.isAssignableStrict(source.getRowType(), target.getRowType());
237
+ }
218
238
  return false;
219
239
  }
220
240
  else if (target instanceof basic_1.ObjectReferenceType && source instanceof basic_1.ObjectReferenceType) {
@@ -244,12 +264,17 @@ class TypeUtils {
244
264
  if (source instanceof basic_1.TableType && source.isWithHeader()) {
245
265
  return this.isAssignable(source.getRowType(), target);
246
266
  }
247
- else if (source instanceof basic_1.StructureType
248
- || source instanceof basic_1.VoidType
267
+ else if (source instanceof basic_1.VoidType
249
268
  || source instanceof basic_1.AnyType
250
269
  || source instanceof basic_1.UnknownType) {
251
270
  return true;
252
271
  }
272
+ else if (source instanceof basic_1.StructureType) {
273
+ if (this.structureContainsString(target) && !this.structureContainsString(source)) {
274
+ return false;
275
+ }
276
+ return true;
277
+ }
253
278
  else if (target.containsVoid() === true) {
254
279
  return true;
255
280
  }
@@ -59,6 +59,11 @@ class CreateObject {
59
59
  if (id instanceof types_1.InterfaceDefinition && type === undefined) {
60
60
  throw new Error("Interface reference, cannot be instantiated");
61
61
  }
62
+ else if (found instanceof basic_1.ObjectReferenceType
63
+ && type === undefined
64
+ && scope.findInterfaceDefinition(found.getQualifiedName())) {
65
+ throw new Error("Interface reference, cannot be instantiated");
66
+ }
62
67
  else if (id instanceof types_1.ClassDefinition && cdef === undefined) {
63
68
  cdef = id;
64
69
  }
@@ -63,7 +63,7 @@ class Registry {
63
63
  }
64
64
  static abaplintVersion() {
65
65
  // magic, see build script "version.sh"
66
- return "2.97.8";
66
+ return "2.97.10";
67
67
  }
68
68
  getDDICReferences() {
69
69
  return this.references;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.97.8",
3
+ "version": "2.97.10",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",