Skip to content

Commit a5d3b4a

Browse files
Add support for Experimental x_context_parameters (#1376)
* add x_context_parameters compiler flag * DOCS * run doc gen command * add flag to capabilities and generate docs
1 parent b612fea commit a5d3b4a

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

docs/kotlin.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ load("@rules_kotlin//kotlin:core.bzl", "kt_kotlinc_options")
385385

386386
kt_kotlinc_options(<a href="#kt_kotlinc_options-name">name</a>, <a href="#kt_kotlinc_options-include_stdlibs">include_stdlibs</a>, <a href="#kt_kotlinc_options-java_parameters">java_parameters</a>, <a href="#kt_kotlinc_options-jvm_target">jvm_target</a>, <a href="#kt_kotlinc_options-warn">warn</a>,
387387
<a href="#kt_kotlinc_options-x_annotation_default_target">x_annotation_default_target</a>, <a href="#kt_kotlinc_options-x_assertions">x_assertions</a>, <a href="#kt_kotlinc_options-x_backend_threads">x_backend_threads</a>,
388-
<a href="#kt_kotlinc_options-x_consistent_data_class_copy_visibility">x_consistent_data_class_copy_visibility</a>, <a href="#kt_kotlinc_options-x_context_receivers">x_context_receivers</a>,
388+
<a href="#kt_kotlinc_options-x_consistent_data_class_copy_visibility">x_consistent_data_class_copy_visibility</a>, <a href="#kt_kotlinc_options-x_context_parameters">x_context_parameters</a>, <a href="#kt_kotlinc_options-x_context_receivers">x_context_receivers</a>,
389389
<a href="#kt_kotlinc_options-x_emit_jvm_type_annotations">x_emit_jvm_type_annotations</a>, <a href="#kt_kotlinc_options-x_enable_incremental_compilation">x_enable_incremental_compilation</a>, <a href="#kt_kotlinc_options-x_explicit_api_mode">x_explicit_api_mode</a>,
390390
<a href="#kt_kotlinc_options-x_inline_classes">x_inline_classes</a>, <a href="#kt_kotlinc_options-x_jdk_release">x_jdk_release</a>, <a href="#kt_kotlinc_options-x_jspecify_annotations">x_jspecify_annotations</a>, <a href="#kt_kotlinc_options-x_jsr_305">x_jsr_305</a>, <a href="#kt_kotlinc_options-x_jvm_default">x_jvm_default</a>,
391391
<a href="#kt_kotlinc_options-x_lambdas">x_lambdas</a>, <a href="#kt_kotlinc_options-x_multi_platform">x_multi_platform</a>, <a href="#kt_kotlinc_options-x_no_call_assertions">x_no_call_assertions</a>, <a href="#kt_kotlinc_options-x_no_optimize">x_no_optimize</a>,
@@ -411,6 +411,7 @@ Define kotlin compiler options.
411411
| <a id="kt_kotlinc_options-x_assertions"></a>x_assertions | Configures how assertions are handled. The 'jvm' option enables assertions in JVM code. | String | optional | `""` |
412412
| <a id="kt_kotlinc_options-x_backend_threads"></a>x_backend_threads | When using the IR backend, run lowerings by file in N parallel threads. 0 means use a thread per processor core. Default value is 1. | Integer | optional | `1` |
413413
| <a id="kt_kotlinc_options-x_consistent_data_class_copy_visibility"></a>x_consistent_data_class_copy_visibility | The effect of this compiler flag is the same as applying @ConsistentCopyVisibility annotation to all data classes in the module. See https://youtrack.jetbrains.com/issue/KT-11914 | Boolean | optional | `False` |
414+
| <a id="kt_kotlinc_options-x_context_parameters"></a>x_context_parameters | Enable experimental context parameters (Kotlin 2.2+). | Boolean | optional | `False` |
414415
| <a id="kt_kotlinc_options-x_context_receivers"></a>x_context_receivers | Enable experimental context receivers. | Boolean | optional | `False` |
415416
| <a id="kt_kotlinc_options-x_emit_jvm_type_annotations"></a>x_emit_jvm_type_annotations | Basic support for type annotations in JVM bytecode. | Boolean | optional | `False` |
416417
| <a id="kt_kotlinc_options-x_enable_incremental_compilation"></a>x_enable_incremental_compilation | Enable incremental compilation | Boolean | optional | `False` |

src/main/starlark/core/options/opts.kotlinc.bzl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ _KOPTS_ALL = {
8383
True: ["-Xcontext-receivers"],
8484
},
8585
),
86+
"x_context_parameters": struct(
87+
flag = "-Xcontext-parameters",
88+
args = dict(
89+
default = False,
90+
doc = "Enable experimental context parameters (Kotlin 2.2+).",
91+
),
92+
type = attr.bool,
93+
value_to_flag = {
94+
True: ["-Xcontext-parameters"],
95+
},
96+
),
8697
"x_suppress_version_warnings": struct(
8798
flag = "-Xsuppress-version-warnings",
8899
args = dict(

src/main/starlark/core/repositories/kotlin/capabilities_2.1.bzl.com_github_jetbrains_kotlin.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ They should be a subset of sources passed as free arguments.""",
107107
doc = "The effect of this compiler flag is the same as applying @ConsistentCopyVisibility annotation to all data classes in the module. See https://youtrack.jetbrains.com/issue/KT-11914",
108108
default = False,
109109
),
110+
"-Xcontext-parameters" : struct(
111+
flag = "-Xcontext-parameters",
112+
doc = "Enable experimental context parameters.",
113+
default = False
114+
),
110115
"-Xcontext-receivers": struct(
111116
flag = "-Xcontext-receivers",
112117
doc = "Enable experimental context receivers.",

0 commit comments

Comments
 (0)