Skip to content

Commit

Permalink
Fix collision of types and parameter name in Apinotes for complex opt…
Browse files Browse the repository at this point in the history
…ional types.
  • Loading branch information
FilipDolnik committed Nov 13, 2023
1 parent 49f60b0 commit 7cf51ea
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import co.touchlab.skie.oir.element.OirSimpleFunction
import co.touchlab.skie.oir.element.OirTypeDef
import co.touchlab.skie.oir.element.OirVisibility
import co.touchlab.skie.oir.element.allFunctions
import co.touchlab.skie.oir.element.memberFunctions
import co.touchlab.skie.oir.type.BlockPointerOirType
import co.touchlab.skie.oir.type.DeclaredOirType
import co.touchlab.skie.oir.type.NonNullReferenceOirType
import co.touchlab.skie.oir.type.NullableReferenceOirType
import co.touchlab.skie.oir.type.OirType
import co.touchlab.skie.oir.type.PointerOirType
Expand Down Expand Up @@ -73,7 +73,13 @@ class FixOirFunctionSignaturesForApiNotesPhase(
}
is TypeParameterUsageOirType -> this
is SpecialReferenceOirType -> substituteLeafType(reservedIdentifiers)
is NullableReferenceOirType -> substituteLeafType(reservedIdentifiers)
is NullableReferenceOirType -> {
when (val innerType = nonNullType.substituteReservedIdentifiers(reservedIdentifiers)) {
is NonNullReferenceOirType -> NullableReferenceOirType(innerType)
is TypeDefOirType -> getOrCreateTypeDef(this).toType(innerType.typeArguments)
else -> error("Unexpected inner type: $innerType")
}
}
is PointerOirType -> copy(pointee = pointee.substituteReservedIdentifiers(reservedIdentifiers))
is PrimitiveOirType, VoidOirType -> substituteLeafType(reservedIdentifiers)
is TypeDefOirType -> {
Expand Down

0 comments on commit 7cf51ea

Please sign in to comment.