Skip to content

Commit

Permalink
fix: duplicate error if annotation call has no argument list and lack…
Browse files Browse the repository at this point in the history
…s required parameters
  • Loading branch information
lars-reimann committed Oct 19, 2023
1 parent 10ed8bf commit 2cf9e43
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/language/validation/other/argumentLists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,13 @@ export const argumentListMustSetAllRequiredParameters = (services: SafeDsService
const nodeMapper = services.helpers.NodeMapper;

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

// We already report other errors in those cases
const callable = nodeMapper.callToCallableOrUndefined(node);
if (!callable || (isSdsCall(node) && isSdsAnnotation(callable))) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package tests.validation.other.argumentLists.missingRequiredParameter

// $TEST$ no error r"The parameters? .* must be set here\."

@MyAnnotation
segment mySegment2(
myCallableType: (a: Int, b: Int, c: Int = 0) -> ()
) {
val myBlockLambda = (a: Int, b: Int, c: Int = 0) {};
val myExpressionLambda = (a: Int, b: Int, c: Int = 0) -> 1;

MyAnnotation;
MyClass;
MyEnum.MyEnumVariant;
myFunction;
mySegment1;
myCallableType;
myBlockLambda;
myExpressionLambda;
myPipeline;
}

0 comments on commit 2cf9e43

Please sign in to comment.