Kotlin 2.2.20-Beta2
Pre-release
Pre-release
·
98 commits
to 2.2.20
since this release
Changelog
Analysis API. Code Compilation
KT-78382K2 IR lowering error when interface extends interfaceKT-73201K2 IDE: Error while evaluating expressions with local classesKT-78164Evaluator: '@JvmName' annotations are not recognized in other modules
Analysis API. FIR
KT-72227SOE from recursive value classKT-68977K2 IDE: Reference to companion object through typealias in a function call does not workKT-76490Do not load ast during the contracts phase if no contracts presentKT-72407FirImplementationByDelegationWithDifferentGenericSignatureChecker: FirLazyExpression should be calculated before accessing
Analysis API. Light Classes
KT-78065Support "Expose boxed inline value classes" in Light ClassesKT-78835Find usages of a light constructor from a class with an empty body finds usages of class as well
Analysis API. Providers and Caches
KT-78640Analysis API: Remove "friend builtins provider" fromFirDeclarationForCompiledElementSearcher
Analysis API. Standalone
KT-78638Analysis API Standalone: Stdlib builtins are not indexed inSTUBSdeserialized declaration origin mode
Analysis API. Surface
New Features
KT-73473Provide KaExpressionInformationProvider.isUsedAsResultOfLambda
Performance Improvements
KT-78526Get rid of redundantcheckValidityfromwithPsiValidityAssertion
Fixes
KT-78820K2: ISE "FIR element class FirErrorExpressionImpl is not supported in constant evaluation" through RedundantValueArgumentInspectionKT-75057Analysis API: Reference to object through typealias in invoke operator call leads to original typeKT-79042Do not restore KaTypePointer if target kind has changedKT-72421AA: "KtReference.resolveToSymbols" returns empty list when ASSIGN_OPERATOR_AMBGUITY error is presentKT-63464AA: KtPsiTypeProvider#asPsiType doesn't substitute kotlin.UnitKT-75913K2: SymbolLightLazyAnnotation evaluates arguments and replaces them with constantsKT-73184Analysis API: KaFunctionCall.argumentMapping is unexpectedly deparenthesisedKT-78613PSI: add binary compatibility checksKT-74013Analysis API: Cover the API surface with@SubclassOptInRequiredannotationsKT-76614Move the parser and lexer to a separate moduleKT-78552KaFunctionValueParameteris not marked asKaLifetimeOwnerKT-71152Add back SubclassOptInRequired to classes in KaModule.ktKT-77674Analysis API: Redundant smart cast to the original type
Backend. Wasm
New Features
KT-65721K/Wasm: stop unconditionally exporting any main function from the root package
Fixes
KT-73931WASM: "RuntimeError: illegal cast" with nullable genericKT-65403[WASM] RuntimeError is thrown instead of ClassCastExceptionKT-79317[Wasm] Do not throw CCE for ExcludedFromCodegen declarationsKT-66085K/WASM: Runtime error is uncaught withcatch (e: Throwable)KT-66072K/Wasm: improve how exceptions work in JS interopKT-78384K/Wasm: Incorrect debug info of local declarations in inline function from another fileKT-71533K/Wasm + K2: no error on KClass::qualifiedName usagesKT-72220Wasm: Unclear exception in case of missed dependencyKT-71691No trace on Wasm/JS if an error occurred in initializing global variables in a file with the main functionKT-69570K/Wasm: JsExport with default parameter value compiles to invalid Wasm
Compiler
New Features
KT-78792Report warning for redundant return in expression bodyKT-45683Allow generics in contract type assertionsKT-71244Incorporate existing@CheckReturnValueannotation(s) into Kotlin's unused return value checkerKT-32313Support contracts for operator functionsKT-76766Warning is missing for wrong subclass checkingKT-65688Generate when-expressions over final classes via invokedynamic typeSwitch + tableswitch on JDK 21+
Performance Improvements
KT-78672Consider having FirCallableSymbol.callableId null for local properties / parametersKT-77839K2: consider not creating CallableId for value parameters / variables / fields
Fixes
KT-79355Failed to fix the problem of desugaredincwith new reverse implies returns contractKT-79277Implies returns contract doesn't affect the return type of the function if it is in the argument positionKT-79271Implies returns contract doesn't impact exhaustivenessKT-79218SMARTCAST_IMPOSSIBLE for top‑level extension‑property getter despite returnsNotNull contractKT-79220returnsNotNull contract ignored on extension function with nullable receiverKT-79442"Multiple annotations of type kotlin.coroutines.jvm.internal.DebugMetadata": 2.2.0-Beta1 generates broken code with JVM default suspend methods in interfacesKT-79354IllegalStateException: Debug metadata version mismatch. Expected: 1, got 2 with compiler 2.2.20-Beta1 and stdlib 2.2.0KT-78479IR lowering failed / Unexpected null argument for composable callKT-77401[FIR]ParameterNameTypeAttribute.namedoesn't support@ParameterNamewith compile-time constant property argumentKT-77986K2: False negative: "Local classes are not yet supported in inline functions"KT-78843FIR tree: comments within String concatenation aren't visited in 2.2.0KT-76477Kotlin/Native: fix compiler performance reporting in sources->klib and klibs->binaryKT-78589"Class does not have member field" caused by delegation from a Java to Kotlin classKT-79076'IllegalStateException: Cannot serialize error type: ERROR CLASS: Uninferred type' with Exposed column using recursive generic typeKT-78726Split runPsiToIr phase into runPsiToIr and runIrLinkerKT-77672K/N: come up with a fallback strategy for the casts optimization passKT-76585K2: RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY is not reported inside initializers of local variablesKT-79099K2: Do not inherit inline modifierKT-76902Omit type-use annotations from diagnosticsKT-79085Adding-Xreturn-value-checker=fullto kotlinc causes "error: conflicting overloads"KT-58988K2: Deprecate exposing package-private parameter of internal methodKT-77199OPT_IN_USAGE_ERROR is still absent when calling the enum primary constructorKT-72800K2: java.util.NoSuchElementException when introduce variableKT-79056Add experimental language version 2.5KT-78351Plugins: VIRTUAL_MEMBER_HIDDEN caused by FirSupertypeGenerationExtensionKT-78527No LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING is reported when a private companion object is accessed via the class nameKT-78837linkReleaseFrameworkIosArm64: Compilation failed: An interface expected but was AnyKT-78945CONTRACT_NOT_ALLOWED is not reported for local operator functionsKT-78944ANNOTATION_IN_CONTRACT_ERROR is not reported for operators and property accessors with contractsKT-78943ERROR_IN_CONTRACT_DESCRIPTION is not reported for operators and property accessors with contractsKT-78932Contracts are allowed for open and overridden property accessorsKT-77203FIR: Consider adding destructured type to all COMPONENT_FUNCTION_* diagnosticsKT-78805K2: False positive METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACEKT-78651No need to report LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING in noinline default value lambdaKT-78849K2: [Wasm, Fir2IR] Invalid smartcast on overloaded function callKT-78793Make feature AllowEagerSupertypeAccessibilityChecks experimentalKT-78736Missing [NOT_YET_SUPPORTED_IN_INLINE] diagnostics because of incorrect context updateKT-78324K2: False negative [INCONSISTENT_TYPE_PARAMETER_VALUES]KT-69975KDoc: cannot reference elements with names in backticksKT-78229KDoc: unable to reference a method with spaces in the nameKT-78047Render unnamed context parameters as _ instead ofKT-74621Debugger: AssertionError on evaluating two suspending callsKT-76826New inference error [NewConstraintError at Incorporate TypeVariable] caused by recursive generics and nullable expected typeKT-78028"FirNamedFunctionSymbol" leaks to the error message about missing infix modifierKT-77245Add expression name to RETURN_VALUE_NOT_USED diagnosticKT-78071False-positive NO_ELSE_IN_WHEN after variable reassignmentKT-78068False-positive NO_ELSE_IN_WHEN after excluding enum value with inequality checkKT-25341NOT_YET_SUPPORTED_IN_INLINE reported over anonymous object borderKT-71134Consider to get rid of CapturedTypeMarker.withNotNullProjection()KT-77131getValue/setValue can be declared with more than two/three parametersKT-78452Drop redundant frontend structures after fir2ir conversionKT-78458Don't populate PredicateBasedProvider if no lookup predicates are registeredKT-78440Lambda with an implicitly runtime-retained annotation is generated via invokedynamic with-Xindy-allow-annotated-lambdas=falseKT-78252ClassCastException whenArray<Void>used for compile-time vararg ofNothingKT-78097False positive NO_ELSE_IN_WHEN on sealed interface with negative is checkKT-77713Context Parameters cause compiler generate r8 incompatible bytecodeKT-76629K2 Mode: False positive RedundantVisibilityModifier inspection on private constructors in sealed classesKT-78429K2: Property callable reference incorrectly smart-casted to intersection of property type and KPropertyKT-78509Renamed for override copy functions are cached in scope instead of sessionKT-75831K2: An extra "[VALUE_PARAMETER_WITHOUT_EXPLICIT_TYPE] An explicit type is required on a value parameter." for a missing parameterKT-78370All the [something]Assign operators on dynamic return Unit as a typeKT-73950K2 IDE / Kotlin Debugger: ISE “Fake override should have at least one overridden descriptor” on evaluation of local calss in presence of bystanderKT-78280Implement the sourcelessKtDiagnosticsKT-76543Migrate psi2ir sources to new IR parameter APIKT-77716Kotlin/Native and -Xseparate-kmp-compilation: "Compilation failed: Several functions kotlin/native/immutableBlobOf found"KT-76400Context-sensitive resolution doesn’t work in if-else condition passed as a function argumentKT-76606Enable 'Indy: Allow lambdas with annotations' by defaultKT-78121Report warning on function type with multiple implicit values that's annotated with DSL markerKT-61227Definitely non-nullable types cause "Any was expected" for@Nullableparameter
Compose compiler
b/432262806Use classId as FirApplierInferencer tokensKT-78479Ensure that default transform affects functions entered through a callb/400371006Gate default parameters behind language versionsKT-78490Fix visibility for default wrappers of protected methodsb/245673006Specify fqName for classes and functions in build metricsb/254577243Avoid printing complex expressions in compiler metrics
IR. Inlining
New Features
KT-70360KLIBs: Uniformly handletypeOf()calls at 1st/2nd stages of compilation
Fixes
KT-79002[Inliner][Native][PL] Native backend fails for inline function that instantiates a class that was compiled implementing two interfaces, which turned into abstract classesKT-69941RewriteDumpSyntheticAccessorslowering to test handler after moving common Native/JS prefix to KLIB compilationKT-78137Review & enable PL tests with enabled IR inlinerKT-78245Synthetic Accessors incorrectly copies default valuesKT-76236IncludeNativeInliningFacadeandJsIrInliningFacadein all Native & JS test runnersKT-76512Avoid usingoriginalFunctioninsideFunctionInliningKT-69457[references] IR Inliner: References to inline functions are not inlinedKT-47521Native & JS: Recursive inline fun calls -> StackOverflowErrorKT-76763[Inliner] Don't use attributeOwnerId to pass info from Inliner to non-JVM backendsKT-76145Enhance error message about poisoned KLIBs in KLIB-based compilers
IR. Tree
KT-78978PL tests: Dropadjust*forLazyIr()hackKT-77596RefinereuseExistingSignaturesForSymbolssetting in IR serializerKT-76723IR validator: Check visibilities of annotationsKT-76405Visit annotations in IrTypeVisitor and IrTreeSymbolsVisitorKT-78033[PL] MergeIrUnimplementedOverridesStrategytoPartiallyLinkedIrTreePatcher
JVM. Reflection
KT-77882kotlin-reflect: KParameter.name returns "" instead of null for anonymous context parametersKT-77879kotlin-reflect: toString overrides of KCallable implementations do not render context parameters
JavaScript
New Features
KT-79394Add the possibility to write common external declarations between JS and WasmJS targetsKT-79222K/JS: Allow using Long in exported declarations
Performance Improvements
KT-57128KJS: Use BigInt to represent Long values in ES6 modeKT-54689KJS: Data class equals less efficient than manually written version
Fixes
KT-79050KJS / IC: "Unexpected body of primary constructor for processing irClass"KT-52230KSJ IR: Applying identity equality operator to Longs always returns falseKT-6675KotlinJS: toInt() on external Long throws errorKT-79184K/JS: Further intrinsify BigInt-backed Long operationsKT-78701Js and Wasm: enumValueOf does not include invalid value into an exception messageKT-78316KJS: List is not exported to TypeScript declaration if wrapped in PromiseKT-66091KJS, WASM:AssertionError: Illegal value: <T>in test nonReified_equality.ktKT-57192KJS: "Exported declaration uses non-exportable return type" caused by@JsExportPromise with Unit typeKT-61183KJS: "AssertionError: Assertion failed" from JsSuspendFunctionsLoweringKT-59326KJS / IR: invalid code generated when using constructor parameter nameddefault
Klibs
KT-78699Compiler (JS, Wasm): warn about incompatible kotlin-test/compiler pairKT-78700Compiler (JS, Wasm): Consider making diagnostics for incompatible kotlin-stdlib/compiler and kotlin-test/compiler pairs errors instead of warningsKT-76094Support new callable reference nodes in partial linkage in Kotlin/WasmKT-78771KLIBs: ImprovezipDirAs()function that is used to produce KLIB (ZIP) archivesKT-78349[Tests] Enable Partial Linkage in all testsKT-68322Compiler (JS, Wasm): warn about incompatible Kotlin stdlib/compiler pair
Language Design
KT-32993Contract to specify that a function parameter is always true inside lambdaKT-79308Ability to actualize empty interfaces as AnyKT-78866Warn implicit receiver shadowed by context parameterKT-8889Contracts: if a given function parameter is not null, the result is not nullKT-22786Returns are not allowed for expression-body functions and are allowed when an inline lambda is addedKT-54363Allow using reified types for catch parametersKT-77836Support using context parameter of a@RestrictsSuspensiontype as the "restricted coroutine scope"KT-77823Context-sensitive resolution doesn't work for subtypes of sealed typesKT-75977False positive unresolved_reference when resolving nested member after a type check
Libraries
KT-79080Annotate WasmImport and WasmExport as experimental APIKT-79121K/Wasm annotate JS-interop API as experimentalKT-78581Add the KClass.isInterface property to Kotlin/JS stdlibKT-78710kotlin.wasm and kotlin.wasm.unsafe packages are missing descriptionKT-78709Wasm: KClass.qualifiedName KDoc should reflect the behavior on the targetKT-78704CharSequence.subSequence and String.substring behavior with invalid indices differs between targetsKT-78705Float.sign and Double.sign behavior for negative zero is not documentedKT-74543Support for context parameters in kotlinx-metadataKT-78340String.startsWith KDoc declares invalid exception condition
Native
Native. ObjC Export
KT-77488[ObjCExport] Add explicit ObjCBlock parameter name in objc exportKT-78447[ObjCExport] Add missing ERROR constructors, align with K1
Native. Runtime
KT-79152Native: unexpected thread state in kotlin::to_string
Native. Runtime. Memory
KT-78925Crash SIGABRT on Apple Watch after updating Kotlin to 2.2.0KT-76851Kotlin/Native: GC scheduler MutatorAssists requestAssists and completeEpoch issue
Native. Swift Export
KT-79227Swift Export: Fix First Release IssuesKT-78947Implement FUS for Swift exportKT-79521'_CoroutineScope' is inaccessible due to 'internal' protection level
Tools. Build Tools API
KT-78415Add a tool for performance reports analysing
Tools. CLI
KT-75968Set proper lifecycle for all existing compiler argumentsKT-78318Unresolved reference when compiling kotlin/JS project on fresh masterKT-78578Support for placeholder (*) and directory in-Xdump-perf
Tools. Compiler Plugin API
KT-78279Make the DiagnosticReporter default way for reporting in IR plugins
Tools. Compiler Plugins
KT-78969[DataFrame] Provide source elements for plugin-generated classesKT-75265PowerAssert: the result of invoke is displayed at the same level as value that can be confusingKT-78490"AssertionError: SyntheticAccessorLowering should not attempt to modify other files" when calling protected open composable with default argumentKT-77626K2: AssertionError: FUN LOCAL_FUNCTION_FOR_LAMBDA has no continuationKT-78038Make jvm-abi-gen compiler plugin output classloader-friendlyKT-78671[DataFrame] Support type parameter types in DataSchema to fix evaluate expressionKT-78439DataFrame compiler plugin: Unresolved reference error in REPL
Tools. Gradle
KT-79034Automatically disable cross compilation if it's not supported on the hostKT-77023Support creating KotlinJvmAndroidCompilation in KotlinBaseApiPluginKT-74420Migrate kotlin-parcelize away from AGP's deprecated Variant APIKT-76421Stabilize klib cross-compilation on different platformsKT-78233Add ExperimentalFeatureWarning unique idKT-67992Cleanup deprecated code required for KSP1KT-72341Remove 'kotlin-android-extensions' pluginKT-67291Enable Project Isolation AND/OR Configuration Cache mode for Gradle Integration testsKT-65271Gradle: "Mutating dependency DefaultExternalModuleDependency after it has been finalized has been deprecated " with gradle 8.6-rc-3
Tools. Gradle. Cocoapods
KT-79429K/N: Cocoapods: IllegalArgumentException: "cinterop doesn't support having headers in -fmodules mode" with 2.2.20-Beta1 if explicitly not specify false for 'useClangModules'KT-76035Allow extra command line arguments in PodBuildTaskKT-78387Kotlin Cocoapods Gradle Plugin is not compatible with Gradle isolated projects
Tools. Gradle. JS
KT-79237Upgrade NPM dependencies versionsKT-75480Add shared source set for js and wasmJs targetKT-77319KJS / Gradle: generateTypeScriptDefinitions() generates wrong file extension when outputting ES modulesKT-78504[2.2.0-RC3] NPM Tasks in 2.2 RCs produce broken/unusable build cache entriesKT-77443NPE: "NullPointerException: Cannot invoke org.gradle.api.tasks.TaskProvider.flatMap(org.gradle.api.Transformer)": ExecutableWasm.optimizeTask is accessed before initializationKT-76987JS, Wasm: Upgrade NPM dependencies
Tools. Gradle. Multiplatform
New Features
KT-76446Add kotlin-level dependency block to work the same way as commonMain/commonTest dependencies blocks
Fixes
KT-79559AGP complains about configurations resolved at configuration time due to KMP partially resolved dependencies diagnosticKT-69790Report human-readable error when declared dependency doesn't support required target typesKT-77843KGP fails with Gradle 9 onProjectDependency.getDependencyProject()KT-79315Early task materialization with cross-project configuration breaks configuration due to KMP partial resolution checkerKT-78297FileNotFoundException in generateMetadataFile task if non-packed=falseKT-78993The value for property '*' property 'dependencies' is final and cannot be changed any furtherKT-62294kotlin-parcelize plugin does not support the new android kotlin multiplatform pluginKT-77466KMP - testFixturesApi and similar configurations do not affect jvmTestFixtures source setKT-78433Gradle: add tracking of the new KMP compilation scheme to FUSKT-78431Gradle: in-process metadata compiler uses deprecated K2MetadataCompiler
Tools. Gradle. Native
KT-74864Enable exporting KDocs by default to ObjCKT-51301Remove ability to use Native non-embeddable compiler jar in Gradle pluginKT-78838Add default 3G max heap size for the commonizer JVM process
Tools. Gradle. Swift Export
KT-78385Swift Export is not compatible with Gradle isolated projects
Tools. Incremental Compile
KT-60653IC does not handle changes in inline functions objects/lambdas correctlyKT-78807Changing ABI fingerprint on non-ABI changes when lambda passed to inlined function
Tools. JPS
Tools. Kapt
KT-79138K2: KAPT Java Stub Gen:Unresolved referencewith@kotlin.Metadata in Java in 2.2.0KT-79133K2 kapt: class literal with typealias is not expanded
Tools. Maven
KT-77587Maven: Introduce Kotlin daemon support and make it enabled by defaultKT-63688Remove JS-related stuff from kotlin-maven-plugin
Tools. REPL
KT-78755[K2 Repl] Redeclaring variables does not work