Skip to content
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

error: did not generate token "context" #471

Closed
laurentthiebaudezm opened this issue May 27, 2024 · 3 comments
Closed

error: did not generate token "context" #471

laurentthiebaudezm opened this issue May 27, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@laurentthiebaudezm
Copy link

Hi,

I have the following test method, that verifies if a given method - which required a context MyContext - has been called.

fun <T, R> verifyInAnyTransactionContext(
    mock: T,
    nTime: Int = 1,
    f: suspend context(MyContext) T.() -> R
): R = verify(mock, times(nTime)) {
    with(any<TransactionContext>()) { f(mock)}
}

Since I upgraded to kotlin 2.0, ktfmt fails on this method:

error: did not generate token "context"

[2024-05-27T10:04:19.415Z] com.google.googlejavaformat.FormattingError: 59:44: error: did not generate token "context"

[2024-05-27T10:04:19.415Z] 

[2024-05-27T10:04:19.415Z] 	at com.google.googlejavaformat.OpsBuilder.sync(OpsBuilder.java:233)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.sync(KotlinInputAstVisitor.kt:2573)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitTypeReference(KotlinInputAstVisitor.kt:186)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitTypeReference(KtVisitorVoid.java:649)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitTypeReference(KtVisitorVoid.java:21)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtTypeReference.accept(KtTypeReference.kt:38)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.com.intellij.psi.impl.PsiElementBase.acceptChildren(PsiElementBase.java:69)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtTreeVisitorVoid.visitElement(KtTreeVisitorVoid.java:25)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitElement(KotlinInputAstVisitor.kt:2460)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtVisitor.visitKtElement(KtVisitor.java:24)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtElement(KtVisitorVoid.java:25)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtElement(KtVisitorVoid.java:455)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtElement(KtVisitorVoid.java:21)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:94)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visit(KotlinInputAstVisitor.kt:2593)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitFunctionType(KotlinInputAstVisitor.kt:2295)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitFunctionType(KtVisitorVoid.java:949)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitFunctionType(KtVisitorVoid.java:21)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtFunctionType.accept(KtFunctionType.java:68)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visit(KotlinInputAstVisitor.kt:2593)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitTypeReference(KotlinInputAstVisitor.kt:198)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitTypeReference(KtVisitorVoid.java:649)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitTypeReference(KtVisitorVoid.java:21)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtTypeReference.accept(KtTypeReference.kt:38)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visit(KotlinInputAstVisitor.kt:2593)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.access$visit(KotlinInputAstVisitor.kt:133)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$declareOne$1$2.invoke(KotlinInputAstVisitor.kt:1346)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$declareOne$1$2.invoke(KotlinInputAstVisitor.kt:1339)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block(KotlinInputAstVisitor.kt:2565)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.access$block(KotlinInputAstVisitor.kt:133)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$declareOne$1.invoke(KotlinInputAstVisitor.kt:1339)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$declareOne$1.invoke(KotlinInputAstVisitor.kt:1316)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block(KotlinInputAstVisitor.kt:2565)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block$default(KotlinInputAstVisitor.kt:2561)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.declareOne(KotlinInputAstVisitor.kt:1316)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.declareOne$default(KotlinInputAstVisitor.kt:1294)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitParameter$1.invoke(KotlinInputAstVisitor.kt:2244)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitParameter$1.invoke(KotlinInputAstVisitor.kt:2231)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block(KotlinInputAstVisitor.kt:2565)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block$default(KotlinInputAstVisitor.kt:2561)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitParameter(KotlinInputAstVisitor.kt:2231)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitParameter(KtVisitorVoid.java:599)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitParameter(KtVisitorVoid.java:21)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtParameter.accept(KtParameter.java:51)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visit(KotlinInputAstVisitor.kt:2593)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.access$visit(KotlinInputAstVisitor.kt:133)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitEachCommaSeparated$1.invoke(KotlinInputAstVisitor.kt:1084)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitEachCommaSeparated$1.invoke(KotlinInputAstVisitor.kt:1075)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block(KotlinInputAstVisitor.kt:2565)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitEachCommaSeparated(KotlinInputAstVisitor.kt:1075)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitEachCommaSeparated$default(KotlinInputAstVisitor.kt:1048)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitFunctionLikeExpression$1$4.invoke(KotlinInputAstVisitor.kt:356)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitFunctionLikeExpression$1$4.invoke(KotlinInputAstVisitor.kt:354)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block(KotlinInputAstVisitor.kt:2565)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block$default(KotlinInputAstVisitor.kt:2561)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitFunctionLikeExpression$1.invoke(KotlinInputAstVisitor.kt:354)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitFunctionLikeExpression$1.invoke(KotlinInputAstVisitor.kt:315)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block(KotlinInputAstVisitor.kt:2565)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitFunctionLikeExpression(KotlinInputAstVisitor.kt:315)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.access$visitFunctionLikeExpression(KotlinInputAstVisitor.kt:133)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitNamedFunction$1.invoke(KotlinInputAstVisitor.kt:168)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitNamedFunction$1.invoke(KotlinInputAstVisitor.kt:167)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block(KotlinInputAstVisitor.kt:2565)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block$default(KotlinInputAstVisitor.kt:2561)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitNamedFunction(KotlinInputAstVisitor.kt:167)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitNamedFunction(KtVisitorVoid.java:491)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitNamedFunction(KtVisitorVoid.java:21)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtNamedFunction.accept(KtNamedFunction.java:51)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visit(KotlinInputAstVisitor.kt:2593)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitScript(KotlinInputAstVisitor.kt:2514)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitScript(KtVisitorVoid.java:527)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitScript(KtVisitorVoid.java:21)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtScript.accept(KtScript.java:69)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visit(KotlinInputAstVisitor.kt:2593)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitKtFile(KotlinInputAstVisitor.kt:2489)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtFile(KtVisitorVoid.java:521)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtFile(KtVisitorVoid.java:21)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtFile.accept(KtFile.kt:250)

[2024-05-27T10:04:19.415Z] 	at org.jetbrains.kotlin.psi.KtFile.accept(KtFile.kt:237)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.Formatter.prettyPrint(Formatter.kt:109)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.format.Formatter.format(Formatter.kt:96)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.cli.Main.format(Main.kt:134)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.cli.Main.access$format(Main.kt:35)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.cli.Main$run$1.invoke(Main.kt:110)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.cli.Main$run$1.invoke(Main.kt:108)

[2024-05-27T10:04:19.415Z] 	at com.facebook.ktfmt.cli.Main.run$lambda$0(Main.kt:108)

[2024-05-27T10:04:19.415Z] 	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)

[2024-05-27T10:04:19.415Z] 	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)

[2024-05-27T10:04:19.415Z] 	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)

[2024-05-27T10:04:19.415Z] 	at java.base/java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:291)

[2024-05-27T10:04:19.415Z] 	at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:754)

[2024-05-27T10:04:19.415Z] 	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)

[2024-05-27T10:04:19.415Z] 	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)

[2024-05-27T10:04:19.415Z] 	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)

[2024-05-27T10:04:19.415Z] 	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)

[2024-05-27T10:04:19.416Z] 	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

[2024-05-27T10:04:20.164Z] Exception in thread "main" com.google.googlejavaformat.FormattingError: 59:44: error: did not generate token "context"

[2024-05-27T10:04:20.164Z] 

[2024-05-27T10:04:20.164Z] 	at com.google.googlejavaformat.OpsBuilder.sync(OpsBuilder.java:233)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.sync(KotlinInputAstVisitor.kt:2573)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitTypeReference(KotlinInputAstVisitor.kt:186)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitTypeReference(KtVisitorVoid.java:649)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitTypeReference(KtVisitorVoid.java:21)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtTypeReference.accept(KtTypeReference.kt:38)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.com.intellij.psi.impl.PsiElementBase.acceptChildren(PsiElementBase.java:69)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtTreeVisitorVoid.visitElement(KtTreeVisitorVoid.java:25)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitElement(KotlinInputAstVisitor.kt:2460)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtVisitor.visitKtElement(KtVisitor.java:24)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtElement(KtVisitorVoid.java:25)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtElement(KtVisitorVoid.java:455)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtElement(KtVisitorVoid.java:21)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:94)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visit(KotlinInputAstVisitor.kt:2593)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitFunctionType(KotlinInputAstVisitor.kt:2295)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitFunctionType(KtVisitorVoid.java:949)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitFunctionType(KtVisitorVoid.java:21)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtFunctionType.accept(KtFunctionType.java:68)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visit(KotlinInputAstVisitor.kt:2593)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitTypeReference(KotlinInputAstVisitor.kt:198)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitTypeReference(KtVisitorVoid.java:649)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitTypeReference(KtVisitorVoid.java:21)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtTypeReference.accept(KtTypeReference.kt:38)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visit(KotlinInputAstVisitor.kt:2593)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.access$visit(KotlinInputAstVisitor.kt:133)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$declareOne$1$2.invoke(KotlinInputAstVisitor.kt:1346)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$declareOne$1$2.invoke(KotlinInputAstVisitor.kt:1339)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block(KotlinInputAstVisitor.kt:2565)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.access$block(KotlinInputAstVisitor.kt:133)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$declareOne$1.invoke(KotlinInputAstVisitor.kt:1339)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$declareOne$1.invoke(KotlinInputAstVisitor.kt:1316)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block(KotlinInputAstVisitor.kt:2565)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block$default(KotlinInputAstVisitor.kt:2561)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.declareOne(KotlinInputAstVisitor.kt:1316)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.declareOne$default(KotlinInputAstVisitor.kt:1294)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitParameter$1.invoke(KotlinInputAstVisitor.kt:2244)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitParameter$1.invoke(KotlinInputAstVisitor.kt:2231)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block(KotlinInputAstVisitor.kt:2565)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block$default(KotlinInputAstVisitor.kt:2561)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitParameter(KotlinInputAstVisitor.kt:2231)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitParameter(KtVisitorVoid.java:599)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitParameter(KtVisitorVoid.java:21)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtParameter.accept(KtParameter.java:51)

[2024-05-27T10:04:20.164Z] 	at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visit(KotlinInputAstVisitor.kt:2593)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.access$visit(KotlinInputAstVisitor.kt:133)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitEachCommaSeparated$1.invoke(KotlinInputAstVisitor.kt:1084)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitEachCommaSeparated$1.invoke(KotlinInputAstVisitor.kt:1075)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block(KotlinInputAstVisitor.kt:2565)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitEachCommaSeparated(KotlinInputAstVisitor.kt:1075)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitEachCommaSeparated$default(KotlinInputAstVisitor.kt:1048)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitFunctionLikeExpression$1$4.invoke(KotlinInputAstVisitor.kt:356)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitFunctionLikeExpression$1$4.invoke(KotlinInputAstVisitor.kt:354)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block(KotlinInputAstVisitor.kt:2565)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block$default(KotlinInputAstVisitor.kt:2561)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitFunctionLikeExpression$1.invoke(KotlinInputAstVisitor.kt:354)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitFunctionLikeExpression$1.invoke(KotlinInputAstVisitor.kt:315)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block(KotlinInputAstVisitor.kt:2565)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitFunctionLikeExpression(KotlinInputAstVisitor.kt:315)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.access$visitFunctionLikeExpression(KotlinInputAstVisitor.kt:133)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitNamedFunction$1.invoke(KotlinInputAstVisitor.kt:168)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor$visitNamedFunction$1.invoke(KotlinInputAstVisitor.kt:167)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block(KotlinInputAstVisitor.kt:2565)

[2024-05-27T10:04:20.164Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.block$default(KotlinInputAstVisitor.kt:2561)

[2024-05-27T10:04:20.165Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitNamedFunction(KotlinInputAstVisitor.kt:167)

[2024-05-27T10:04:20.165Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitNamedFunction(KtVisitorVoid.java:491)

[2024-05-27T10:04:20.165Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitNamedFunction(KtVisitorVoid.java:21)

[2024-05-27T10:04:20.165Z] 	at org.jetbrains.kotlin.psi.KtNamedFunction.accept(KtNamedFunction.java:51)

[2024-05-27T10:04:20.165Z] 	at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49)

[2024-05-27T10:04:20.165Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visit(KotlinInputAstVisitor.kt:2593)

[2024-05-27T10:04:20.165Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitScript(KotlinInputAstVisitor.kt:2514)

[2024-05-27T10:04:20.165Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitScript(KtVisitorVoid.java:527)

[2024-05-27T10:04:20.165Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitScript(KtVisitorVoid.java:21)

[2024-05-27T10:04:20.165Z] 	at org.jetbrains.kotlin.psi.KtScript.accept(KtScript.java:69)

[2024-05-27T10:04:20.165Z] 	at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49)

[2024-05-27T10:04:20.165Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visit(KotlinInputAstVisitor.kt:2593)

[2024-05-27T10:04:20.165Z] 	at com.facebook.ktfmt.format.KotlinInputAstVisitor.visitKtFile(KotlinInputAstVisitor.kt:2489)

[2024-05-27T10:04:20.165Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtFile(KtVisitorVoid.java:521)

[2024-05-27T10:04:20.165Z] 	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtFile(KtVisitorVoid.java:21)

[2024-05-27T10:04:20.165Z] 	at org.jetbrains.kotlin.psi.KtFile.accept(KtFile.kt:250)

[2024-05-27T10:04:20.165Z] 	at org.jetbrains.kotlin.psi.KtFile.accept(KtFile.kt:237)

[2024-05-27T10:04:20.165Z] 	at com.facebook.ktfmt.format.Formatter.prettyPrint(Formatter.kt:109)

[2024-05-27T10:04:20.165Z] 	at com.facebook.ktfmt.format.Formatter.format(Formatter.kt:96)

[2024-05-27T10:04:20.165Z] 	at com.facebook.ktfmt.cli.Main.format(Main.kt:134)

[2024-05-27T10:04:20.165Z] 	at com.facebook.ktfmt.cli.Main.access$format(Main.kt:35)

[2024-05-27T10:04:20.165Z] 	at com.facebook.ktfmt.cli.Main$run$1.invoke(Main.kt:110)

[2024-05-27T10:04:20.165Z] 	at com.facebook.ktfmt.cli.Main$run$1.invoke(Main.kt:108)

[2024-05-27T10:04:20.165Z] 	at com.facebook.ktfmt.cli.Main.run$lambda$0(Main.kt:108)

[2024-05-27T10:04:20.165Z] 	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)

[2024-05-27T10:04:20.165Z] 	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)

[2024-05-27T10:04:20.165Z] 	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)

[2024-05-27T10:04:20.165Z] 	at java.base/java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:291)

[2024-05-27T10:04:20.165Z] 	at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:754)

[2024-05-27T10:04:20.165Z] 	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)

[2024-05-27T10:04:20.165Z] 	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)

[2024-05-27T10:04:20.165Z] 	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)

[2024-05-27T10:04:20.165Z] 	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)

[2024-05-27T10:04:20.165Z] 	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

script returned exit code 1

This is because in my lambda definition I have a context:

f: suspend context(MyContext) T.() -> R

if I remove the context in there, there is no more issue.

f: suspend T.() -> R

(but this is not what I want, I need a context in my lambda).

Is there a bug? Any workaround? Thx.

@hick209 hick209 added the bug Something isn't working label May 28, 2024
@hick209
Copy link
Contributor

hick209 commented May 28, 2024

This is indeed a bug. Thanks for reporting it

No workarounds available AFAIK.

@hick209
Copy link
Contributor

hick209 commented Jun 5, 2024

@laurentthiebaudezm we'd certainly welcome a PR as we might not get to this issue in a while

facebook-github-bot pushed a commit that referenced this issue Jun 5, 2024
Summary:
Fixes issue reported by at #471

Formatting might be a bit odd, but the goal of this diff is solely to stop of the issue with running ktfmt.

Reviewed By: strulovich

Differential Revision: D58194198

fbshipit-source-id: 51123c1b3fef65c2c0803689c9173cb7c50cb41f
@hick209
Copy link
Contributor

hick209 commented Jun 5, 2024

This was actually simple and I fixed it with this here
dafd1cb

@hick209 hick209 closed this as completed Jun 5, 2024
github-merge-queue bot referenced this issue in slackhq/circuit Jun 7, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [com.facebook:ktfmt](https://togithub.com/facebook/ktfmt) |
dependencies | minor | `0.49` -> `0.50` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>facebook/ktfmt (com.facebook:ktfmt)</summary>

### [`v0.50`](https://togithub.com/facebook/ktfmt/releases/tag/v0.50):
0.50

#### Changelog

- Add pre commit hooks to readme
([https://github.com/facebook/ktfmt/pull/462](https://togithub.com/facebook/ktfmt/pull/462))
– [@&#8203;0x26res](https://togithub.com/0x26res)
- Add homebrew installation note to readme
([https://github.com/facebook/ktfmt/pull/468](https://togithub.com/facebook/ktfmt/pull/468))
– [@&#8203;chenrui333](https://togithub.com/chenrui333)
- Refactor CLI argument parsing
([https://github.com/facebook/ktfmt/pull/467](https://togithub.com/facebook/ktfmt/pull/467))
– [@&#8203;grodin](https://togithub.com/grodin)
- Fix issue with context receive in lambdas
([https://github.com/facebook/ktfmt/issues/471](https://togithub.com/facebook/ktfmt/issues/471))
– [@&#8203;hick209](https://togithub.com/hick209)
- Don't reorder [@&#8203;sample](https://togithub.com/sample) tag
([https://github.com/facebook/ktfmt/issues/406](https://togithub.com/facebook/ktfmt/issues/406))
– [@&#8203;davidtorosyan](https://togithub.com/davidtorosyan)

**Full Changelog**:
facebook/ktfmt@v0.49...v0.50

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTYuMSIsInVwZGF0ZWRJblZlciI6IjM3LjM5Ni4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
slack-oss-bot referenced this issue in slackhq/foundry Jun 10, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [com.facebook:ktfmt](https://togithub.com/facebookincubator/ktfmt) |
dependencies | minor | `0.49` -> `0.50` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>facebookincubator/ktfmt (com.facebook:ktfmt)</summary>

### [`v0.50`](https://togithub.com/facebook/ktfmt/releases/tag/v0.50):
0.50

#### Changelog

- Add pre commit hooks to readme
([https://github.com/facebook/ktfmt/pull/462](https://togithub.com/facebook/ktfmt/pull/462))
– [@&#8203;0x26res](https://togithub.com/0x26res)
- Add homebrew installation note to readme
([https://github.com/facebook/ktfmt/pull/468](https://togithub.com/facebook/ktfmt/pull/468))
– [@&#8203;chenrui333](https://togithub.com/chenrui333)
- Refactor CLI argument parsing
([https://github.com/facebook/ktfmt/pull/467](https://togithub.com/facebook/ktfmt/pull/467))
– [@&#8203;grodin](https://togithub.com/grodin)
- Fix issue with context receive in lambdas
([https://github.com/facebook/ktfmt/issues/471](https://togithub.com/facebook/ktfmt/issues/471))
– [@&#8203;hick209](https://togithub.com/hick209)
- Don't reorder [@&#8203;sample](https://togithub.com/sample) tag
([https://github.com/facebook/ktfmt/issues/406](https://togithub.com/facebook/ktfmt/issues/406))
– [@&#8203;davidtorosyan](https://togithub.com/davidtorosyan)

**Full Changelog**:
facebook/ktfmt@v0.49...v0.50

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTYuMSIsInVwZGF0ZWRJblZlciI6IjM3LjM5Ni4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
ZacSweers referenced this issue in ZacSweers/CatchUp Jun 14, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.facebook:ktfmt](https://togithub.com/facebook/ktfmt) | `0.49` ->
`0.51` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.facebook:ktfmt/0.51?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.facebook:ktfmt/0.51?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.facebook:ktfmt/0.49/0.51?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.facebook:ktfmt/0.49/0.51?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>facebook/ktfmt (com.facebook:ktfmt)</summary>

###
[`v0.51`](https://togithub.com/facebook/ktfmt/blob/HEAD/CHANGELOG.md#051)

##### Added

-   Created CHANGELOG.md
- Added --help option to CLI
([https://github.com/facebook/ktfmt/pull/477](https://togithub.com/facebook/ktfmt/pull/477))

##### Changed

- Preserves blank spaces between when clauses
([https://github.com/facebook/ktfmt/issues/342](https://togithub.com/facebook/ktfmt/issues/342))
-   Named the default style as `Formatter.META_FORMAT` / `--meta-style`
-   `FormattingOptions` constructor parameters order was changed

##### Fixed

- Compilation issues with online formatter
(facebook/ktfmt@8605080)
- Removing valid semicolons
([https://github.com/facebook/ktfmt/issues/459](https://togithub.com/facebook/ktfmt/issues/459))
- Incorrect detection of unused `assign` import
([https://github.com/facebook/ktfmt/issues/411](https://togithub.com/facebook/ktfmt/issues/411))

##### Removed

- **Deleted `Formatter.DROPBOX_FORMAT` / `--dropbox-style` (BREAKING
CHANGE)**
-   Deleted `FormattingOptions.Style` enum

### [`v0.50`](https://togithub.com/facebook/ktfmt/releases/tag/v0.50):
0.50

#### Changelog

- Add pre commit hooks to readme
([https://github.com/facebook/ktfmt/pull/462](https://togithub.com/facebook/ktfmt/pull/462))
– [@&#8203;0x26res](https://togithub.com/0x26res)
- Add homebrew installation note to readme
([https://github.com/facebook/ktfmt/pull/468](https://togithub.com/facebook/ktfmt/pull/468))
– [@&#8203;chenrui333](https://togithub.com/chenrui333)
- Refactor CLI argument parsing
([https://github.com/facebook/ktfmt/pull/467](https://togithub.com/facebook/ktfmt/pull/467))
– [@&#8203;grodin](https://togithub.com/grodin)
- Fix issue with context receive in lambdas
([https://github.com/facebook/ktfmt/issues/471](https://togithub.com/facebook/ktfmt/issues/471))
– [@&#8203;hick209](https://togithub.com/hick209)
- Don't reorder [@&#8203;sample](https://togithub.com/sample) tag
([https://github.com/facebook/ktfmt/issues/406](https://togithub.com/facebook/ktfmt/issues/406))
– [@&#8203;davidtorosyan](https://togithub.com/davidtorosyan)

**Full Changelog**:
facebook/ktfmt@v0.49...v0.50

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/ZacSweers/CatchUp).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM5My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants