#StackBounty: #android-studio Why can the code be compiled when I add a redundant comma in parameter?

Bounty: 50

I use Android Studio Arctic Fox, the Code A is from the project.

And Code A is can be compiled correctly. I find that Code B can also be compiled creeclty when I add a redundant comma in parameter list, why?

Code A

composable(Bills.name) {
            BillsBody(bills = UserData.bills)
        }

Code B

composable(Bills.name, ) {
            BillsBody(bills = UserData.bills)
        }

The same

public fun NavGraphBuilder.composable(
    route: String,
    arguments: List<NamedNavArgument> = emptyList(),
    deepLinks: List<NavDeepLink> = emptyList(),
    content: @Composable (NavBackStackEntry) -> Unit
) {
    addDestination(
        ComposeNavigator.Destination(provider[ComposeNavigator::class], content).apply {
            this.route = route
            arguments.forEach { (argumentName, argument) ->
                addArgument(argumentName, argument)
            }
            deepLinks.forEach { deepLink ->
                addDeepLink(deepLink)
            }
        }
    )
}


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.