Is kotlin meant to support file-private typealiase...
# language-proposals
s
Is kotlin meant to support file-private typealiases currently? If not it could be a nice feature. I can write
private typealias Binding = ItemRotaBinding
in the IDE without lint errors, but then when I try to create another one (e.g.
private typealias Binding = ItemShiftBinding
) in an adjacent file, it complains about redeclaration
a
I guess the visibility of the actual class may get reflected, as the typealias does not define a new type.
s
but the actual type is public.
a
So alias 'should' be public, no?
Any usecase 👀
i
It is a bug in type resolution, which requires breaking changes: https://youtrack.jetbrains.com/issue/KT-24700
👀 2
s
thanks. Yeah my use case is just trying to make code less verbose by using a more generic typealias just within one file. E.g. I have adapters for lists which all use a databinding class and the name of the binding can get quite long e.g. -
RotaParticipantItemBinding
,
ShiftSlotItemBinding
, and then view holders which are generic -
ViewBinderHolding<RotaParticipantItemBinding>
which appears in multiple places but only that file. would be nice just to alias as
Binding
and
ViewHolder
at the top of the file without any clashes.
have voted for the youtrack issue 👍