package org.jetbrains.dokka.model fun SourceSetDependent.filtered(platformDataList: List) = filter { it.key in platformDataList } fun SourceSetData?.filtered(platformDataList: List) = takeIf { this in platformDataList } fun DTypeParameter.filter(filteredData: List) = if (filteredData.containsAll(sourceSets)) this else { val intersection = filteredData.intersect(sourceSets).toList() if (intersection.isEmpty()) null else DTypeParameter( dri, name, documentation.filtered(intersection), expectPresentInSet?.takeIf { intersection.contains(expectPresentInSet) }, bounds, intersection, extra ) }