kotlin-power-assert
kotlin-power-assert copied to clipboard
Split the plugin, add annotation-driven configuration
Suppose something like
fun assertTrue(
expression: Boolean,
@ExpressionText("expression") description: String? = null
)
fun usageSample() {
assertTrue(2.equals(3))
// the compiler plugin should convert the call to something like
assertTrue(2.equals(3), description="2.equals(3)")
}
See https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/caller-argument-expression
WDYT?
In the mean time, I've released https://github.com/vlsi/kotlin-argument-expression#motivation
I'm hoping to tackle #45 in the coming months and think this would be another perfect fit. This sort of annotation could be a simplified version of what I'm hoping to achieve with the support library, so it will probably be a great first thing to do.
Ticket has been moved to Kotlin YouTrack: https://youtrack.jetbrains.com/issue/KT-66808