@@ -90,32 +90,38 @@ fun <T> KotlinTypeFacade.interpret(
90
90
val defaultArguments = processor.expectedArguments.filter { it.defaultValue is Present }.map { it.name }.toSet()
91
91
val actualArgsMap = refinedArguments.associateBy { it.name.identifier }.toSortedMap()
92
92
val conflictingKeys = additionalArguments.keys intersect actualArgsMap.keys
93
- if (conflictingKeys.isNotEmpty() && isTest) {
94
- interpretationFrameworkError(" Conflicting keys: $conflictingKeys " )
93
+ if (conflictingKeys.isNotEmpty()) {
94
+ if (isTest) {
95
+ interpretationFrameworkError(" Conflicting keys: $conflictingKeys " )
96
+ }
97
+ return null
95
98
}
96
99
val expectedArgsMap = processor.expectedArguments
97
100
.filterNot { it.name.startsWith(" typeArg" ) }
98
101
.associateBy { it.name }.toSortedMap().minus(additionalArguments.keys)
99
102
100
103
val unexpectedArguments = expectedArgsMap.keys - defaultArguments != actualArgsMap.keys - defaultArguments
101
- if (unexpectedArguments && isTest) {
102
- val message = buildString {
103
- appendLine(" ERROR: Different set of arguments" )
104
- appendLine(" Implementation class: $processor " )
105
- appendLine(" Not found in actual: ${expectedArgsMap.keys - actualArgsMap.keys} " )
106
- val diff = actualArgsMap.keys - expectedArgsMap.keys
107
- appendLine(" Passed, but not expected: ${diff} " )
108
- appendLine(" add arguments to an interpeter:" )
109
- appendLine(diff.map { actualArgsMap[it] })
104
+ if (unexpectedArguments) {
105
+ if (isTest) {
106
+ val message = buildString {
107
+ appendLine(" ERROR: Different set of arguments" )
108
+ appendLine(" Implementation class: $processor " )
109
+ appendLine(" Not found in actual: ${expectedArgsMap.keys - actualArgsMap.keys} " )
110
+ val diff = actualArgsMap.keys - expectedArgsMap.keys
111
+ appendLine(" Passed, but not expected: ${diff} " )
112
+ appendLine(" add arguments to an interpeter:" )
113
+ appendLine(diff.map { actualArgsMap[it] })
114
+ }
115
+ interpretationFrameworkError(message)
110
116
}
111
- interpretationFrameworkError(message)
117
+ return null
112
118
}
113
119
114
120
val arguments = mutableMapOf<String , Interpreter .Success <Any ?>>()
115
121
arguments + = additionalArguments
116
122
val interpretationResults = refinedArguments.refinedArguments.mapNotNull {
117
123
val name = it.name.identifier
118
- val expectedArgument = expectedArgsMap[name]!!
124
+ val expectedArgument = expectedArgsMap[name] ? : error( " $processor $name " )
119
125
val expectedReturnType = expectedArgument.klass
120
126
val value: Interpreter .Success <Any ?>? = when (expectedArgument.lens) {
121
127
is Interpreter .Value -> {
0 commit comments