Skip to content

Fix issue#248 - #249

Merged
Ayfri merged 1 commit into
Ayfri:masterfrom
Alumopper:master
Aug 4, 2026
Merged

Fix issue#248#249
Ayfri merged 1 commit into
Ayfri:masterfrom
Alumopper:master

Conversation

@Alumopper

Copy link
Copy Markdown
Contributor

Fixed issue #248

Copilot AI review requested due to automatic review settings August 3, 2026 09:16
@github-project-automation github-project-automation Bot moved this to 📋 To do in Kore Aug 3, 2026
@safedep

safedep Bot commented Aug 3, 2026

Copy link
Copy Markdown

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

View complete scan results →

This report is generated by SafeDep Github App

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses Issue #248 by fixing Kotlin bindings code generation for function paths that are nested, numeric-prefixed, or otherwise not directly valid Kotlin identifiers, ensuring the generated sources compile and preserve original Minecraft IDs.

Changes:

  • Updated function binding generation to emit valid Kotlin identifiers, avoid naming collisions, and preserve original function IDs in asId() mappings.
  • Extended the codegen model (KtPropertySpec + renderer) to support var properties and accessor-based properties (getter/setter) needed for interface implementations.
  • Added/updated tests to cover edge cases (nested directories, numeric names, punctuation, collisions) and contract conformance (FunctionArgument).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
bindings/src/jvmTest/kotlin/io/github/ayfri/kore/bindings/ImportingTests.kt Updates JVM import/codegen assertions to validate accessor-based namespace and presence of directory.
bindings/src/commonTest/kotlin/io/github/ayfri/kore/bindings/CommonExploreAndRenderTests.kt Adds comprehensive edge-case tests ensuring generated function bindings compile and preserve IDs.
bindings/src/commonMain/kotlin/io/github/ayfri/kore/bindings/generation/identifiers.kt Introduces Kotlin-safe identifier conversion + per-scope unique name allocation.
bindings/src/commonMain/kotlin/io/github/ayfri/kore/bindings/generation/enumGenerators.kt Reworks function bindings generation to use safe names, avoid collisions, and map asId() to original paths.
bindings/src/commonMain/kotlin/io/github/ayfri/kore/bindings/generation/codegen/KtType.kt Extends KtPropertySpec to support mutability and accessors (getter/setter) with nullable initializers.
bindings/src/commonMain/kotlin/io/github/ayfri/kore/bindings/generation/codegen/KtRenderer.kt Updates property rendering to support var and render accessors beneath property declarations.
Suppressed comments (1)

bindings/src/commonMain/kotlin/io/github/ayfri/kore/bindings/generation/enumGenerators.kt:207

  • generateFunctionsEnumTree iterates functions in its original order when emitting rootFunctions and enum entries. Since functions originates from filesystem/zip ordering, this can make the generated source order non-deterministic. Iterating in a stable order (e.g. sortedBy(Function::id)) here would make output consistent across runs.
	val rootFunctions = mutableListOf<KtTypeSpec>()
	val functionGroups = mutableMapOf<String, FunctionEnumGroup>()
	functions.forEach { function ->
		val path = function.id.substringAfter(":")
		val parent = parentPath(path)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +114 to +116
val entries = functions.map { function ->
entriesById.getValue(function.id) to function.id.substringAfter(":")
}
Comment on lines 90 to +94
if (mods.isNotEmpty()) sb.append(mods.joinToString(" ")).append(" ")
sb.append("val ").append(prop.name)
sb.append(if (prop.mutable) "var " else "val ").append(prop.name)
prop.type?.let { sb.append(": ").append(it.simpleName) }
sb.append(" = ").append(prop.initializer).append("\n")
prop.initializer?.let { sb.append(" = ").append(it) }
sb.append("\n")
@Ayfri
Ayfri merged commit 3e91202 into Ayfri:master Aug 4, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from 📋 To do to ✅ Done in Kore Aug 4, 2026
Ayfri added a commit that referenced this pull request Aug 4, 2026
… identifiers left in Resources/Tags generators after #249.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants