Dear IntelliJ devs, just came here to say thank you for saving me from silent bugs with this inspection kodee loving
👍 4
kodee loving 3
k
Klitos Kyriacou
03/28/2024, 9:55 AM
That's a very useful inspection! But you can eliminate bugs like these by using
inline
classes
Name
and
Type
instead of
String
.
e
edrd
03/28/2024, 11:47 AM
Indeed. In this case, though, I need to convert these down to strings because they are used for code generation, so I wonder if that would help. For example:
Copy code
value class Name(private val string: String) {
override fun toString() = string
}
// ...
val (type, name) = field
appendLine("val $name: $type") // Same problem?
I think the only way alternative to keep the code short and avoid the bug would be to use `with`/`run`…