What is `capture type` , is it related to the `in`...
# compiler
i
What is
capture type
, is it related to the
in
and
out
variance? If we have a
foo<out Double>
, TypeApproximator will find all the supertypes of Double (i.e. Double -> Number -> Any) and create
ConeCapturedType
?
d
Captured types are created based on some type projections and represents "some of possible type for this projection" E.g. if you have
class Inv<T>(val x: T)
and
Inv<out Number>
, then type of
x
may be any inheritor of
Number
. And if you have two different
Inv<out Number>
their
x
both will be some
Number
inheritor, but not guaranteed that they are same
thank you color 1
Type definition for different projections: •
Nothing <: Captured(out T) <: T
T <: Captured(in T) <: Any?