1
1
import { ValidationChecks } from 'langium' ;
2
2
import { SafeDsAstType } from '../generated/ast.js' ;
3
3
import type { SafeDsServices } from '../safe-ds-module.js' ;
4
+ import {
5
+ annotationCallAnnotationShouldNotBeDeprecated ,
6
+ argumentCorrespondingParameterShouldNotBeDeprecated ,
7
+ assigneeAssignedResultShouldNotBeDeprecated ,
8
+ namedTypeDeclarationShouldNotBeDeprecated ,
9
+ referenceTargetShouldNotBeDeprecated ,
10
+ requiredParameterMustNotBeDeprecated ,
11
+ } from './builtins/deprecated.js' ;
12
+ import {
13
+ annotationCallAnnotationShouldNotBeExperimental ,
14
+ argumentCorrespondingParameterShouldNotBeExperimental ,
15
+ assigneeAssignedResultShouldNotBeExperimental ,
16
+ namedTypeDeclarationShouldNotBeExperimental ,
17
+ referenceTargetShouldNotExperimental ,
18
+ } from './builtins/experimental.js' ;
19
+ import { requiredParameterMustNotBeExpert } from './builtins/expert.js' ;
20
+ import { pureParameterMustHaveCallableType } from './builtins/pure.js' ;
21
+ import { pythonCallMustOnlyContainValidTemplateExpressions } from './builtins/pythonCall.js' ;
22
+ import { pythonModuleShouldDifferFromSafeDsPackage } from './builtins/pythonModule.js' ;
23
+ import {
24
+ pythonNameMustNotBeSetIfPythonCallIsSet ,
25
+ pythonNameShouldDifferFromSafeDsName ,
26
+ } from './builtins/pythonName.js' ;
27
+ import { singleUseAnnotationsMustNotBeRepeated } from './builtins/repeatable.js' ;
28
+ import { annotationCallMustHaveCorrectTarget , targetShouldNotHaveDuplicateEntries } from './builtins/target.js' ;
29
+ import {
30
+ indexedAccessesShouldBeUsedWithCaution ,
31
+ literalTypesShouldBeUsedWithCaution ,
32
+ mapsShouldBeUsedWithCaution ,
33
+ unionTypesShouldBeUsedWithCaution ,
34
+ } from './experimentalLanguageFeatures.js' ;
35
+ import { classMustNotInheritItself , classMustOnlyInheritASingleClass } from './inheritance.js' ;
4
36
import {
5
37
annotationMustContainUniqueNames ,
6
38
blockLambdaMustContainUniqueNames ,
@@ -18,6 +50,76 @@ import {
18
50
schemaMustContainUniqueNames ,
19
51
segmentMustContainUniqueNames ,
20
52
} from './names.js' ;
53
+ import {
54
+ argumentListMustNotHavePositionalArgumentsAfterNamedArguments ,
55
+ argumentListMustNotHaveTooManyArguments ,
56
+ argumentListMustNotSetParameterMultipleTimes ,
57
+ argumentListMustSetAllRequiredParameters ,
58
+ } from './other/argumentLists.js' ;
59
+ import {
60
+ annotationCallArgumentsMustBeConstant ,
61
+ annotationCallMustNotLackArgumentList ,
62
+ callableTypeParametersMustNotBeAnnotated ,
63
+ callableTypeResultsMustNotBeAnnotated ,
64
+ lambdaParametersMustNotBeAnnotated ,
65
+ } from './other/declarations/annotationCalls.js' ;
66
+ import { parameterListMustNotHaveRequiredParametersAfterOptionalParameters } from './other/declarations/parameterLists.js' ;
67
+ import { constantParameterMustHaveConstantDefaultValue } from './other/declarations/parameters.js' ;
68
+ import { placeholderShouldBeUsed , placeholdersMustNotBeAnAlias } from './other/declarations/placeholders.js' ;
69
+ import {
70
+ segmentParameterShouldBeUsed ,
71
+ segmentResultMustBeAssignedExactlyOnce ,
72
+ segmentShouldBeUsed ,
73
+ } from './other/declarations/segments.js' ;
74
+ import { typeParameterConstraintLeftOperandMustBeOwnTypeParameter } from './other/declarations/typeParameterConstraints.js' ;
75
+ import { typeParameterMustHaveSufficientContext } from './other/declarations/typeParameters.js' ;
76
+ import { callArgumentsMustBeConstantIfParameterIsConstant } from './other/expressions/calls.js' ;
77
+ import { divisionDivisorMustNotBeZero } from './other/expressions/infixOperations.js' ;
78
+ import {
79
+ lambdaMustBeAssignedToTypedParameter ,
80
+ lambdaParameterMustNotHaveConstModifier ,
81
+ } from './other/expressions/lambdas.js' ;
82
+ import {
83
+ memberAccessMustBeNullSafeIfReceiverIsNullable ,
84
+ memberAccessOfEnumVariantMustNotLackInstantiation ,
85
+ } from './other/expressions/memberAccesses.js' ;
86
+ import {
87
+ referenceMustNotBeFunctionPointer ,
88
+ referenceMustNotBeStaticClassOrEnumReference ,
89
+ referenceTargetMustNotBeAnnotationPipelineOrSchema ,
90
+ } from './other/expressions/references.js' ;
91
+ import { templateStringMustHaveExpressionBetweenTwoStringParts } from './other/expressions/templateStrings.js' ;
92
+ import { importPackageMustExist , importPackageShouldNotBeEmpty } from './other/imports.js' ;
93
+ import {
94
+ moduleDeclarationsMustMatchFileKind ,
95
+ moduleWithDeclarationsMustStatePackage ,
96
+ pipelineFileMustNotBeInBuiltinPackage ,
97
+ } from './other/modules.js' ;
98
+ import {
99
+ assignmentAssigneeMustGetValue ,
100
+ assignmentShouldNotImplicitlyIgnoreResult ,
101
+ yieldMustNotBeUsedInPipeline ,
102
+ } from './other/statements/assignments.js' ;
103
+ import {
104
+ callableTypeMustNotHaveOptionalParameters ,
105
+ callableTypeParameterMustNotHaveConstModifier ,
106
+ } from './other/types/callableTypes.js' ;
107
+ import {
108
+ literalTypeMustHaveLiterals ,
109
+ literalTypeMustNotContainListLiteral ,
110
+ literalTypeMustNotContainMapLiteral ,
111
+ literalTypeShouldNotHaveDuplicateLiteral ,
112
+ } from './other/types/literalTypes.js' ;
113
+ import {
114
+ namedTypeMustNotHaveTooManyTypeArguments ,
115
+ namedTypeMustNotSetTypeParameterMultipleTimes ,
116
+ namedTypeTypeArgumentListMustNotHavePositionalArgumentsAfterNamedArguments ,
117
+ } from './other/types/namedTypes.js' ;
118
+ import {
119
+ unionTypeMustBeUsedInCorrectContext ,
120
+ unionTypeMustHaveTypes ,
121
+ unionTypeShouldNotHaveDuplicateTypes ,
122
+ } from './other/types/unionTypes.js' ;
21
123
import {
22
124
annotationCallArgumentListShouldBeNeeded ,
23
125
annotationParameterListShouldNotBeEmpty ,
@@ -37,12 +139,6 @@ import {
37
139
typeParameterListShouldNotBeEmpty ,
38
140
unionTypeShouldNotHaveASingularTypeArgument ,
39
141
} from './style.js' ;
40
- import { templateStringMustHaveExpressionBetweenTwoStringParts } from './other/expressions/templateStrings.js' ;
41
- import {
42
- assignmentAssigneeMustGetValue ,
43
- assignmentShouldNotImplicitlyIgnoreResult ,
44
- yieldMustNotBeUsedInPipeline ,
45
- } from './other/statements/assignments.js' ;
46
142
import {
47
143
argumentTypeMustMatchParameterType ,
48
144
attributeMustHaveTypeHint ,
@@ -57,101 +153,6 @@ import {
57
153
resultMustHaveTypeHint ,
58
154
yieldTypeMustMatchResultType ,
59
155
} from './types.js' ;
60
- import {
61
- moduleDeclarationsMustMatchFileKind ,
62
- moduleWithDeclarationsMustStatePackage ,
63
- pipelineFileMustNotBeInBuiltinPackage ,
64
- } from './other/modules.js' ;
65
- import { typeParameterConstraintLeftOperandMustBeOwnTypeParameter } from './other/declarations/typeParameterConstraints.js' ;
66
- import { parameterListMustNotHaveRequiredParametersAfterOptionalParameters } from './other/declarations/parameterLists.js' ;
67
- import {
68
- unionTypeMustBeUsedInCorrectContext ,
69
- unionTypeMustHaveTypes ,
70
- unionTypeShouldNotHaveDuplicateTypes ,
71
- } from './other/types/unionTypes.js' ;
72
- import {
73
- callableTypeMustNotHaveOptionalParameters ,
74
- callableTypeParameterMustNotHaveConstModifier ,
75
- } from './other/types/callableTypes.js' ;
76
- import {
77
- argumentListMustNotHavePositionalArgumentsAfterNamedArguments ,
78
- argumentListMustNotHaveTooManyArguments ,
79
- argumentListMustNotSetParameterMultipleTimes ,
80
- argumentListMustSetAllRequiredParameters ,
81
- } from './other/argumentLists.js' ;
82
- import {
83
- referenceMustNotBeFunctionPointer ,
84
- referenceMustNotBeStaticClassOrEnumReference ,
85
- referenceTargetMustNotBeAnnotationPipelineOrSchema ,
86
- } from './other/expressions/references.js' ;
87
- import {
88
- annotationCallAnnotationShouldNotBeDeprecated ,
89
- argumentCorrespondingParameterShouldNotBeDeprecated ,
90
- assigneeAssignedResultShouldNotBeDeprecated ,
91
- namedTypeDeclarationShouldNotBeDeprecated ,
92
- referenceTargetShouldNotBeDeprecated ,
93
- requiredParameterMustNotBeDeprecated ,
94
- } from './builtins/deprecated.js' ;
95
- import {
96
- annotationCallAnnotationShouldNotBeExperimental ,
97
- argumentCorrespondingParameterShouldNotBeExperimental ,
98
- assigneeAssignedResultShouldNotBeExperimental ,
99
- namedTypeDeclarationShouldNotBeExperimental ,
100
- referenceTargetShouldNotExperimental ,
101
- } from './builtins/experimental.js' ;
102
- import { placeholderShouldBeUsed , placeholdersMustNotBeAnAlias } from './other/declarations/placeholders.js' ;
103
- import {
104
- segmentParameterShouldBeUsed ,
105
- segmentResultMustBeAssignedExactlyOnce ,
106
- segmentShouldBeUsed ,
107
- } from './other/declarations/segments.js' ;
108
- import {
109
- lambdaMustBeAssignedToTypedParameter ,
110
- lambdaParameterMustNotHaveConstModifier ,
111
- } from './other/expressions/lambdas.js' ;
112
- import {
113
- indexedAccessesShouldBeUsedWithCaution ,
114
- literalTypesShouldBeUsedWithCaution ,
115
- mapsShouldBeUsedWithCaution ,
116
- unionTypesShouldBeUsedWithCaution ,
117
- } from './experimentalLanguageFeatures.js' ;
118
- import { requiredParameterMustNotBeExpert } from './builtins/expert.js' ;
119
- import {
120
- annotationCallArgumentsMustBeConstant ,
121
- annotationCallMustNotLackArgumentList ,
122
- callableTypeParametersMustNotBeAnnotated ,
123
- callableTypeResultsMustNotBeAnnotated ,
124
- lambdaParametersMustNotBeAnnotated ,
125
- } from './other/declarations/annotationCalls.js' ;
126
- import {
127
- memberAccessMustBeNullSafeIfReceiverIsNullable ,
128
- memberAccessOfEnumVariantMustNotLackInstantiation ,
129
- } from './other/expressions/memberAccesses.js' ;
130
- import { importPackageMustExist , importPackageShouldNotBeEmpty } from './other/imports.js' ;
131
- import { singleUseAnnotationsMustNotBeRepeated } from './builtins/repeatable.js' ;
132
- import {
133
- namedTypeMustNotHaveTooManyTypeArguments ,
134
- namedTypeMustNotSetTypeParameterMultipleTimes ,
135
- namedTypeTypeArgumentListMustNotHavePositionalArgumentsAfterNamedArguments ,
136
- } from './other/types/namedTypes.js' ;
137
- import { classMustNotInheritItself , classMustOnlyInheritASingleClass } from './inheritance.js' ;
138
- import {
139
- pythonNameMustNotBeSetIfPythonCallIsSet ,
140
- pythonNameShouldDifferFromSafeDsName ,
141
- } from './builtins/pythonName.js' ;
142
- import { pythonModuleShouldDifferFromSafeDsPackage } from './builtins/pythonModule.js' ;
143
- import { divisionDivisorMustNotBeZero } from './other/expressions/infixOperations.js' ;
144
- import { constantParameterMustHaveConstantDefaultValue } from './other/declarations/parameters.js' ;
145
- import { callArgumentsMustBeConstantIfParameterIsConstant } from './other/expressions/calls.js' ;
146
- import {
147
- literalTypeMustHaveLiterals ,
148
- literalTypeMustNotContainListLiteral ,
149
- literalTypeMustNotContainMapLiteral ,
150
- literalTypeShouldNotHaveDuplicateLiteral ,
151
- } from './other/types/literalTypes.js' ;
152
- import { annotationCallMustHaveCorrectTarget , targetShouldNotHaveDuplicateEntries } from './builtins/target.js' ;
153
- import { pythonCallMustOnlyContainValidTemplateExpressions } from './builtins/pythonCall.js' ;
154
- import { typeParameterMustHaveSufficientContext } from './other/declarations/typeParameters.js' ;
155
156
156
157
/**
157
158
* Register custom validation checks.
@@ -283,6 +284,7 @@ export const registerValidationChecks = function (services: SafeDsServices) {
283
284
constantParameterMustHaveConstantDefaultValue ( services ) ,
284
285
parameterMustHaveTypeHint ,
285
286
parameterDefaultValueTypeMustMatchParameterType ( services ) ,
287
+ pureParameterMustHaveCallableType ( services ) ,
286
288
requiredParameterMustNotBeDeprecated ( services ) ,
287
289
requiredParameterMustNotBeExpert ( services ) ,
288
290
] ,
0 commit comments