Closed nicholasq closed 9 years ago
Which error exactly are you getting?
The error in IDEA says:
using rangeTo(T): ComparableRange
I have my DateRange implemented just like the resolution in this repo.
using rangeTo(T): ComparableRange is an error. This range implementation has unclear semantics and will be removed soon.
I had the same error and was wondering for a while about what was going on.
I found the reason by using "Go To Declaration" (F3 with the Eclipse key bindings) on the ..
operator, which took me to rangeTo
for Comparable
, not to my implementation as I would have expected. Looking at that deprecated definition I noticed that it is prefixed with public operator fun
.
Going back to my implementation I found that I did not declare my fun rangeTo
as operator, so Kotlin did not use it. Of course it would be helpful to have a warning here if a function with the required name is available but not declared as operator. :-)
Anyway, that fixed it for me. All tests are passing now and I really enjoyed the workshop. Thanks!
Edit: Fixed Markdown formatting. I am using Jira too often... :blush:
Ah! Thank you Bluehorn! This fixed it.
Was there a language change regarding using Ranges in a forEach loop? (I'm on kotlin 1.0 beta)
In iii_conventions/_RangeTo.kt :
Will not compile for me. I am pretty sure I have my DateRange implemented correctly.
Thank you! Loving Kotlin!