diff --git a/packages/safe-ds-lang/src/language/validation/purity.ts b/packages/safe-ds-lang/src/language/validation/purity.ts index 298aad1c1..2669327b2 100644 --- a/packages/safe-ds-lang/src/language/validation/purity.ts +++ b/packages/safe-ds-lang/src/language/validation/purity.ts @@ -55,6 +55,7 @@ export const callableParameterPurityMustBeSpecified = (services: SafeDsServices) }, ); } else if ( + !builtinAnnotations.isPure(node) && !builtinAnnotations.isPure(parameter) && !impurityReasons.some((it) => it.equals(expectedImpurityReason)) ) { diff --git a/packages/safe-ds-lang/tests/resources/validation/purity/callable parameter with unspecified purity/function.sdstest b/packages/safe-ds-lang/tests/resources/validation/purity/callable parameter with unspecified purity/function.sdstest index 9f0b01caf..a1fdcb06b 100644 --- a/packages/safe-ds-lang/tests/resources/validation/purity/callable parameter with unspecified purity/function.sdstest +++ b/packages/safe-ds-lang/tests/resources/validation/purity/callable parameter with unspecified purity/function.sdstest @@ -15,7 +15,7 @@ fun pureFunction( »p1«: Int, // $TEST$ no error "The purity of a callable parameter must be specified. Call the annotation '@Pure' or add the impurity reason 'PotentiallyImpureParameterCall' to the containing function." @Pure »p2«: () -> (), - // $TEST$ error "The purity of a callable parameter must be specified. Call the annotation '@Pure' or add the impurity reason 'PotentiallyImpureParameterCall' to the containing function." + // $TEST$ no error "The purity of a callable parameter must be specified. Call the annotation '@Pure' or add the impurity reason 'PotentiallyImpureParameterCall' to the containing function." »p3«: () -> () )