Skip to content

Commit ccc9b67

Browse files
committed
Fix code to work with 2023.1 and latest Rust plugin
1 parent 5d698f7 commit ccc9b67

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/main/kotlin/com/mdrobnak/lalrpop/inspections/CannotInferNonterminalTypeInspection.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,16 @@ object CannotInferNonterminalTypeInspection : LocalInspectionTool() {
2727
LpMacroArguments.identity(nonterminal.nonterminalName.nonterminalParams)
2828
)
2929

30-
val quickFix = when (type) {
30+
if (type == "_") {
3131
// IntelliJ-Rust was unable to resolve the type, so don't
3232
// suggest the quick fix.
33-
"_" -> null
34-
else -> InferFromRustPluginQuickFix(type)
33+
return
3534
}
3635

3736
holder.registerProblem(
3837
nonterminal,
3938
"Cannot infer type of nonterminal",
40-
quickFix,
39+
InferFromRustPluginQuickFix(type),
4140
)
4241
}
4342
}

src/main/kotlin/com/mdrobnak/lalrpop/psi/ext/LpActionType.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fun LpActionType.nonterminalTypeFromReturn(ty: Ty): Ty = when (childrenWithLeave
4141
LpElementTypes.USER_ACTION, LpElementTypes.LOOKAHEAD_ACTION, LpElementTypes.LOOKBEHIND_ACTION -> ty
4242
LpElementTypes.FALLIBLE_ACTION ->
4343
ty.takeIf { (it as? TyAdt)?.item?.qualifiedName == "core::result::Result" }
44-
?.typeParameterValues?.typeByName("T")
44+
?.typeParameterValues?.typeParameterByName("T")
4545
?: error("Inferred type from fallible action code(${ty.render()}) is not Result")
4646
else -> throw IllegalStateException("Child other than =>, =>@L, =>@R, or =>? in an action_type rule")
4747
}

0 commit comments

Comments
 (0)