also, is `context(InternalAddOp<T>, Internal...
# language-evolution
k
also, is
context(InternalAddOp<T>, InternalAddOp<R>)
prohibited, cause in theory they could have a subtype relation between them, or is that an error?
T and R don't have any type bounds
s
IRRC there was a discussion going on about this, that in this case you would need to explicitly name them. So that inside the function there is no confusion. For satisfying the
context
regular scoping rules apply.
I however cannot seem to find it anymore
k
Well, I was planning on using it for advent of code, but it seems it's not yet really feasible to do so
Rip my cursed idea for using traits
s
Even if you do this?
Copy code
context(t@InternalAddOp<T>, r@InternalAddOp<R>)
k
gives the same error
I realized today that my "short" version of todays solution had a scan that was calculating a cumulative sum, and I have a method for that, except that on only works on Ints
So I thought I'd see if I could use contexts as traits to implement stuff like this over many types at the same time
y
That error can be suppressed btw.
@Suppress("SUBTYPING_BETWEEN_CONTEXT_RECEIVERS")
k
seems like you can supress anything in kotlin