[JVM] Support callable references to contextualized declarations - #7639
Open
grechkovlad wants to merge 1 commit into
Open
[JVM] Support callable references to contextualized declarations#7639grechkovlad wants to merge 1 commit into
grechkovlad wants to merge 1 commit into
Conversation
- `FunctionReferenceLowering` passes the bound context arguments as
additional `context$N` constructor parameters of the generated
reference class, packs them into the `boundContextArguments` array,
and reads them back in `invoke` via array accesses.
- `PropertyReferenceLowering` calls the new
`(Mutable)PropertyReference{0,1}Impl` constructors that take an
`Object[] contextArguments` in front of the usual arguments.
- `PropertyReferenceDelegationLowering` is generalized from a single
optional bound receiver to a list of bound values: inlinable values
(including casts of stable expressions) are re-evaluated on each
accessor call, a non-trivial bound receiver is still cached in a
field, and inlined values with possible class-initialization side
effects are evaluated in an initializer block.
- `JvmStaticAnnotationLowering` replaces only the last bound value
(the receiver) with the object instance instead of clearing the
whole `boundValues` list, preserving bound context arguments.
This commit does NOT include reflection support of contextualized
callable reference.
^KT-86452: Fixed
Code Owners
PR commands for maintainers
|
grechkovlad
marked this pull request as ready for review
August 21, 2026 13:50
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.
FunctionReferenceLoweringpasses the bound context arguments as additionalcontext$Nconstructor parameters of the generated reference class, packs them into theboundContextArgumentsarray, and reads them back ininvokevia array accesses.PropertyReferenceLoweringcalls the new(Mutable)PropertyReference{0,1}Implconstructors that take anObject[] contextArgumentsin front of the usual arguments.PropertyReferenceDelegationLoweringis generalized from a single optional bound receiver to a list of bound values: inlinable values (including casts of stable expressions) are re-evaluated on each accessor call, a non-trivial bound receiver is still cached in a field, and inlined values with possible class-initialization side effects are evaluated in an initializer block.JvmStaticAnnotationLoweringreplaces only the last bound value (the receiver) with the object instance instead of clearing the wholeboundValueslist, preserving bound context arguments.This commit does NOT include reflection support of contextualized callable reference.
^KT-86452: Fixed