martmists
05/19/2022, 1:07 PMorg.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during psi2ir
File being compiled: (26,9) in /home/mart/git/sites/martmists/src/backendMain/kotlin/com/martmists/backend/data/GithubProject.kt
The root cause java.util.NoSuchElementException was thrown at: org.jetbrains.kotlin.psi2ir.generators.ArgumentsGenerationUtilsKt$generateReceiver$1.load(ArgumentsGenerationUtils.kt:873)
Collection contains no element matching the predicate.: KtCallExpression:
div("project project-github") {
...
martmists
05/19/2022, 1:07 PMpackage com.martmists.backend.data
import com.martmists.backend.ext.icon
import com.martmists.backend.http.client
import io.ktor.client.call.*
import io.ktor.client.request.*
import kotlinx.html.*
import kotlinx.serialization.json.JsonObject
import <http://kotlinx.serialization.json.int|kotlinx.serialization.json.int>
import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.jsonPrimitive
data class GithubProject(
val owner: String,
val name: String,
val icon: String,
val description: String,
val stars: Int,
val tools: Set<String>,
) : Project {
context(TagConsumer<*>)
override fun build() {
val stargazersIcon = Icon("<https://github.com/$owner/$name/stargazers>", "project-footer-stars fa-regular fa-star")
val tools = tools.asIcons()
div("project project-github") {
span("project-header") {
h5("project-header-title") {
a("<https://github.com/$owner>", "_blank", "project-header-title-owner") {
+owner
}
+"/"
a("<https://github.com/$owner/$name>", "_blank", "project-header-title-name") {
+name
}
}
i("project-header-icon $icon")
}
p("project-description") {
+description
}
span("project-footer") {
icon(stargazersIcon)
+stars.toString()
}
span("project-footer-tool-icons") {
for (icon in tools) {
icon(icon)
}
}
}
}
data class Holder(val owner: String, val name: String) {
suspend fun fetch() : Project {
return client.get("<https://api.github.com/repos/$owner/$name>").body<JsonObject>().let {
GithubProject(
owner,
name,
"fa-brands fa-github",
it["description"]!!.jsonPrimitive.content,
it["stargazers_count"]!!.<http://jsonPrimitive.int|jsonPrimitive.int>,
setOf(
it["language"]!!.jsonPrimitive.content,
*it["topics"]!!.jsonArray.map { it.jsonPrimitive.content }.toTypedArray()
)
)
}
}
}
}
Sam
05/19/2022, 1:09 PMSam
05/19/2022, 1:16 PMSam
05/19/2022, 1:19 PM