kotlin-power-assert icon indicating copy to clipboard operation
kotlin-power-assert copied to clipboard

Split the plugin, add annotation-driven configuration

Open vlsi opened this issue 2 years ago • 2 comments

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?

vlsi avatar Feb 20 '23 17:02 vlsi

In the mean time, I've released https://github.com/vlsi/kotlin-argument-expression#motivation

vlsi avatar Feb 27 '23 08:02 vlsi

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.

bnorm avatar Mar 01 '23 15:03 bnorm

Ticket has been moved to Kotlin YouTrack: https://youtrack.jetbrains.com/issue/KT-66808

bnorm avatar Jun 09 '24 16:06 bnorm