but when I do Foo..Foo its a type of ClosedRange&l...
# announcements
b
but when I do Foo..Foo its a type of ClosedRange<Foo> insead of FooRange that I've implemented
d
You need to overload the range operator:
Copy code
operator fun Foo.rangeTo(other: Foo) = FooRange(...)
❤️ 1
b
many thanks! ❤️
didn't know I have to overload the range too
@diesieben07 I did so
Copy code
class IpAddressRange(
    start: Ipv4Address,
    endInclusive: Ipv4Address
) : ClosedRange<Ipv4Address>, IpAddressProgression(start, endInclusive)

operator fun Ipv4Address.rangeTo(other: Ipv4Address) = IpAddressRange(this, other)
and it worked at first but then I moved it to other module and broke, any ideas?
d
Make sure you import the function
b
damn indeed
thanks again