Super in string template


I’m pretty new in Kotlin, even if I feel confident now, and I’d like an expert advice before submitting a bug in IntelliJ IDEA…

I have just used the automatic toString generation feature of IDEA in one of my Kotlin classes, and this is the result:

return "AppointmentSlotType(label='$label', activeFrom=$activeFrom, activeTo=$activeTo) ${super}"

pretty straightforward, but now the IDE complains about the super keyword: ‘super’ is not an expression, it can only be used on the left-hand side of a dot

I’m pretty sure the generated code is indeed ok, as it implicitly calls toString() on super, and the bug resides in a wrong IntelliJ IDEA inspection.

Otherwise, if you think the above code is somewhat wrong or poses some subtle problems, the bug resides in the code generation feature.

In any case, there’s a bug in the IDE and I’ll submit it on YouTrack ASAP…



super cannot be used as an expression directly. The generated code needs to use ${super.toString()}.


Ok, then the toString() generation should be fixed, along with the RemoveToStringInStringTemplate compilation warning…

I need to suppress it now:

return "AppointmentSlotType(label='$label', activeFrom=$activeFrom, activeTo=$activeTo) ${super.toString()}"

Let me know if I should file a bug myself, or you’re going to open it internally…

Thanks for your support!


Please do file a bug for this.


Submitted here: