Kotlin 2.1.0-Beta2
Pre-release
Pre-release
·
152 commits
to 2.1.0
since this release
Changelog
Analysis API. Caches and Invalidation
KT-71700Cache result of resolveToCallKT-71520Analysis API:LLFirNativeForwardDeclarationsSymbolProviderspends a lot of time in indices
Analysis API. Lazy Resolution
KT-71567LLFirCompilerRequiredAnnotationsTargetResolver should calculate annotation arguments on demandKT-71584getNonLocalContainingOrThisDeclarationtreats KtParameter from functional type as non-localKT-71566FirElementBuilder#getFirForNonKtFileElement should iterate a Psi file over and overKT-71224Analysis API:FirElementFinder.collectDesignationPathrelies on naive iteration through FIR files
Analysis API. Light Classes
KT-71693Wrong name mangling for JvmField class property and companion property clashKT-71469KtLightClassForDecompiledDeclaration: missed kotlinOrigin
Analysis API. Stubs and Decompilation
KT-71565KtClassOrObject should use isLocal from greenStub
Analysis API. Surface
KT-71731directlyOverridenSymbols/allOverridenSymbols works incorrectly for intersection overrides
Analysis. API
Performance Improvements
KT-70165Introduce PSI-basedKaSymbols for K2
Fixes
KT-64984Analysis API: Support Wasm targetKT-70375K2: NPE at org.jetbrains.kotlin.analysis.api.fir.symbols.KaFirNamedClassSymbolBase.createPointerKT-57733Analysis API: Use optimizedModuleWithDependenciesScopes in combined symbol providersKT-70437Class reference is not resolvableKT-70327Analysis API: Batch inspection causes deadlock inValueWithPostComputeKT-71259K2 evaluator: Invalid smart cast info collecting for Code FragmentsKT-65110Analysis API: In Standalone mode the order of symbols is unstableKT-71468Drop redundant logic from LLFirJavaFacadeForBinariesKT-70890Analysis API: Experiment with weak references to LL FIR/analysis sessions in session cachesKT-70474FirLazyResolveContractViolationException from JavaSymbolProviderKT-70657Analysis API: Inner types from classes with generics are incorrectly represented by the compiled jarsKT-71055Suspend calls inside 'analyze()' break the block guaranteesKT-70815Analysis API: Implement stop-the-world session invalidationKT-69819K2 IDE: LHS type in callable references is unresolved when it has type arguments and is qualifiedKT-68761Analysis API: Experiment with limited-size cache inKaFirSessionProviderKT-70384Analysis API Standalone: The same class in the same two renamed jars is unresolvedKT-71067Exceptions from references cancel Find UsagesKT-69190K2: False-positive "redundant private modifier"KT-63390K2: Analysis API: add annotations to KtClassInitializerSymbolKT-71025K2 IDE: Scopes in "importingScopeContext" have reversed ordering and "indexInTower" values
Apple Ecosystem
KT-69093Xcode 16 support in KotlinKT-66894XCFramework task fails when name passed to xcframework DSL is different from framework's nameKT-65675XCFrameworkTask produces an xcframework with mismatched casing in embedded frameworks
Backend. Native. Debug
KT-71374lldb: step out breaks breaking in Xcode 16
Backend. Wasm
KT-72156custom-formatters.js exists in JAR after publishToMavenLocal but not in the published artifact in Maven publicKT-70331Support incremental compilation for the Wasm backendKT-71686K/Wasm: Add functions to convert between Kotlin and JS array typesKT-71473K/Wasm: Use--closed-worldand related options for BinaryenKT-71800Wasm compiler: Fix member generation for data classes with an array-type propertyKT-71580String::toFloat on wasm behaves differently compared to other targetsKT-71523K/Wasm: cleanup after fix for KT-71474KT-71475K/Wasm: KClass::qualifiedName returns incorrect result for nested or companion objectsKT-71474K/Wasm: KProperty*Impl equals work incorrectly for clabbale reference created in different files or modulesKT-71294Wasm Artifacts/Resource are being loaded relatively instead of absolutely
Compiler
New Features
KT-71094Kotlin/Native incremental compilation: fail compilation if cache build failedKT-70679Kotlin/Native: fill WritableTypeInfo from Swift Export type mappingKT-54227Cannot use nullable Nothing as reified type parameterKT-71430Kotlin-to-Java direct actualization implementationKT-68163Expose supplementary compiler warnings via CLI
Performance Improvements
KT-71159[K2] OOM on large enum classes with fields
Fixes
KT-71480JAVA_CLASS_INHERITS_KT_PRIVATE_CLASS isn't reported while java object isn't createdKT-71508JAVA_CLASS_INHERITS_KT_PRIVATE_CLASS isn't reported when java class is inherited from an effectively private classKT-71260K2: Internal compiler error in IrFakeOverrideSymbolBase.getOwner when there is no actual for expectKT-58820OPT_IN_USAGE_ERROR's message text does not account for SubclassOptInRequiredKT-71034Failing compiler/testData/codegen/box/inlineClasses/kt70461.ktKT-71016K/Wasm: Failing compiler/testData/codegen/box/inlineClasses/kt70461.ktKT-60521Drop language versions 1.4 and 1.5KT-72154Dokka fails withnot array: KClass<out Annotation>on Kotlin 2.1.20-dev with@SubclassOptInRequiredKT-70562@SubclassOptInRequiredcannot accept multiple experimental markerKT-71708False negative UNSUPPORTED for collection literals as trailing return valueKT-52469Deprecate reified type parameter instantiating into intersection typesKT-71563'llegalStateException: Source classes should be created separately before referencing' when actualized through typealias and java direct actualizationKT-71756K2 evaluator: broken resolve of private members during debug of Kotlin project itselfKT-71550JVM IR: NPE on identity equals of boolean true with nullKT-71490K2: missing REDUNDANT_ELSE_IN_WHENKT-64403Implement BlackBoxCodegenTestSpecGenerated for K2KT-71551JVM IR K1: NPE on generating a function imported from an object from another moduleKT-71210K2: false negative FUNCTION_CALL_EXPECTED / NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE with companion objectsKT-69549Try to move callable reference transformation earlier in pipelineKT-71228K2: "IllegalArgumentException: Failed requirement" caused by lambda parameter and class typeKT-71738K2: False negative REDECLARATION inside object expressionKT-70407Error/warning message for@SubclassOptInRequired-annotated class should provide more contextKT-71701K2: false positive CAN_BE_VAL with lateinit and non-in-place lambdaKT-68694K2 IDE / Kotlin Debugger: AE “Unresolved reference: <HIDDEN: samples/gen/classes/enum class/EnumClass.lam is invisible” on evaluating private lambda inside enum entryKT-70970K2 IDE / Kotlin Debugger: AE “Only assignable IrValues can be set” on calling overloaded inc() operator on interfaceKT-70824K2: NoSuchFieldException when evaluating private extension propertyKT-70390K2 IDE / Kotlin Debugger: can't invoke lambda from private class during evaluationKT-68701K2 IDE / Kotlin Debugger: AE “ERROR_CALL 'Unresolved reference: <HIDDEN: /privateLambda is invisible>#' type=IrErrorType(null)” on evaluating private top-level lambdaKT-68695K2 IDE / Kotlin Debugger: AE “Unsupported callable reference” on evaluating ::lateinitStr on private lateinit propertyKT-70861K2 IDE / Kotlin Debugger: can't evaluate Clazz::class call for private classKT-34911Improve error message for WRONG_ANNOTATION_TARGET: list applicable targetsKT-8322Prohibit use of Nothing as catch parameterKT-71601K2: When with a subject of type dynamic always considered exhaustiveKT-33091Kotlin/Native: Compiler crashes if an external class is declaredKT-59651K1/K2: Assertion error on external enum usage attemptKT-71121Kotlin/JS incremental compilation fails with KotlinIllegalArgumentExceptionWithAttachmentsKT-69939Extract a category of internal FIR checkers from supplementary FIR checkersKT-71122Regression in Kotlin Compiler 2.0 causing NPE in the runtimeKT-71117K2: "IllegalArgumentException: No type for StarProjection" with star projection and function typeKT-71251Native & JS K2: Missing check for callingisInitializedinside inline funKT-71215K2: UB due to the erroneous greening of the red code with multiple delegation with javaKT-59386K2: Missing CONSTANT_EXPECTED_TYPE_MISMATCHKT-69040PCLA: deal with "deep" calls that can be fully analyzed properlyKT-71046K/N: a separate lowering to convert function reference to IrConstantObjectKT-70931K2 / Scripts: "cannot convert IrExpression to ConstantValue" when using function annotationKT-69223Drop parallel lowering mode in JVM backendKT-70260@JsPlainObject: improve compiler error if a method is presentKT-67739Improve error message when JDK used in -Xjdk-release has corrupted class filesKT-63964K2: different naming of classes defined in script in metadataKT-70014Common inference: introduce rigidTypeMarkerKT-71352Cannot load script definition class org.gradle.kotlin.dsl.KotlinProjectScriptTemplateKT-63502Getting java.lang.ClassNotFoundException: javaslang.λ during compilationKT-66316Kotlin/Native: make@Escapesannotation required for all external functionsKT-70965FIR/AA: Initializers for Java annotation arguments mapping capture use-site sessionsKT-64453K2: Implement ComposeLikeIr...TestGenerated for K2KT-30424Confusing error message "modality is different"KT-70846ReplaceConeKotlinType.nullabilitywithisMarkedNullableon specific typesKT-56720K2: false positive MANY_IMPL_MEMBER_NOT_IMPLEMENTED in case of delegation in diamond inheritanceKT-69937Define & enforce user-friendly terminology for extended checkersKT-64406K2: Implement CompileKotlinAgainstJavaTestGenerated for K2KT-69938Validate sets of default compiler warnings and supplementary compiler warningsKT-68971Investigate suspicious fragmentation of FIR trees for string literals with interpolationKT-71213Rethrow exceptions in checkers with some useful attachmentsKT-71189K2: emit 'DELEGATE_SPECIAL_FUNCTION_MISSING' and 'DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE' on 'by' keywordKT-71178K2: False negative NO_ELSE_IN_WHEN in when over nullable type with!is Nothing?checkKT-70812False positive NO_ELSE_IN_WHEN with nullable type argument as subjectKT-70947False positive NO_ELSE_IN_WHEN with DNN subject and nullable sealed class upper boundKT-67383Incorrect optimisation when optimising for loop with UByteKT-70752Review diagnostics with whole declaration as rangeKT-71160K2: Rendering of flexible collection types and arrays is too verboseKT-61227Definitely non-nullable types cause "Any was expected" for@NullableparameterKT-69389K2: NONE_APPLICABLE instead of more useful "type mismatch" error with overloads and parameter nullability mismatchKT-70930K2: Java annotations not present on ENUM_ENTRY IR elementsKT-69794K2: Wrong target is reported for EXPOSED_SUPER_INTERFACE diagnosticKT-70724False-positive UNINITIALIZED_VARIABLE for inline constructor with late-initialized variablesKT-70749False-positive UNINITIALIZED_VARIABLE for inline fun with crossinline modifier
Compose compiler
New features
b/328817808Added the PausableComposition feature flags
Fixes
b/366040842,b/365066530Replace deep copy in Compose plugin with in-place type mutationb/329477544Force open / overridden Composable functions to be non-restartable.b/361652128Disable live literal transform if the corresponding flag is disabled
IR. Actualizer
KT-71631Kotlin-to-Java direct actualization: java annotation element isn't actualizedKT-71597Kotlin-to-Java direct actualization: it is possible to actualize a function with default parametersKT-71592Kotlin-to-Java direct actualization: constructor of nested class can't be actualizedKT-71577Kotlin-to-Java direct actualization: method can be actualized by java static methodKT-71817Actualization of static members is broken for non-JVM platforms
IR. Inlining
Fixes
KT-69565Don't generate synthetic accessors for private symbols inside local classesKT-71137Generate synthetic accessors for backing fieldsKT-64865Explicitly generate accessors for private declarations in inline functionsKT-70420Enable double-inlining in Native & JS backends by defaultKT-71657K/JS: Double-inlining causes failures in IC with top-level synthetic accessorsKT-71659IR Inliner fails to inline function expressions due to implicit cast from the 1st phase of inliningKT-71078Inline all functions in local classes at the 1st stage of inliningKT-66508IR inliner: Add implicit cast for initializer of temporary variablesKT-66507IR inliner: Enable implicit casts in all KLib backendsKT-69466IrInlinedFunctionBlock: Refactor it to make it possible to serialize in KLIBsKT-69317IR Inlining. Try to place inlined arguments outsideIrInlinedFunctionBlockKT-69307Source offsets seem incorrect after IR inliningKT-67149Common Native/JS lowering prefix at the 2nd phase of compilationKT-69681IR: Report warnings on exposure of private types in non-private inline functionsKT-71232Implement an IR validation check that ensures that all IrFields are private on non-JVM backendsKT-67304Keep in common prefix: Shared variables + local classes in inline lambdasKT-70583Internal error in body lowering: java.lang.IllegalStateException: An attempt to generate an accessor after all accessors have been already added to their containers
IR. Tree
KT-71826stdlib fails to compile with-Xserialize-ir=allKT-67752Make copyRemappedTypeArgumentsFrom and transformValueArguments methods in DeepCopyIrTreeWithSymbols protected instead of privateKT-69644Report warning on cross-file IrGetField operations generated by compiler pluginsKT-71191SymbolTable: Check if the provided signature is public before adding a symbol to the SymbolTable
JavaScript
Fixes
KT-70117Generate debug info for code fromjscallKT-69408[JS] Enable insertAdditionalImplicitCasts=true (as in other KLIB-based backends)KT-67452K2: Consider hiding dynamic type creation under FlexibleTypeFactory for JS onlyKT-70226Delete JS tests that were only run with the legacy JS backendKT-71338K/JS: Add a flag for switching generating arrow functions on & offKT-70707KJS: asJsReadonlyMapView does not implement ReadonlyMap correctlyKT-71220Fix invalid IrFunctionReference creation in InnerClassConstructorCallsLoweringKT-70229Remove test classes related to the legacy JS backendKT-70359Remove legacy backend-related test directives from Kotlin/JS testsKT-70362Clean up Gradle tasks for running JS tests against the legacy JS backendKT-30016JS BE does not generate special bridge methods
Klibs
KT-64169[KLIB Resolve] Don't skip libraries that happen to have the sameunique_nameKT-67448[KLIB Resolve] Deprecate passing KLIB unique names via CLIKT-71455[KLIB Resolve] Forbid passing KLIB unique names via CLIKT-67474K2: Missing@ExtensionFunctionTypein metadata in KLIBsKT-67450[KLIB Resolve] Kotlin/Native: Only one implicit repository should remain for the compiler ("dist")KT-61098[KLIB Resolve] Don't allow working with KLIB "repositories"KT-66218Clean-up the code for serialization & deserialization of DFGs to & from KLIBs
Language Design
KT-71222Remove@ExperimentalSubclassOptInfrom SubclassOptInRequiredKT-67675Allow usage of Array<Nothing?>KT-69924Mention 'if' guard when '&&' is used incorrectly
Libraries
Performance Improvements
KT-66715Performance: faster alternative to String.lines()
Fixes
KT-71628Review deprecations in stdlib for 2.1KT-71660Stabilize experimental API for 2.1KT-54299Extract org.w3c declarations to separate library from K/Wasm StdlibKT-68027Document caveats and deincentivise usage of measureTimeMillisKT-71581Update outdated documentation to common lazy and provide samplesKT-71796Improve documentation for Path.walk and Path.visitFileTree functionsKT-69545Kotlin/Native: Deprecate API marked with FreezingIsDeprecated to errorKT-38754Deprecate appendln in favor of appendLineKT-68019Fill in missing package descriptions for standard library documentationKT-52181Native: Inconsistent behaviour of LinkedHashMap#entries on JVM and NativeKT-71570Document suspend lambda builderKT-46785Get rid of !! after readLine() in the standard library
Native
KT-71435Native: cannot access class 'objcnames.classes.Protocol'
Native. Build Infrastructure
KT-71820Update the coroutines version used in kotlin-native build infrastructure
Native. Platform Libraries
KT-70032Rebuild platform libraries in 2.1.0 with Xcode 16KT-71624Eliminate remaining UIKit/AppKit removed signaturesKT-70031Rebuild platform libraries in 2.0.21 with Xcode 16
Native. Runtime
KT-70680Kotlin/Native: Use WritableTypeInfo when creating Swift wrapper from the runtimeKT-70568Native: revert workaround for debug with LLVM 16
Native. Runtime. Memory
KT-70364Kotlin/Native: data race during GC initialization
Native. Swift Export
KT-71539Swift Export: export class member overridesKT-70678Swift Export: generate Kotlin<->Swift type mappingKT-70920Swift Export Nullability: primitive typeKT-71087Swift Export: Nullability: NeverKT-71086Swift Export: Nullability: StringsKT-70919Swift Export Nullability: reference typeKT-71026Swift Export: function overloading with ref types does not workKT-70960Swift Export nullability: add nullability to sir and printer
Reflection
KT-71378KotlinReflectionInternalError: Inconsistent number of parameters in the descriptor and Java reflection object
Tools. CLI
KT-70179K2: Building a file with kotlin-test-junit without junit does not include annotationsKT-71537Add JVM target bytecode version 23KT-61745K2: support light tree in multi-module chunk modeKT-70885Errors are not reported for wrong arguments in -Xsuppress-warning flag for non-jvm backendsKT-70991K2: Compilation fails if project version has a comma
Tools. CLI. Native
KT-68673Kotlin/Native "You have not specified any compilation arguments. No output has been produced" when no source nor-Xincludeis passed
Tools. Compiler Plugins
KT-71658Transform top-level atomic properties to Java boxed atomicsKT-65645Atomicfu-plugin: compilation hangs on a long string concatenationKT-69038Power-Assert does not display const valsKT-71525Setting JvmAbiConfigurationKeys.REMOVE_PRIVATE_CLASSES = true triggers java.util.ConcurrentModificationExceptionKT-41888IrExpression startOffset and endOffset are inconsistent with raw file textKT-69856Compose Plugin: IrType.erasedUpperBound throws NullPointerException when evaluating IrScript nodes due to missing targetClassKT-69410PowerAssert: Cannot find overload of requireNotNull without existing messageKT-66293Atomicfu-plugin: wrong return types for lowered extension functionsKT-71038PowerAssert: Constant on RHS of elvis operator leads to compiler crash
Tools. Daemon
KT-69929compileKotlin task reports that daemon has terminated unexpectedly
Tools. Fleet. ObjC Export
KT-71162ObjCExport: nullable functional type with reference argumentsKT-71022ObjCExport: enum c keywords translationKT-71082ObjCExport: KotlinUnit translated as Function1KT-70781ObjCExport: classifiers and callables type parameters translationKT-70943ObjCExport: extension orderKT-70840ObjCExport: duplicated interfaces
Tools. Gradle
New Features
KT-71602Introduce KotlinTopLevelExtensionKT-71603Introduce KotlinJvmExtension and KotlinAndroidExtensionKT-70383KotlinJvmFactory registerKaptGenerateStubsTask() function should also request compilation task providerKT-69927Need ability to pass KotlinJvmCompilerOptions to registerKotlinJvmCompileTask()KT-69940Expose supplementary compiler warnings via KGPKT-71227[Compose] Add PausableComposition feature flag to the Compose Gradle Plugin
Performance Improvements
KT-65285Use uncompressed Klibs
Fixes
KT-69851Compatibility with Gradle 8.10 releaseKT-58956Offer a shared interface for JVM and Android compilerOptions in Project extensionKT-71405Compose compiler gradle plugin: project.layout.file can't be used as a value of the 'stabilityConfigurationFiles' optionKT-65565Remove deprecated common platform plugin idKT-70430Clean-up obsolete Gradle plugin variants for Gradle versions <7.6KT-69853Compile against Gradle API 8.10KT-69852Run Gradle integration tests against Gradle 8.10 releaseKT-71411Add FUS statistics for new Dokka tasksKT-71291Log plugins from the list as Gradle pluginsKT-66049KGP JVM: Publishing isn't compatible with isolated projects and project dependenciesKT-65990UpdateGradleDeprecatedOption.levelvalues for arguments removed from the DSL after 2.1
Tools. Gradle. JS
KT-69628K/Wasm: Node.js version per projectKT-71536[JS, Wasm] Stop collecting information about KLIB IC in Kotlin2JsCompile
Tools. Gradle. Multiplatform
New Features
KT-70897Add KotlinBaseApiPlugin.kotlinAndroidExtension
Fixes
KT-72068Distribution for klib cross-compilation is not downloaded during compile tasksKT-69412ChangeKotlinTargetAlreadyDeclaredChecker's severity from warning to errorKT-66461Promote compiler options DSL for multiplatform projects to stableKT-71529Deprecate targetFromPreset API with an errorKT-71423Xcode archive missing dSYM files since Kotlin 2.0.20KT-71209Drop Hierarchy Template diagnostic about used shortcutsKT-71675checkSandboxAndWriteProtection collides with Compose's syncComposeResourcesKT-71428Change deprecation message for KMP target shorcutsKT-71444Certain POMs produced by Kotlin 2.0.20 cannot be consumed by KMP projects with Android targetsKT-69974KMP: POM dependency rewriter doesn't work with Included Builds OR dependencySubstitutionKT-58231Kotlin Gradle Plugin: set deprecation level to Error for KotlinTarget.useDisambiguationClassifierAsSourceSetNamePrefix and overrideDisambiguationClassifierOnIdeImportKT-71206KGP: Test source set may get duplicated KLIBs of different versions
Tools. Gradle. Native
KT-71398kotlinNativeBundleConfiguration should not contain dependencies on unsupported platformsKT-45559CInteropProcess: Changes to header files are not recognized; Task is still UP-TO-DATEKT-71722kotlinNativeBundleConfiguration present in JVM-only Gradle project
Tools. JPS
KT-71450Constant build failure: com.intellij.util.io.ClosedStorageException: storage is already closed
Tools. Kapt
KT-71431K2KAPT fails on modules without any annotation processors
Tools. REPL
KT-71109Kotlin Scripting REPL doesn't support keyboard shortcuts
Tools. Scripts
KT-68685K2 / Script: "KotlinReflectionInternalError: Unresolved class:" caused by main.kts script with nested classes and reflection