How to identify if a KSTypeReference
is an aliased imported type?
#2391
Milestone
8000
KSTypeReference
is an aliased imported type?
#2391
TLDR: How to (consistently) identify that a type is actually an aliased import?
Given the following code block
And given the following simplified KSP code
My current (frankly ugly and not optimal) way to identify if it is an alias:
Sadly this is not working anymore since 2.1.20-1.0.32, as the
typeReference
is not anymore an instance ofKSTypeReferenceImpl
(1.0.31) but ofKSTypeReferenceResolvedImpl
(1.0.32), which has a different result fortoString()
.For
fromFP
:KSTypeReferenceImpl
withtoString() == "FP"
KSTypeReferenceResolvedImpl
withtoString() == "Double"
I could amend the already ugly
isAlias
logic, but then I directly stumble upon similar problems with nullable types (seefromString
) or even worse: a combination of nullable aliased import types with generics 😵For
fromString
:KSTypeReferenceImpl
withtoString() == "String"
KSTypeReferenceResolvedImpl
withtoString() == "String?"
The text was updated successfully, but these errors were encountered: