Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
larshp committed May 16, 2024
1 parent 7df11cb commit 09e1838
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions packages/core/src/abap/5_syntax/_type_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,14 @@ export class TypeUtils {
|| target instanceof HexType) {
return false;
}
} else if (source instanceof TableType) {
if (target instanceof TableType) {
return this.isAssignableStrict(source.getRowType(), target);
} else if (target instanceof UnknownType
|| target instanceof AnyType
|| target instanceof VoidType) {
return true;
}
}
return this.isAssignable(source, target);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/core/test/abap/syntax/syntax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10561,8 +10561,8 @@ CAST zif_sdfsdfsd( ref )->id_draft = 2.`;

it.only("Table types, expect error", () => {
const abap = `
DATA ty1 TYPE STANDARD TABLE OF string WITH EMPTY KEY.
DATA ty2 TYPE STANDARD TABLE OF xstring WITH EMPTY KEY.
TYPES ty1 TYPE STANDARD TABLE OF string WITH EMPTY KEY.
TYPES ty2 TYPE STANDARD TABLE OF xstring WITH EMPTY KEY.
CLASS lcl DEFINITION.
PUBLIC SECTION.
Expand All @@ -10576,7 +10576,7 @@ CLASS lcl IMPLEMENTATION.
ENDMETHOD.
ENDCLASS.`;
const issues = runProgram(abap);
expect(issues[0]?.getMessage()).to.equal("Incompatible types");
expect(issues[0]?.getMessage()).to.equal("Method parameter type not compatible");
});

// todo, static method cannot access instance attributes
Expand Down

0 comments on commit 09e1838

Please sign in to comment.