How to make certain instantiations of generic type equivalent?


I’m creating a library for anonymous records and I want to design my records in a such way that order of fields doesn’t matter.

Currently I define fields

object id : Field<Int>("id", IntType)
object name : Field<String>("name", StringType)

and I can write types like this Record<id, name> or Record<name, id>. But these two types are unfortunately different. How can I persuade Kotlin compiler to treat them as equivalent?

I assume I can write compiler plugin but that will not work in IDEs or will it?