https://kotlinlang.org logo
#arrow-meta
Title
# arrow-meta
j

Joachim Ansorg

11/26/2019, 6:41 PM
Question of kast transformations: I was testing my new resolve changed and had this file:
Copy code
package testArrow

import arrow.higherkind

@higherkind
class Id<out A>(val value: A)

val id : IdOf<Int> = Id(42)

fun main() {
    val x = id.fix()
}
Then, I typed
id.
in main which triggered a transformation with the quote system. I got this expception:
Copy code
java.lang.IllegalStateException: No qualified rhs for DOT_QUALIFIED_EXPRESSION
	at arrow.meta.internal.kastree.ast.psi.Converter.convertBinaryOp(Converter.kt:101)
	at arrow.meta.internal.kastree.ast.psi.Converter.convertExpr(Converter.kt:259)
	at arrow.meta.internal.kastree.ast.psi.Converter.convertStmtNo(Converter.kt:488)
	at arrow.meta.internal.kastree.ast.psi.Converter.convertBlock(Converter.kt:105)
	at arrow.meta.internal.kastree.ast.psi.Converter.convertFuncBody(Converter.kt:323)
	at arrow.meta.internal.kastree.ast.psi.Converter.convertFunc(Converter.kt:319)
	at arrow.meta.internal.kastree.ast.psi.Converter.convertDecl(Converter.kt:199)
	at arrow.meta.internal.kastree.ast.psi.Converter.convertFile(Converter.kt:298)
	at arrow.meta.quotes.QuoteKt.sourceWithTransformationsAst(Quote.kt:292)
	at arrow.meta.ide.phases.resolve.QuoteSystemCache.transformFiles(QuoteSystemCache.kt:326)
	at arrow.meta.ide.phases.resolve.QuoteSystemCache.access$transformFiles(QuoteSystemCache.kt:56)
	at arrow.meta.ide.phases.resolve.QuoteSystemCache$refreshCache$1$transformed$1.compute(QuoteSystemCache.kt:189)
	at arrow.meta.ide.phases.resolve.QuoteSystemCache$refreshCache$1$transformed$1.compute(QuoteSystemCache.kt:56)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:936)
	at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:57)
	at arrow.meta.ide.phases.resolve.QuoteSystemCache$refreshCache$1.run(QuoteSystemCache.kt:188)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:294)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Is this a bug or may I only send code with valid syntax to the quote system?
r

raulraja

11/26/2019, 9:01 PM
you can only send code with valid syntax while we depend n kastree because their parser is not as lenient as PSI
as we approach completion of all the Quote scope element we will have a mirror delegated version of PSI which does support node transformation since its traversable and proper ADT
then you will be able to send sources the parser in IDEA will eat up and so will the quote system but at the moment it has to be valid code
I suggest the Quote system evaluation is always wrapped or monitored for these exceptions for the time being and it’s warned in debug or trace log levels
a

amanda.hinchman-dominguez

11/26/2019, 11:19 PM
kastree parsing should not necessarily fail at
id.fix()
since we don't care about evaluation - it looks like the error message is saying that it's considering the right hand side of the binary operation to be
.fix()
when it should be
fix()
. @Joachim Ansorg, are you able to debug and confirm this theory?
j

Joachim Ansorg

11/26/2019, 11:23 PM
It wasn‘t ìd.fix()ˋ, but ˋìd.ˋ, which is incomplete code
r

raulraja

11/27/2019, 10:30 AM
yeah, quotes, can’ currently process incomplete code, this would have failed in the compiler too if it would have gotten as far as analysis
a

amanda.hinchman-dominguez

11/27/2019, 11:15 AM
@Joachim Ansorg very strange - okay, it was the opposite of what I thought, but
.
by itself should be the operator. It should not be included in
rhs
or
lhs
@Joachim Ansorg you might find this funny - I'm attempting to fix this right now but this one is one of the harder ones for binary expression
I hope I can get a fix to you (or you can at least take the files needed to hopefully fix your issue)
I'm getting a similarly weird issue as well: my valueArguments are interpreting the expression for
Copy code
square(3)
as
Copy code
(= 3)
for
value.argumentExpression
because it considers it as
valueName = ValueArgument
2 Views