Skip to content

Commit b56c579

Browse files
committed
(WIP) default arguments
1 parent c8af5da commit b56c579

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package org.example
2+
3+
import androidx.compose.runtime.*
4+
5+
/**
6+
* https://github.com/JetBrains/kotlin/blob/2.1.0/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposableFunctionBodyTransformer.kt#L3018-L3022
7+
* https://github.com/JetBrains/kotlin/blob/2.1.0/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposableFunctionBodyTransformer.kt#L1364-L1407
8+
*/
9+
@Composable
10+
fun default_arguments_example(
11+
a: String = "a",
12+
b: String = "b",
13+
) {
14+
}
15+
16+
fun non_composable_example(
17+
a: String = "a",
18+
b: String = "b",
19+
) {
20+
}
21+
22+
@Composable
23+
fun default_arguments() {
24+
default_arguments_example()
25+
non_composable_example()
26+
}

src/test/kotlin/org/example/ExampleTest.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,11 @@ class ExampleTest {
2222
compose.onNodeWithText("Click me again").assertDoesNotExist()
2323
}
2424

25+
@Test
26+
fun test_default_arguments() {
27+
compose.setContent {
28+
default_arguments()
29+
}
30+
}
31+
2532
}

0 commit comments

Comments
 (0)