Skip to content

Commit 4ba2c2c

Browse files
authored
fix: duplicate error if annotation call has no argument list and lacks required parameters (#650)
### Summary of Changes If an annotation call had no argument list and did not set some required parameters, two separate errors were shown in the same place. This PR hides one of them.
1 parent 10ed8bf commit 4ba2c2c

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/language/validation/other/argumentLists.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,13 @@ export const argumentListMustSetAllRequiredParameters = (services: SafeDsService
104104
const nodeMapper = services.helpers.NodeMapper;
105105

106106
return (node: SdsAbstractCall, accept: ValidationAcceptor): void => {
107-
const callable = nodeMapper.callToCallableOrUndefined(node);
107+
// We already report other errors in this case
108+
if (!node.argumentList) {
109+
return;
110+
}
108111

109112
// We already report other errors in those cases
113+
const callable = nodeMapper.callToCallableOrUndefined(node);
110114
if (!callable || (isSdsCall(node) && isSdsAnnotation(callable))) {
111115
return;
112116
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package tests.validation.other.argumentLists.missingRequiredParameter
2+
3+
// $TEST$ no error r"The parameters? .* must be set here\."
4+
5+
@MyAnnotation
6+
segment mySegment2(
7+
myCallableType: (a: Int, b: Int, c: Int = 0) -> ()
8+
) {
9+
val myBlockLambda = (a: Int, b: Int, c: Int = 0) {};
10+
val myExpressionLambda = (a: Int, b: Int, c: Int = 0) -> 1;
11+
12+
MyAnnotation;
13+
MyClass;
14+
MyEnum.MyEnumVariant;
15+
myFunction;
16+
mySegment1;
17+
myCallableType;
18+
myBlockLambda;
19+
myExpressionLambda;
20+
myPipeline;
21+
}

0 commit comments

Comments
 (0)