Fix up formatting issues

This commit is contained in:
Brian Norman
2021-04-04 17:58:05 -05:00
parent ce119c9d92
commit 8d73179c89
4 changed files with 37 additions and 32 deletions
@@ -229,11 +229,11 @@ class PowerAssertCallTransformer(
private fun isStringSupertype(type: IrType): Boolean = private fun isStringSupertype(type: IrType): Boolean =
context.irBuiltIns.stringType.isSubtypeOf(type, context.irBuiltIns) context.irBuiltIns.stringType.isSubtypeOf(type, context.irBuiltIns)
private fun IrType.isAssignableTo(type: IrType): Boolean = private fun IrType.isAssignableTo(type: IrType): Boolean {
isSubtypeOf(type, context.irBuiltIns) || if (isSubtypeOf(type, context.irBuiltIns)) return true
((type.classifierOrNull as? IrTypeParameterSymbol)?.owner?.superTypes?.all { val superTypes = (type.classifierOrNull as? IrTypeParameterSymbol)?.owner?.superTypes
isSubtypeOf(it, context.irBuiltIns) return superTypes != null && superTypes.all { isSubtypeOf(it, context.irBuiltIns) }
} ?: false) }
private fun MessageCollector.info(expression: IrElement, message: String) { private fun MessageCollector.info(expression: IrElement, message: String) {
report(expression, CompilerMessageSeverity.INFO, message) report(expression, CompilerMessageSeverity.INFO, message)
@@ -2,7 +2,6 @@ package com.bnorm.power
import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.FqName
import org.junit.Test import org.junit.Test
import kotlin.test.assertEquals
class AssertBooleanTest { class AssertBooleanTest {
@Test @Test
@@ -12,9 +12,11 @@ import kotlin.test.assertEquals
class DebugFunctionTest { class DebugFunctionTest {
@Test @Test
fun `debug function transformation`() { fun `debug function transformation`() {
val actual = executeMainDebug(""" val actual = executeMainDebug(
"""
dbg(1 + 2 + 3) dbg(1 + 2 + 3)
""".trimIndent()) """.trimIndent()
)
assertEquals( assertEquals(
""" """
dbg(1 + 2 + 3) dbg(1 + 2 + 3)
@@ -27,9 +29,11 @@ class DebugFunctionTest {
} }
@Test @Test
fun `debug function transformation with message`() { fun `debug function transformation with message`() {
val actual = executeMainDebug(""" val actual = executeMainDebug(
"""
dbg(1 + 2 + 3, "Message:") dbg(1 + 2 + 3, "Message:")
""".trimIndent()) """.trimIndent()
)
assertEquals( assertEquals(
""" """
Message: Message:
@@ -130,7 +130,8 @@ class PowerAssertTest {
| | | |
| Jane | Jane
Hello, Jane Hello, Jane
""".trimIndent()) """.trimIndent()
)
} }
@Test @Test
@@ -146,6 +147,7 @@ class PowerAssertTest {
| | | |
| Jane | Jane
Hello, Jane Hello, Jane
""".trimIndent()) """.trimIndent()
)
} }
} }