Skip to content

Commit 69bef3d

Browse files
committed
refactor(counit): use correct type declaration for decoding #51
The `json.decodeFromString` call was incorrectly assigning the result to a variable of type `ExplainQuery` without specifying the generic type. This commit fixes the type declaration to be `json.decodeFromString<ExplainQuery>`, which ensures that the correct type inference is used when decoding the JSON string. This change ensures that the correct type is being used and avoids potential runtime errors.
1 parent 50b1538 commit 69bef3d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/main/kotlin/cc/unitmesh/devti/counit/CoUnitPreProcessor.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ class CoUnitPreProcessor(val project: Project) {
5757

5858
val explain = try {
5959
val fixedResult = fix(result)
60-
val explain: ExplainQuery = json.decodeFromString(fixedResult)
61-
explain
60+
json.decodeFromString<ExplainQuery>(fixedResult)
6261
} catch (e: Exception) {
6362
LOG.error("parse result error: $e")
6463
return@launch

0 commit comments

Comments
 (0)