-
Notifications
You must be signed in to change notification settings - Fork 73
Refactor toDataFrame implementation in compiler plugin #782
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
Conversation
@@ -161,6 +164,9 @@ internal inline fun <reified T> String.load(): T { | |||
"ReadDelimStr" -> ReadDelimStr() | |||
"GroupByToDataFrame" -> GroupByToDataFrame() | |||
"ToDataFrameFrom0" -> ToDataFrameFrom() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To and to?, again, could they be a CONSTANTS?
@@ -269,6 +270,10 @@ fun <T> KotlinTypeFacade.interpret( | |||
} | |||
} | |||
|
|||
fun interpretationFrameworkError(message: String): Nothing = throw InterpretationFrameworkError(message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name looks like object name, not a function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't argue, but i was inspired by "error" function from standard library
} | ||
val expectedArgsMap = processor.expectedArguments | ||
.filterNot { it.name.startsWith("typeArg") } | ||
.associateBy { it.name }.toSortedMap().minus(additionalArguments.keys) | ||
|
||
if (expectedArgsMap.keys - defaultArguments != actualArgsMap.keys - defaultArguments) { | ||
val unexpectedArguments = expectedArgsMap.keys - defaultArguments != actualArgsMap.keys - defaultArguments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very interesting algebra of arguments (great to explain somehow this kind of logic)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is needed to simplify debug if someone writes an interpreter for fun a(myArgument: String)
but misspells myArgument as myArg123123ument. Expected argument (by interpreter) is myArg123123ument, actual myArgument.
Easy to check.
But with default value:
fun a(myArgument: String, myArgument1: String = "defaultValue")
a("abc")
actualArg = myArgument, expectedArg = myArg123123ument, myArgument1.
We know that for myArgument1 default value is provided, so we exclude such arguments from comparison: it's not a mistake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But i can't say that i like the idea of adding this as a comment though. It might not be obvious in PR and i'm ok with providing a better explanations here. But in IDEA, won't you agree that code is enough?
plugins/kotlin-dataframe/src/org/jetbrains/kotlinx/dataframe/plugin/analyzeRefinedCallShape.kt
Show resolved
Hide resolved
…rt them as compilation errors. Add special constructor for errors that shouldn't be caught
Interpreters need an ability to pass arguments down to DSL, so introduce new "dsl" factory function
…ts failure messages
c5c02b9
to
642a2ee
Compare
No description provided.