-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Kotlin: support 2.4.20-RC2 #22404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Kotlin: support 2.4.20-RC2 #22404
Changes from all commits
93e6135
c1b4fe6
0724caf
96ac5ba
8b8b961
f146aa6
b9c81d5
63553e3
05a4fe3
b0316a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ | |
| import io | ||
| import os | ||
|
|
||
| DEFAULT_VERSION = "2.4.10" | ||
| DEFAULT_VERSION = "2.4.20-RC2" | ||
|
|
||
|
|
||
| def options(): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1645,8 +1645,9 @@ open class KotlinFileExtractor( | |
| extractMethodAndParameterTypeAccesses: Boolean, | ||
| typeSubstitution: TypeSubstitution?, | ||
| classTypeArgsIncludingOuterClasses: List<IrTypeArgument>? | ||
| ) : Label<out DbCallable> = | ||
| forceExtractFunction( | ||
| ) : Label<out DbCallable> { | ||
| val sourceLoc = tw.getLocation(f.parentClassOrNull ?: f) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What breaks without the changes to this file? |
||
| return forceExtractFunction( | ||
| f, | ||
| parentId, | ||
| extractBody = false, | ||
|
|
@@ -1656,6 +1657,7 @@ open class KotlinFileExtractor( | |
| classTypeArgsIncludingOuterClasses, | ||
| overriddenAttributes = | ||
| OverriddenFunctionAttributes( | ||
| sourceLoc = sourceLoc, | ||
| visibility = DescriptorVisibilities.PUBLIC, | ||
| modality = Modality.OPEN | ||
| ) | ||
|
|
@@ -1666,7 +1668,6 @@ open class KotlinFileExtractor( | |
| CompilerGeneratedKinds.INTERFACE_FORWARDER.kind | ||
| ) | ||
| if (extractBody) { | ||
| val realFunctionLocId = tw.getLocation(f) | ||
| val inheritedDefaultFunction = f.realOverrideTarget | ||
| val directlyInheritedSymbol = | ||
| when (f) { | ||
|
|
@@ -1686,10 +1687,10 @@ open class KotlinFileExtractor( | |
| (directlyInheritedSymbol.owner.parentClassOrNull ?: return functionId) | ||
| .typeWith() | ||
|
|
||
| extractExpressionBody(functionId, realFunctionLocId).also { returnId -> | ||
| extractExpressionBody(functionId, sourceLoc).also { returnId -> | ||
| extractRawMethodAccess( | ||
| f, | ||
| realFunctionLocId, | ||
| sourceLoc, | ||
| f.returnType, | ||
| functionId, | ||
| returnId, | ||
|
|
@@ -1702,7 +1703,7 @@ open class KotlinFileExtractor( | |
| extractVariableAccess( | ||
| syntheticParamId, | ||
| param.type, | ||
| realFunctionLocId, | ||
| sourceLoc, | ||
| argParentId, | ||
| idxOffset + idx, | ||
| functionId, | ||
|
|
@@ -1718,14 +1719,15 @@ open class KotlinFileExtractor( | |
| callId, | ||
| -1, | ||
| returnId, | ||
| realFunctionLocId | ||
| sourceLoc | ||
| ) | ||
| }, | ||
| null | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private fun extractFunction( | ||
| f: IrFunction, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package com.github.codeql | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file basically mimics what older compilers supplied by default somehow? |
||
|
|
||
| import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension | ||
| import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar | ||
| import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi | ||
| import org.jetbrains.kotlin.config.CompilerConfiguration | ||
|
|
||
| @OptIn(ExperimentalCompilerApi::class) | ||
| abstract class Kotlin2ComponentRegistrar : CompilerPluginRegistrar() { | ||
| override val supportsK2: Boolean | ||
| get() = true | ||
|
|
||
| override val pluginId: String | ||
| get() = "kotlin-extractor" | ||
|
|
||
| private var extensionStorage: CompilerPluginRegistrar.ExtensionStorage? = null | ||
|
|
||
| override fun ExtensionStorage.registerExtensions(configuration: CompilerConfiguration) { | ||
| this@Kotlin2ComponentRegistrar.extensionStorage = this | ||
| doRegisterExtensions(configuration) | ||
| } | ||
|
|
||
| abstract fun doRegisterExtensions(configuration: CompilerConfiguration) | ||
|
|
||
| protected fun registerExtractorExtension(extension: IrGenerationExtension) { | ||
| val storage = extensionStorage | ||
| ?: throw IllegalStateException("registerExtractorExtension called before registerExtensions") | ||
| with(storage) { | ||
| IrGenerationExtension.registerExtension(extension) | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ VERSIONS = [ | |
| "2.3.0", | ||
| "2.3.20", | ||
| "2.4.0", | ||
| "2.4.20-RC2", | ||
| ] | ||
|
|
||
| def _version_to_tuple(v): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,6 @@ | |
|
|
||
| public class KotlinVersion { | ||
|
|
||
| public static String CURRENT = "999.999.999"; | ||
| public static String CURRENT = "2.4.20"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand why you changed this, but in the long run this seems non-ideal because we'll need to keep updating the test. |
||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| --- | ||
| category: minorAnalysis | ||
| --- | ||
| * Preliminary support for Kotlin 2.4.20-RC2 has been added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Footnotes should be ordered. I don't think we need a footnote though, as there's nothing really preliminary about this.