evant
11/14/2019, 5:32 PMJoachim Ansorg
11/14/2019, 5:49 PMMetaPlugin
, and a KtFile
in contextraulraja
11/15/2019, 9:19 AMraulraja
11/16/2019, 9:55 PMraulraja
11/18/2019, 8:58 AMTuple
runtime with type proofs and automatic conversions coming up in Arrow Metaraulraja
11/18/2019, 8:59 AMamanda.hinchman-dominguez
11/25/2019, 12:38 PMspierce7
11/25/2019, 4:26 PMsuspend
, and also manually must ensure transfer to that thread - via a withContext
method.
I’d like to create a compiler plugin to do this for us by doing one of the following:
1. Change the visibility of the class, and create a wrapping class that ensure the transfer to the thread, and then defers to the delegated object / class
2. Alter the public function signature to something asynchronous, and wrap the body of the method to transfer to the proper thread.
I’m new to compiler plugins. Can anyone point me in the right direction, or point me at any bumps in the road to accomplish this? Will I have to create a separate ide plugin to get syntax completion to work?Joachim Ansorg
11/26/2019, 6:41 PMpackage 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:
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?Imran/Malic
11/27/2019, 10:33 AMEnd
of the Graph and there is no valid path from A
to B
. If we think about it as an commutative graph, how can we proof that all of path’s commute ?amanda.hinchman-dominguez
11/27/2019, 11:54 AMDestructuringDeclaration
is attempting to capture a list of entries!amanda.hinchman-dominguez
11/27/2019, 3:18 PMQuy D X Nguyen
11/29/2019, 5:18 AMJoachim Ansorg
12/04/2019, 10:01 AMgit clone <https://github.com/jansorg/arrow-meta-test.git>
cd arrow-meta-test
gradle clean build
> Task :clean
> Task :kaptGenerateStubsKotlin
> Task :kaptKotlin
> Task :compileKotlin FAILED
e: java.util.NoSuchElementException: Collection contains no element matching the predicate.
at arrow.meta.quotes.MetaExtensionsKt$classDeclaration$$inlined$quote$1$1.invoke(Quote.kt:507)
at arrow.meta.quotes.MetaExtensionsKt$classDeclaration$$inlined$quote$1$1.invoke(Quote.kt)
at arrow.meta.dsl.analysis.AnalysisSyntax$analysis$1.doAnalysis(AnalysisSyntax.kt:69)
at arrow.meta.internal.registry.InternalRegistry$registerAnalysisHandler$1$1.doAnalysis(InternalRegistry.kt:537)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:105)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:82)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:557)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:82)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:107)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:548)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:177)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:165)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:55)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:84)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:42)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:104)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:349)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:105)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:237)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.access$compileIncrementally(IncrementalCompilerRunner.kt:37)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner$compile$2.invoke(IncrementalCompilerRunner.kt:79)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:91)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:606)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:99)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1645)
at sun.reflect.GeneratedMethodAccessor95.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Joachim Ansorg
12/06/2019, 12:49 PMBen Woodworth
12/06/2019, 11:42 PM// Defined in a "common" sourceSet
interface Dependency {
// member definitions
}
// Defined in other platform-specific sourceSets, with varying class/package names
@PlatformType
interface PlatformDependency : Dependency {
// more platform-specific member definitions
}
In each platform-specific sourceSet of my codebase, anytime there's a Dependency
instance, it's guaranteed to be a PlatformInstance
. That can be denoted with @PlatformType
, and I want to write a plugin and treats Dependency
types (in this case) as `PlatformDependency`s everywhere within that sourceset. Right now I'm manually upcasting, but that's verbose/tedious. Is this possible/easy-ish to do? And where's a good place for me to start?dnowak
12/07/2019, 11:03 AMInterruptedException
is considered as fatal? Found this in arrow.core.NonFatal
fun NonFatal(t: Throwable): Boolean =
when (t) {
is VirtualMachineError, is ThreadDeath, is InterruptedException, is LinkageError -> false
else -> true
}
amanda.hinchman-dominguez
12/10/2019, 8:27 AMamanda.hinchman-dominguez
12/10/2019, 8:29 AMBob Glamm
12/11/2019, 5:31 PMfun userAcceptanceTest() {
given:
setup()
and:
otherSetup()
when:
someAction()
then:
someAssertion()
1 * someService.gotCalled()
where:
my | data | fields
1 | "foo" | false
2 | "bar" | true
}
? Or is that too far away from mainline Kotlin syntax for that to happenSlackbot
12/12/2019, 12:21 PMraulraja
12/13/2019, 4:17 PMamanda.hinchman-dominguez
12/13/2019, 5:11 PMmatiaslev
12/13/2019, 8:29 PMthanerian
12/15/2019, 5:40 PMisMutable
thanerian
12/15/2019, 10:24 PMisNullable
is not available at least at TypeReference
level. Prior to that i was using text.contains("?")
that make me feels dirtybloder
12/16/2019, 1:32 AMprivate val Meta.transformTest: Plugin
get() = "Transform Test" {
meta(
classDeclaration({ name == "ManyCustomCase" }) { c ->
(Transform.replace(...)
+ Transform.remove(...)
+ Transform.newSources(...)
+ Transform.enableTest())
}
)
}
With that we don't need to write a comment in our transformed code to generate .meta
files. (and of course this idea wasn't created because I always forget to put the test comment 😅)Shady Selim
12/16/2019, 6:38 AMshikasd
12/17/2019, 10:38 PMraulraja
12/19/2019, 4:51 PMraulraja
12/19/2019, 4:51 PMBob Glamm
12/19/2019, 5:04 PM