Skip to content

Compiler plugin fixes #740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ fun KotlinTypeFacade.analyzeRefinedCallShape(call: FirFunctionCall, reporter: In
return null
}

val newSchema: PluginDataFrameSchema = call.interpreterName(session)?.let {
when (it) {
val newSchema: PluginDataFrameSchema = call.interpreterName(session)?.let { name ->
when (name) {
"toDataFrameDsl" -> {
val list = call.argumentList as FirResolvedArgumentList
val lambda = (list.arguments.singleOrNull() as? FirAnonymousFunctionExpression)?.anonymousFunction
Expand Down Expand Up @@ -85,7 +85,7 @@ fun KotlinTypeFacade.analyzeRefinedCallShape(call: FirFunctionCall, reporter: In
PluginDataFrameSchema(emptyList())
}
}
else -> it.load<Interpreter<*>>().let { processor ->
else -> name.load<Interpreter<*>>().let { processor ->
val dataFrameSchema = interpret(call, processor, reporter = reporter)
.let {
val value = it?.value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,6 @@ interface KotlinTypeFacade {

fun Marker.type() = type

val anyDataFrame get() = ConeClassLikeTypeImpl(
ConeClassLikeLookupTagImpl(Names.DF_CLASS_ID),
typeArguments = arrayOf(session.builtinTypes.anyType.type),
isNullable = false
).wrap()

val anyRow get() = ConeClassLikeTypeImpl(
ConeClassLikeLookupTagImpl(Names.DATA_ROW_CLASS_ID),
typeArguments = arrayOf(session.builtinTypes.anyType.type),
isNullable = false
).wrap()

fun from(type: KType): Marker {
return Marker(fromImpl(type))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("INVISIBLE_REFERENCE", "CANNOT_OVERRIDE_INVISIBLE_MEMBER")

package org.jetbrains.kotlinx.dataframe.plugin.impl

import org.jetbrains.kotlin.fir.types.ConeKotlinType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")

package org.jetbrains.kotlinx.dataframe.plugin.impl.api

import org.jetbrains.kotlinx.dataframe.plugin.impl.AbstractInterpreter
Expand All @@ -9,7 +11,6 @@ import org.jetbrains.kotlinx.dataframe.api.Infer
import org.jetbrains.kotlinx.dataframe.api.pathOf
import org.jetbrains.kotlinx.dataframe.api.toPath
import org.jetbrains.kotlinx.dataframe.impl.api.GenericColumnsToInsert
import org.jetbrains.kotlinx.dataframe.impl.api.GenericColumnGroup
import org.jetbrains.kotlinx.dataframe.impl.api.insertImplGenericContainer
import org.jetbrains.kotlinx.dataframe.plugin.impl.PluginDataFrameSchema
import org.jetbrains.kotlinx.dataframe.plugin.impl.SimpleCol
Expand Down Expand Up @@ -81,7 +82,7 @@ internal class Under0 : AbstractInterpreter<PluginDataFrameSchema>() {
val Arguments.receiver: InsertClauseApproximation by insertClause()

override fun Arguments.interpret(): PluginDataFrameSchema {
return receiver.df.insertImpl(listOf(GenericColumnsToInsert(column.path.path.toPath(), receiver.column)), anyDataFrame)
return receiver.df.insertImpl(listOf(GenericColumnsToInsert(column.path.path.toPath(), receiver.column)))
}
}

Expand All @@ -90,7 +91,7 @@ internal class Under1 : AbstractInterpreter<PluginDataFrameSchema>() {
val Arguments.receiver: InsertClauseApproximation by insertClause()

override fun Arguments.interpret(): PluginDataFrameSchema {
return receiver.df.insertImpl(listOf(GenericColumnsToInsert(columnPath.path.toPath(), receiver.column)), anyRow)
return receiver.df.insertImpl(listOf(GenericColumnsToInsert(columnPath.path.toPath(), receiver.column)))
}
}

Expand All @@ -99,7 +100,7 @@ internal class Under2 : AbstractInterpreter<PluginDataFrameSchema>() {
val Arguments.receiver: InsertClauseApproximation by insertClause()

override fun Arguments.interpret(): PluginDataFrameSchema {
return receiver.df.insertImpl(listOf(GenericColumnsToInsert(pathOf(column.name), receiver.column)), anyRow)
return receiver.df.insertImpl(listOf(GenericColumnsToInsert(pathOf(column.name), receiver.column)))
}
}

Expand All @@ -108,7 +109,7 @@ internal class Under3 : AbstractInterpreter<PluginDataFrameSchema>() {
val Arguments.receiver: InsertClauseApproximation by insertClause()

override fun Arguments.interpret(): PluginDataFrameSchema {
return receiver.df.insertImpl(listOf(GenericColumnsToInsert(pathOf(column.name), receiver.column)), anyRow)
return receiver.df.insertImpl(listOf(GenericColumnsToInsert(pathOf(column.name), receiver.column)))
}
}

Expand All @@ -117,16 +118,15 @@ internal class Under4 : AbstractInterpreter<PluginDataFrameSchema>() {
val Arguments.receiver: InsertClauseApproximation by insertClause()

override fun Arguments.interpret(): PluginDataFrameSchema {
return receiver.df.insertImpl(listOf(GenericColumnsToInsert(pathOf(column), receiver.column)), anyRow)
return receiver.df.insertImpl(listOf(GenericColumnsToInsert(pathOf(column), receiver.column)))
}
}

@PublishedApi
internal fun PluginDataFrameSchema.insertImpl(
columns: List<GenericColumnsToInsert<SimpleCol>>,
columnGroupType: TypeApproximation
columns: List<GenericColumnsToInsert<SimpleCol>>
): PluginDataFrameSchema {
return insertImplGenericContainer<PluginDataFrameSchema, SimpleCol, GenericColumnGroup<SimpleCol>>(
return insertImplGenericContainer(
this,
columns,
columns.firstOrNull()?.referenceNode?.getRoot(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")

package org.jetbrains.kotlinx.dataframe.plugin.impl.api

import org.jetbrains.kotlinx.dataframe.plugin.impl.AbstractInterpreter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ val KotlinTypeFacade.toPluginDataFrameSchema: DataFrameSchema.() -> PluginDataFr
)
}



val KotlinTypeFacade.deserializeToPluginDataFrameSchema: SerializableSchema.() -> PluginDataFrameSchema
get() = {
PluginDataFrameSchema(
Expand Down Expand Up @@ -155,7 +153,6 @@ private fun from(type: KType): SerializableKType {
return serializableKType
}


private fun List<KTypeProjection>.mapToConeTypeProjection(): List<TypeProjection> = List(size) {
val typeProjection = get(it)
val type = typeProjection.type
Expand Down Expand Up @@ -189,7 +186,6 @@ private fun List<TypeProjection>.mapToConeTypeProjection(): Array<out ConeTypePr
}
}


fun KType.from(): String {
val classifier = classifier ?: error("")
val klass = classifier as? KClass<*> ?: error("")
Expand Down
Loading