Skip to content
This repository has been archived by the owner on Aug 5, 2021. It is now read-only.

Bug in Collections/Compound tasks? #167

Open
ttoomm318 opened this issue Nov 8, 2018 · 10 comments
Open

Bug in Collections/Compound tasks? #167

ttoomm318 opened this issue Nov 8, 2018 · 10 comments

Comments

@ttoomm318
Copy link

ttoomm318 commented Nov 8, 2018

There seems to be a bug with the test(s) for
fun Shop.getNumberOfTimesProductWasOrdered(product: Product): Int

I've tried the the following two solutions:

Provided solution:

fun Shop.getNumberOfTimesProductWasOrdered(product: Product): Int {
    return customers.flatMap { it.getOrderedProductsList() }.count { it == product }
}

fun Customer.getOrderedProductsList(): List<Product> {
    return orders.flatMap { it.products }
}

My original solution:

fun Shop.getNumberOfTimesProductWasOrdered(product: Product): Int =
    customers.flatMap { it.orders }.flatMap { it.products }.count { it == product }

at the following two sites:

and I get

Assigning single elements to varargs in named form is forbidden

Just to add, I tried the same solution in the Playground at https://play.kotlinlang.org/ (using the same code from Shop.kt and simplified code from TestShop.kt) and it runs fine, giving the correct result.

I've attached the file with code copied from Playground.
Kotlin Playground.kt.zip

@antohaby
Copy link

antohaby commented Nov 12, 2018

Got yesterday same issue. Because of that cant make 100% progress :(

It seems that it was fixed before 888c9a1 when it was just a deprecation.

@EhsanKia
Copy link

EhsanKia commented Nov 13, 2018

I just hit this now. The easy temporary solution is to change the runtime to something other than 1.3 in the bottom right corner.

@ivannarino
Copy link

The bug is still there

@davidgiessing
Copy link

Just hit the bug. It is just the testcase that is (now) wrong since it tries to assign a single value in named form to a collection. However @EhsanKia s temporary workaround does indeed work.

@h8
Copy link

h8 commented Mar 29, 2019

The bug is still not fixed, and looks like there is no way to change the Kotlin version in Koans.

@regulus33
Copy link

regulus33 commented Apr 5, 2019

Still there for me too :( its a shame I won't be able to get satisfaction of seeing 100% in the progress bar now 😢

@mgwizdal
Copy link

Its still not working :(

@AlexanderPrendota
Copy link

@mgwizdal please hard refresh the page

@mgwizdal
Copy link

@AlexanderPrendota Tried on different browsers and refreshsed hard - still the same issue

@AlexanderPrendota
Copy link

Screen Shot 2019-05-29 at 11 05 52 AM

Please try one in private mode. Maybe it helps. Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants