tavish pegram
10/21/2021, 5:26 PMNathan Bedell
11/13/2021, 2:56 PMShan
11/14/2021, 11:51 PMTeodor Penkov
11/19/2021, 9:27 AM@optics
annotation to the data classes. I started creating custom plugin based on the optics compiler plugin, so I can look for the classes that I want (e.g.is a data class && it's in specific location
) but that doesn’t seem like the right thing to do.
What would you suggest for the 3rd party code?
pp. I’ve managed to generate some code, but then I stumbled upon errors such as unresolved references etc.Nathan Bedell
12/03/2021, 12:21 AMNathan Bedell
12/08/2021, 11:53 PMarrow-meta
repo in order to setup a gradle plugin for loading my arrow-meta plugin, and I can build a jar for the gradle plugin fine -- but I'm not entirely sure how to test the result.
Usually for a library I'd use publishToMavenLocal
, and then use mavenLocal()
as a repository in some other project to make sure the maven config is working properly. Is it possible to do the same for a gradle plugin? How would I set up maven to publish a gradle plugin?
I tried skimming through the gradle files in the arrow-meta
repo to see what would be of help, but no luck so far. Can someone point me in the right direction?Nathan Bedell
12/11/2021, 5:10 PM@Rule {
if (parentOf(X,Y) && parentOf(Y,Z)
grandparentOf(X,Z)
}
As it should be clear from the example here -- the idea for this is for a logic programming compiler plugin, and in particular, supporting anonymous top-level rules, rather than having to annotate e.x a top level function or val, which we would then have to name.bloder
01/04/2022, 6:39 PMval list = listOf(1)
data class FilledList private constructor(val value: List<Int>) {
companion object : Refined<List<Int>, FilledList>(::FilledList, { ensure((it.isNotEmpty()) to "list cannot be empty") })
}
val filledList = FilledList(list)
And is popping:
val list = listOf(1) can't be verified at compile time. Use `Predicate.orNull(val list = listOf(1))` for safe access or `Predicate.require(val list = listOf(1))` for explicit unsafe instantiation
If I remove this list reference from the property and put its instance directly on FilledList invoke call site (FilledList(listOf())
), nothing happens and its refinement occurs in runtime. I'm missing something or is not supported? If is not supported is there a typeclass / applicative or something that I can integrate with collections to make it work?bloder
01/05/2022, 4:55 AMfun average(xs: List<Int>): Int {
pre(xs.isNotEmpty()) { "list not empty" }
TODO()
}
val x = average(listOf(1))
pre-condition `list not empty` is not satisfied in `average(listOf(1))`
-> unsatisfiable constraint: `listOf(1).isNotEmpty`
The curious thing here is, pre / pos conditions with primitive values (like PositiveInt
sample) works but not with collections, I've already tried to create value classes wrappers, Laws, but only works with primitive types, not collections... Am I missing anything? Current using Kotlin 1.6.10 and arrow analysis 2.0-SNAPSHOTserver
01/13/2022, 9:38 PMmcpiroman
01/20/2022, 2:23 PMNathan Bedell
01/31/2022, 11:10 PMJack Darlington
02/02/2022, 11:33 PMCaused by: java.lang.AbstractMethodError: Receiver class package.MyMetaPlugin does not define or inherit an implementation of the resolved method 'abstract void registerProjectComponents(com.intellij.mock.MockProject, org.jetbrains.kotlin.config.CompilerConfiguration)' of interface org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar.
I assume it is something to do with the default implementation not getting picked up from Meta interface?Big Chungus
02/02/2022, 11:49 PMJack Darlington
02/03/2022, 11:09 PMJack
02/04/2022, 2:16 PMval Meta.helloWorld: CliPlugin get() =
"Hello World" {
meta(
namedFunction(this, { true } ) { c ->
println("remove")
Transform.remove(c.element)
}
)
}
@AutoService(ComponentRegistrar::class)
class MetaPlugin: Meta {
override fun intercept(ctx: CompilerContext): List<CliPlugin> =
listOf(helloWorld)
}
Big Chungus
02/07/2022, 9:09 AMMilse113
02/11/2022, 7:38 AMDirk van Wijk
02/21/2022, 1:07 PMKarin-Aleksandra Monoid
02/21/2022, 6:04 PM* What went wrong:
org/gradle/util/internal/VersionNumber
> org.gradle.util.internal.VersionNumber
Changing the Gradle version to 7.0.2/7.2/7.4 didn't solve the problem for me (this was suggested in a thread with the same problem).Tim Abil
03/10/2022, 7:19 PMKtExpression
Babin Ruslan
03/16/2022, 11:26 PMirClass {...}
i'm modifying function body, but i don't know, how to return updated irClass
😞
val Meta.GenerateShallowSize: CliPlugin
get() = "Generate shallowSize method" {
meta(
classDeclaration(this, { element.isData() }) { declaration ->
Transform.replace(
replacing = declaration.element,
newDeclaration =
"""|$`@annotations` $kind $name $`(typeParameters)` $`(params)` : $supertypes {
| $body
| fun shallowSize(): Unit
|}""".`class`
)
},
irClass { clazz ->
{
val function = clazz.functions.find { it.name.asString() == "shallowSize" }!!
with(DeclarationIrBuilder(pluginContext, function.symbol)) {
function.body = irBlockBody {
irInt(clazz.fields.map { it.type.byteSize() }.sum())
}
}
return clazz.
}
}
)
}
dalexander
03/18/2022, 4:39 PMMiłosz Korman
03/23/2022, 3:14 PMkotlin.NotImplementedError: An operation is not implemented: Missing impl for throw RuntimeException(ex) .../DatabaseConfiguration.kt (org.jetbrains.kotlin.psi.KtThrowExpression)
Miłosz Korman
03/23/2022, 10:29 PMv1 > v2 => Positive(v1) > Positive(v2)
and Positive(v1) > Positive(v2) => Positive(v1).value > Positive(v2).value
implications to holdTies
04/04/2022, 2:04 PM@JvmInline
value class String5till10(val value: String) {
init {
require(value.length >= 5) { "String should be minimal 5 characters" }
require(value.length <= 10) { "String should be maximum 10 characters" }
}
}
// This works
val value = getRandomString()
if (value.length > 6) {
if (value.length < 10) {
StringExamples.String5till10(value)
}
}
//This does not
val value = getRandomString()
if (value.length > 6 && value.length < 10) {
StringExamples.String5till10(value)
}
Cornelius Wichering
04/22/2022, 7:59 PM@OneAnnotation(value = "someDetail")
fun methodA() { ... }
I want my plugin to add another annotation like this
@AnotherAnnotation(value = "someDetail") // value taken from "original" annotation
@OneAnnotation(value = "someDetail")
fun methodA() { ... }
Do you think arrow-meta is a good fit for this task? Any hints on how to do it?rkeazor
05/02/2022, 7:55 PMthan_
05/13/2022, 8:41 AMTim Abil
05/24/2022, 7:21 PM@Json
property annotation that overrides serialized property names while visiting class properties with DeclarationDescriptorVisitor
from declarationChecker{..}
. When visitPropertyDescriptor
is invoked descriptor.annotations
is always empty.Tim Abil
05/24/2022, 7:21 PM@Json
property annotation that overrides serialized property names while visiting class properties with DeclarationDescriptorVisitor
from declarationChecker{..}
. When visitPropertyDescriptor
is invoked descriptor.annotations
is always empty.import com.squareup.moshi.Json
data class Sample(
val a: Color,
@Json(name="json_name") <-- not visible from declaration checker
val b: More,
)
ephemient
05/24/2022, 7:32 PM@Json
doesn't declare applicable targets (therefore all are allowed): https://square.github.io/moshi/1.x/moshi/moshi/com.squareup.moshi/-json/index.html
which means it'll be treated as @param:Json
in this usage by default: https://kotlinlang.org/docs/annotations.html#annotation-use-site-targetsTim Abil
05/24/2022, 7:44 PMephemient
05/24/2022, 7:45 PM@property:Json(...) val
Tim Abil
05/24/2022, 7:47 PM