Skip to content

Commit 6d954f8

Browse files
committed
Merge branch 'master' into devcrocod/serialization-patch0
2 parents d061d13 + 1a818ca commit 6d954f8

File tree

60 files changed

+1703
-867
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1703
-867
lines changed

core/build.gradle.kts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ val samplesTest = tasks.register<Test>("samplesTest") {
130130
ignoreFailures = true
131131

132132
testClassesDirs = fileTree("${layout.buildDirectory.get().asFile.path}/classes/testWithOutputs/kotlin")
133-
classpath = files("${layout.buildDirectory.get().asFile.path}/classes/testWithOutputs/kotlin") + configurations["samplesRuntimeClasspath"] + sourceSets["main"].runtimeClasspath
133+
classpath =
134+
files("${layout.buildDirectory.get().asFile.path}/classes/testWithOutputs/kotlin") +
135+
configurations["samplesRuntimeClasspath"] +
136+
sourceSets["main"].runtimeClasspath
134137
}
135138

136139
val clearSamplesOutputs by tasks.creating {
@@ -209,14 +212,17 @@ val kotlinTestSources: FileCollection = kotlin.sourceSets.test.get().kotlin.sour
209212

210213
fun pathOf(vararg parts: String) = parts.joinToString(File.separator)
211214

215+
// Include both test and main sources for cross-referencing, Exclude generated sources
216+
val processKDocsMainSources = (kotlinMainSources + kotlinTestSources)
217+
.filterNot { pathOf("build", "generated") in it.path }
218+
212219
// Task to generate the processed documentation
213-
val processKDocsMain by creatingProcessDocTask(
214-
sources = (kotlinMainSources + kotlinTestSources) // Include both test and main sources for cross-referencing
215-
.filterNot { pathOf("build", "generated") in it.path }, // Exclude generated sources
216-
) {
220+
val processKDocsMain by creatingProcessDocTask(processKDocsMainSources) {
217221
target = file(generatedSourcesFolderName)
218222
arguments += ARG_DOC_PROCESSOR_LOG_NOT_FOUND to false
219-
223+
exportAsHtml {
224+
dir = file("../docs/StardustDocs/snippets")
225+
}
220226
task {
221227
group = "KDocs"
222228
doLast {
@@ -248,9 +254,11 @@ tasks.withType<Jar> {
248254
pathOf("src", "test", "kotlin") in it.path ||
249255
pathOf("src", "test", "java") in it.path
250256
} // filter out test sources again
251-
.plus(kotlinMainSources.filter {
252-
pathOf("build", "generated") in it.path
253-
}) // Include generated sources (which were excluded above)
257+
.plus(
258+
kotlinMainSources.filter {
259+
pathOf("build", "generated") in it.path
260+
},
261+
), // Include generated sources (which were excluded above)
254262
)
255263
}
256264
}
@@ -363,7 +371,7 @@ tasks.test {
363371
excludes.set(
364372
listOf(
365373
"org.jetbrains.kotlinx.dataframe.jupyter.*",
366-
"org.jetbrains.kotlinx.dataframe.jupyter.SampleNotebooksTests"
374+
"org.jetbrains.kotlinx.dataframe.jupyter.SampleNotebooksTests",
367375
)
368376
)
369377
}

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl.kt

Lines changed: 119 additions & 124 deletions
Large diffs are not rendered by default.

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataColumnType.kt

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ package org.jetbrains.kotlinx.dataframe.api
22

33
import org.jetbrains.kotlinx.dataframe.AnyCol
44
import org.jetbrains.kotlinx.dataframe.columns.ColumnKind
5+
import org.jetbrains.kotlinx.dataframe.impl.isNothing
6+
import org.jetbrains.kotlinx.dataframe.impl.projectTo
57
import org.jetbrains.kotlinx.dataframe.type
68
import org.jetbrains.kotlinx.dataframe.typeClass
79
import kotlin.reflect.KClass
810
import kotlin.reflect.KType
11+
import kotlin.reflect.KTypeProjection
912
import kotlin.reflect.full.isSubclassOf
1013
import kotlin.reflect.full.isSubtypeOf
1114
import kotlin.reflect.typeOf
@@ -16,7 +19,8 @@ public fun AnyCol.isFrameColumn(): Boolean = kind() == ColumnKind.Frame
1619

1720
public fun AnyCol.isValueColumn(): Boolean = kind() == ColumnKind.Value
1821

19-
public fun AnyCol.isSubtypeOf(type: KType): Boolean = this.type.isSubtypeOf(type) && (!this.type.isMarkedNullable || type.isMarkedNullable)
22+
public fun AnyCol.isSubtypeOf(type: KType): Boolean =
23+
this.type.isSubtypeOf(type) && (!this.type.isMarkedNullable || type.isMarkedNullable)
2024

2125
public inline fun <reified T> AnyCol.isSubtypeOf(): Boolean = isSubtypeOf(typeOf<T>())
2226

@@ -26,9 +30,23 @@ public fun AnyCol.isNumber(): Boolean = isSubtypeOf<Number?>()
2630

2731
public fun AnyCol.isList(): Boolean = typeClass == List::class
2832

29-
public fun AnyCol.isComparable(): Boolean = isSubtypeOf<Comparable<*>?>()
33+
/**
34+
* Returns `true` if [this] column is comparable, i.e. its type is a subtype of [Comparable] and its
35+
* type argument is not [Nothing].
36+
*/
37+
public fun AnyCol.isComparable(): Boolean =
38+
isSubtypeOf<Comparable<*>?>() &&
39+
type().projectTo(Comparable::class).arguments[0].let {
40+
it != KTypeProjection.STAR &&
41+
it.type?.isNothing != true
42+
}
3043

3144
@PublishedApi
3245
internal fun AnyCol.isPrimitive(): Boolean = typeClass.isPrimitive()
3346

34-
internal fun KClass<*>.isPrimitive(): Boolean = isSubclassOf(Number::class) || this == String::class || this == Char::class || this == Array::class || isSubclassOf(Collection::class)
47+
internal fun KClass<*>.isPrimitive(): Boolean =
48+
isSubclassOf(Number::class) ||
49+
this == String::class ||
50+
this == Char::class ||
51+
this == Array::class ||
52+
isSubclassOf(Collection::class)

0 commit comments

Comments
 (0)