Why this is needed:
- Under K2, binary Java symbols are represented differently from K1:
JavaSourceElement metadata is often absent and sources are exposed through
VirtualFileBasedSourceElement.
- Without recovery logic, callable matching can miss declared Java methods,
callable labels can drift (primitive vs boxed reference types), and external
Java declaration stubs can gain wildcard noise when Java signatures are not
available.
- These differences produced Kotlin 2.0 parity drift in tests that rely on
stable Java/Kotlin cross-extractor callable identity.
What this changes:
- Add K2-aware Java binary inspection helpers (ASM-based fallback) to detect
declared methods and parameter/return reference-vs-primitive shape when
JavaSourceElement metadata is unavailable.
- Recover Java callables more reliably in KotlinUsesExtractor, including a
binary-class fallback path.
- Normalise callable labels and call result typing to boxed Java classes when
K2 enhanced reference types appear as Kotlin primitives.
- Accept K2's `Any` form for Object.equals(Object) and keep binary declaration
checks stable.
- Suppress default wildcard insertion for external Java declaration stubs when
no Java callable metadata is available, preventing synthetic wildcard drift.
This commit restores Java interop parity for Kotlin 2.0 extraction paths.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Why this is needed:
- With Kotlin 2.0 analysis, some local-variable locations resolve to a wider
declaration span than before.
- The previous extractor logic used provider-based ranges that can cover type,
annotations, and modifiers, which shifts expected variable location facts.
- This caused parity drift in tests that expect the location to point at the
variable name token itself.
What this changes:
- Cache current source text per file during extraction.
- Derive variable-name offsets by scanning the declaration slice and locating
the declared identifier token.
- Emit local-variable declaration/expr locations from that identifier span,
with fallback to the previous provider when source offsets are unavailable.
This restores stable name-anchored variable locations under Kotlin 2.0.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Why this is needed:
- Under K2, top-level declarations from external binaries are attached directly
to IrExternalPackageFragment rather than to an IrClass file-class parent.
- That bypassed the normal class-source location path, so some external file-class
entities ended up without stable binary file locations.
- Missing/unstable locations caused drift in tests that depend on external file
class member resolution and location facts.
What this changes:
- Resolve binary paths from IrMemberWithContainerSource (JvmPackagePartSource)
via a dedicated getContainerSourceBinaryPath helper.
- In KotlinUsesExtractor, when extracting top-level external declarations,
attach file-class location from container-source binary path when available.
- Track external file classes whose locations were emitted to avoid duplicate
hasLocation facts.
This targets the K2 external file-class location gap (for example file_classes and
external-property-overloads parity).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Update documentation to only claim support for 2.4.0x
* Python test code; remove newlines between imports.
* Sync comments between kotlin 1.8 and 1.9
* Update code comments to attach where actually relevant,
and improve comments on IrMemberAccessExpression<*>.extensionReceiverParameterIndex()
Add the Kotlin 2.4.0 compiler plugin variant (component registrar,
IR compatibility shims, and version-specific utilities), bundle the
2.4.0 compiler dependencies, and update the build wiring, supported
version metadata and the too-new diagnostic bound.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Accept test changes from Kotlin 2.3.0 update
Updates expected test outputs for kotlin2 library tests to match
actual compiler output. Changes include:
- Location adjustments for properties/methods (now point to identifiers)
- CastExpr -> ImplicitCastExpr for implicit type casts
- Removed duplicate BlockStmt entries in loop ASTs
- Super constructor call location changes
Note that in Kotlin 2.3.0 super constructor calls now have locations spanning
entire class declarations instead of the actual super call site.
This change rolls up all files from v1_6_0, v1_6_20, v1_7_0 and v_1_7_20.
In addition, versioned files that are not overridden by any later Kotlin versions (i.e. files that only have one copy under utils/versions) are inlined and removed to simplify list of changes.
List of removed/inlined files:
allOverriddenIncludingSelf.kt
copyTo.kt
ExperimentalCompilerApi.kt
getFileClassFqName.kt
IsUnderscoreParameter.kt
ReferenceEntity.kt
SyntheticBodyKind.kt
Types.kt
withHasQuestionMark.kt
Previously, we were using 8.0.0rc1.
In particular, this upgrade means we need to explicitly
import more rules, as they've been moved out of the core bazel repo.