Skip to content

Commit 9761580

Browse files
committed
Merge branch 'main' into rust/type-inference-assoc-type-tp
2 parents 39f602c + 37b508b commit 9761580

File tree

43 files changed

+3756
-3450
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3756
-3450
lines changed

.github/copilot-instructions.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,3 @@ When reviewing code:
22
* do not review changes in files with `.expected` extension (they are automatically ensured to be correct).
33
* in `.ql` and `.qll` files, do not try to review the code itself as you don't understand the programming language
44
well enough to make comments in these languages. You can still check for typos or comment improvements.
5-
6-
When editing `.ql` and `.qll` files:
7-
* All edited `.ql` and `.qll` files should be autoformatted afterwards using the CodeQL CLI.
8-
* To install and use the CodeQL CLI autoformatter:
9-
1. Download and extract CodeQL CLI: `cd /tmp && curl -L -o codeql-linux64.zip https://github.com/github/codeql-cli-binaries/releases/latest/download/codeql-linux64.zip && unzip -q codeql-linux64.zip`
10-
2. Add to PATH: `export PATH="/tmp/codeql:$PATH"`
11-
3. Run autoformatter: `codeql query format [file] --in-place`

MODULE.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ use_repo(
230230
"kotlin-compiler-2.1.0-Beta1",
231231
"kotlin-compiler-2.1.20-Beta1",
232232
"kotlin-compiler-2.2.0-Beta1",
233+
"kotlin-compiler-2.2.20-Beta1",
233234
"kotlin-compiler-embeddable-1.6.0",
234235
"kotlin-compiler-embeddable-1.6.20",
235236
"kotlin-compiler-embeddable-1.7.0",
@@ -242,6 +243,7 @@ use_repo(
242243
"kotlin-compiler-embeddable-2.1.0-Beta1",
243244
"kotlin-compiler-embeddable-2.1.20-Beta1",
244245
"kotlin-compiler-embeddable-2.2.0-Beta1",
246+
"kotlin-compiler-embeddable-2.2.20-Beta1",
245247
"kotlin-stdlib-1.6.0",
246248
"kotlin-stdlib-1.6.20",
247249
"kotlin-stdlib-1.7.0",
@@ -254,6 +256,7 @@ use_repo(
254256
"kotlin-stdlib-2.1.0-Beta1",
255257
"kotlin-stdlib-2.1.20-Beta1",
256258
"kotlin-stdlib-2.2.0-Beta1",
259+
"kotlin-stdlib-2.2.20-Beta1",
257260
)
258261

259262
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")

docs/codeql/reusables/supported-versions-compilers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Java,"Java 7 to 24 [6]_","javac (OpenJDK and Oracle JDK),
2222

2323
Eclipse compiler for Java (ECJ) [7]_",``.java``
24-
Kotlin,"Kotlin 1.6.0 to 2.2.0\ *x*","kotlinc",``.kt``
24+
Kotlin,"Kotlin 1.6.0 to 2.2.2\ *x*","kotlinc",``.kt``
2525
JavaScript,ECMAScript 2022 or lower,Not applicable,"``.js``, ``.jsx``, ``.mjs``, ``.es``, ``.es6``, ``.htm``, ``.html``, ``.xhtm``, ``.xhtml``, ``.vue``, ``.hbs``, ``.ejs``, ``.njk``, ``.json``, ``.yaml``, ``.yml``, ``.raml``, ``.xml`` [8]_"
2626
Python [9]_,"2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13",Not applicable,``.py``
2727
Ruby [10]_,"up to 3.3",Not applicable,"``.rb``, ``.erb``, ``.gemspec``, ``Gemfile``"

java/kotlin-extractor/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ kt_javac_options(
8383
"kotlin.RequiresOptIn",
8484
"org.jetbrains.kotlin.ir.symbols.%s" %
8585
("IrSymbolInternals" if version_less(v, "2.0.0") else "UnsafeDuringIrConstructionAPI"),
86-
],
86+
] + ([] if version_less(v, "2.2.20") else ["org.jetbrains.kotlin.DeprecatedForRemovalCompilerApi"]),
8787
x_suppress_version_warnings = True,
8888
),
8989
# * extractor.name is different for each version, so we need to put it in different output dirs
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:1a244757dd8d015ca84f60acf37b9d2a1db094e5f340137f7a193eb697a2e2ab
3+
size 58137156
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:c537c05d90415d0c105b66910374f74cdfe513c29b4aefb0bd492bb82e0310c2
3+
size 56700664
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:248ffeafe6b539c0409c4781d506d15fc4b058a2ba4ebdbd65c051fe32bde9e0
3+
size 1760046

java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import org.jetbrains.kotlin.load.java.JvmAbi
3737
import org.jetbrains.kotlin.load.java.sources.JavaSourceElement
3838
import org.jetbrains.kotlin.load.java.structure.*
3939
import org.jetbrains.kotlin.load.java.typeEnhancement.hasEnhancedNullability
40-
import org.jetbrains.kotlin.load.kotlin.getJvmModuleNameForDeserializedDescriptor
4140
import org.jetbrains.kotlin.name.FqName
4241
import org.jetbrains.kotlin.name.NameUtils
4342
import org.jetbrains.kotlin.name.SpecialNames
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.github.codeql.utils.versions
2+
3+
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
4+
import org.jetbrains.kotlin.load.kotlin.getJvmModuleNameForDeserializedDescriptor
5+
6+
fun getJvmModuleNameForDeserializedDescriptor(descriptor: CallableMemberDescriptor): String? {
7+
return org.jetbrains.kotlin.load.kotlin.getJvmModuleNameForDeserializedDescriptor(descriptor)
8+
}
9+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.github.codeql.utils.versions
2+
3+
import org.jetbrains.kotlin.descriptors.*
4+
import org.jetbrains.kotlin.load.kotlin.JvmPackagePartSource
5+
import org.jetbrains.kotlin.metadata.deserialization.*
6+
import org.jetbrains.kotlin.metadata.jvm.deserialization.*
7+
import org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf
8+
import org.jetbrains.kotlin.resolve.DescriptorUtils.*
9+
import org.jetbrains.kotlin.serialization.deserialization.descriptors.*
10+
11+
fun getJvmModuleNameForDeserializedDescriptor(descriptor: CallableMemberDescriptor): String? {
12+
val parent = getParentOfType(descriptor, ClassOrPackageFragmentDescriptor::class.java, false)
13+
14+
when {
15+
parent is DeserializedClassDescriptor -> {
16+
val classProto = parent.classProto
17+
val nameResolver = parent.c.nameResolver
18+
return classProto.getExtensionOrNull(JvmProtoBuf.classModuleName)
19+
?.let(nameResolver::getString)
20+
?: JvmProtoBufUtil.DEFAULT_MODULE_NAME
21+
}
22+
descriptor is DeserializedMemberDescriptor -> {
23+
val source = descriptor.containerSource
24+
if (source is JvmPackagePartSource) {
25+
return source.moduleName
26+
}
27+
}
28+
}
29+
30+
return null
31+
}
32+

0 commit comments

Comments
 (0)