Skip to content

Commit

Permalink
fix: in a pure function, all callables are assumed to be pure
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-reimann committed Nov 15, 2023
1 parent b0ad279 commit bbf537c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/safe-ds-lang/src/language/validation/purity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const callableParameterPurityMustBeSpecified = (services: SafeDsServices)
},
);
} else if (
!builtinAnnotations.isPure(node) &&
!builtinAnnotations.isPure(parameter) &&
!impurityReasons.some((it) => it.equals(expectedImpurityReason))
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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«: () -> ()
)

Expand Down

0 comments on commit bbf537c

Please sign in to comment.