Repository navigation
fix: no compiler crash on local classes / anonymous objects in DSL (#101) - #130
Merged
Merged
Conversation
A DSL definition whose inferred type is a local class or anonymous object has no ClassId, so writing its hint crashed with "No classId for IrClassImpl". Such types can't be named from another module, so the hint is skipped (and bindings without a ClassId are dropped). WIP: RED proof, type-qualifier test, CallSiteValidator audit and native/wasm gates still pending. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A get<T>() on a local class or anonymous object with no definition was deferred as a call-site hint when the module had no entry point, crashing with "No classId for IrClassImpl". No other module can provide such a type, so it now fails here with KOIN-D002 instead of being deferred. Tests: new diagnostics test for the call-site case; box test now also covers a local type qualifier (named<LocalTag>()). All proven RED on the unfixed code. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… 2.4.20 test-apps pinned plugin 1.0.2-Beta1 and had no native target, so it could not serve as the native/wasm gate PR Guard #2 asks for. The plugin version now comes from the repo's pluginVersion (override: -PkoinPluginVersion). Kotlin moves 2.3.20 -> 2.4.20: JS/wasm with @componentscan crash on 2.3.20 (KT-82395) on every plugin version since 1.0.2-Beta1. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #101 (also the follow-up comment on #89).
Problem
A DSL definition whose type is a local class or an anonymous object (
single { FakeRepo() },factory { object : Clock {} }, typical in test fixtures) crashed the compiler:IrGenerationExtensionException: No classId for IrClassImpl. Such types have no ClassId, so they can't be written into a cross-module hint. Same crash for aget<T>()on an undefined local class in a module with no Koin entry point.Fix
get<T>()on a local class is never deferred to a downstream module (none can provide it). It now reports KOIN-D002 in place instead of crashing.pluginVersion(was pinned to1.0.2-Beta1),iosArm64added, Kotlin 2.3.20 → 2.4.20 (JS/wasm with@ComponentScancrashed on 2.3.20, KT-82395, on every plugin version). PR Guard New koin compiler plugin Unrecognized @ScopeId #2 command added to CLAUDE.md.Behavior change
Only where the compiler used to crash: an unresolved local-class call site now fails with KOIN-D002. No change for code that compiled before.
Proof
safety/local_class_dsl_no_crash(local class, anonymous object, localbind, localnamed<T>()qualifier)No classIdcall_site_local_class_no_entry_point_d002No classIdNo classIdtest-appsjvm + js + wasmJs + iosArm64 + jvmTest