User: llamalad7 Date: 27 Dec 23 21:12 Revision: b2747ed4f197e6eace84b79905b4f9d770696080 Summary: MixinExtras: Fix incorrect suggested return type for `@WrapOperation` on field assignments. (#2191) TeamCity URL: http://ci.mcdev.io:80/viewModification.html?tab=vcsModificationFiles&modId=8930&personal=false Index: src/main/kotlin/platform/mixin/handlers/mixinextras/MixinExtrasInjectorAnnotationHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/mixinextras/MixinExtrasInjectorAnnotationHandler.kt (revision d704b7b41f5a573771d84c24d252c2058b2e446c) +++ src/main/kotlin/platform/mixin/handlers/mixinextras/MixinExtrasInjectorAnnotationHandler.kt (revision b2747ed4f197e6eace84b79905b4f9d770696080) @@ -36,6 +36,7 @@ import com.intellij.psi.JavaPsiFacade import com.intellij.psi.PsiAnnotation import com.intellij.psi.PsiType +import com.intellij.psi.PsiTypes import org.objectweb.asm.Opcodes import org.objectweb.asm.Type import org.objectweb.asm.tree.AbstractInsnNode @@ -153,13 +154,19 @@ } is FieldInsnNode -> { + when (insn.opcode) { + Opcodes.PUTFIELD, Opcodes.PUTSTATIC -> PsiTypes.voidType() + else -> { - val sourceClassAndField = ( - MemberReference(insn.name, insn.desc, insn.owner.replace('/', '.')) - .resolveAsm(annotation.project) as? FieldTargetMember - )?.classAndField + val sourceClassAndField = ( + MemberReference(insn.name, insn.desc, insn.owner.replace('/', '.')) + .resolveAsm(annotation.project) as? FieldTargetMember + )?.classAndField + - sourceClassAndField?.field?.getGenericType(sourceClassAndField.clazz, annotation.project) - ?: Type.getType(insn.desc).toPsiType(elementFactory) - } + sourceClassAndField?.field?.getGenericType(sourceClassAndField.clazz, annotation.project) + ?: Type.getType(insn.desc).toPsiType(elementFactory) + } + } + } else -> getInsnReturnType(insn)?.toPsiType(elementFactory) }