@abaplint/core 2.120.47 → 2.120.48
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.
|
@@ -94,6 +94,13 @@ class TypeUtils {
|
|
|
94
94
|
|| type instanceof basic_1.UnknownType
|
|
95
95
|
|| type instanceof basic_1.VoidType;
|
|
96
96
|
}
|
|
97
|
+
isCharLikeForCompare(type) {
|
|
98
|
+
return type === undefined
|
|
99
|
+
|| type instanceof basic_1.StringType
|
|
100
|
+
|| type instanceof basic_1.CLikeType
|
|
101
|
+
|| type instanceof basic_1.CSequenceType
|
|
102
|
+
|| this.isCharLikeField(type);
|
|
103
|
+
}
|
|
97
104
|
isCharLike(type) {
|
|
98
105
|
if (type === undefined) {
|
|
99
106
|
return false;
|
|
@@ -43,6 +43,7 @@ const basic_1 = require("../../types/basic");
|
|
|
43
43
|
const _type_utils_1 = require("../_type_utils");
|
|
44
44
|
class Compare {
|
|
45
45
|
static runSyntax(node, input) {
|
|
46
|
+
var _a;
|
|
46
47
|
const sourceTypes = [];
|
|
47
48
|
const sources = node.findDirectExpressions(Expressions.Source);
|
|
48
49
|
for (const t of sources) {
|
|
@@ -54,8 +55,16 @@ class Compare {
|
|
|
54
55
|
for (const t of node.findDirectExpressions(Expressions.MethodCallChain)) {
|
|
55
56
|
method_call_chain_1.MethodCallChain.runSyntax(t, input);
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
const typeUtils = new _type_utils_1.TypeUtils(input.scope);
|
|
59
|
+
const compareOperator = (_a = node.findDirectExpression(Expressions.CompareOperator)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
60
|
+
if (compareOperator === "CS"
|
|
61
|
+
&& sourceTypes.length === 2
|
|
62
|
+
&& sourceTypes.some((type) => typeUtils.isCharLikeForCompare(type) === false)) {
|
|
63
|
+
const message = "CS operands must be character-like (data type C, N, D, T, or STRING)";
|
|
64
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
65
|
+
}
|
|
66
|
+
else if (node.findDirectExpression(Expressions.CompareOperator)
|
|
67
|
+
&& typeUtils.isCompareable(sourceTypes[0], sourceTypes[1], sources[0], sources[1]) === false
|
|
59
68
|
&& sourceTypes.length === 2) {
|
|
60
69
|
let message = "Incompatible types for comparison";
|
|
61
70
|
if ((sourceTypes[0] instanceof basic_1.DateType
|
package/build/src/registry.js
CHANGED