Kotlin: Fix extraction of `$default` extension functions

This commit is contained in:
Tamas Vajk 2022-12-07 10:09:37 +01:00
Родитель 43f23801f5
Коммит 6457e059f5
3 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -975,6 +975,10 @@ open class KotlinFileExtractor(
val methodId = id.cast<DbMethod>()
extractMethod(methodId, locId, shortName, erase(f.returnType), paramsSignature, parentId, methodId, origin = null, extractTypeAccess = extractMethodAndParameterTypeAccesses)
addModifiers(id, "static")
if (extReceiver != null) {
val extendedType = allParamTypeResults[0] // TODO: this is not correct for member extension methods, where the dispatch receiver is the first parameter
tw.writeKtExtensionFunctions(methodId, extendedType.javaResult.id, extendedType.kotlinResult.id)
}
}
tw.writeHasLocation(id, locId)
if (f.visibility != DescriptorVisibilities.PRIVATE && f.visibility != DescriptorVisibilities.PRIVATE_TO_THIS) {

Просмотреть файл

@ -306,10 +306,10 @@
| methods3.kt:3:1:3:49 | fooBarTopLevelMethodExt(...) | MethodAccess |
| methods3.kt:3:1:3:49 | int | TypeAccess |
| methods3.kt:3:1:3:49 | int | TypeAccess |
| methods3.kt:3:1:3:49 | p0 | VarAccess |
| methods3.kt:3:1:3:49 | p1 | VarAccess |
| methods3.kt:3:1:3:49 | p1 | VarAccess |
| methods3.kt:3:1:3:49 | p2 | VarAccess |
| methods3.kt:3:1:3:49 | this | ExtensionReceiverAccess |
| methods3.kt:3:5:3:10 | String | TypeAccess |
| methods3.kt:3:36:3:45 | int | TypeAccess |
| methods3.kt:3:45:3:45 | 1 | IntegerLiteral |
@ -326,11 +326,11 @@
| methods3.kt:6:5:6:45 | fooBarMethodExt(...) | MethodAccess |
| methods3.kt:6:5:6:45 | int | TypeAccess |
| methods3.kt:6:5:6:45 | int | TypeAccess |
| methods3.kt:6:5:6:45 | p0 | VarAccess |
| methods3.kt:6:5:6:45 | p1 | VarAccess |
| methods3.kt:6:5:6:45 | p2 | VarAccess |
| methods3.kt:6:5:6:45 | p2 | VarAccess |
| methods3.kt:6:5:6:45 | p3 | VarAccess |
| methods3.kt:6:5:6:45 | this | ExtensionReceiverAccess |
| methods3.kt:6:9:6:14 | String | TypeAccess |
| methods3.kt:6:32:6:41 | int | TypeAccess |
| methods3.kt:6:41:6:41 | 1 | IntegerLiteral |

Просмотреть файл

@ -77,8 +77,8 @@ constructors
| methods.kt:5:1:20:1 | Class | methods.kt:5:1:20:1 | Class | Class() |
extensions
| methods3.kt:3:1:3:49 | fooBarTopLevelMethodExt | file:///modules/java.base/java/lang/String.class:0:0:0:0 | String |
| methods3.kt:3:1:3:49 | fooBarTopLevelMethodExt$default | file:///modules/java.base/java/lang/String.class:0:0:0:0 | String |
| methods3.kt:6:5:6:45 | fooBarMethodExt | file:///modules/java.base/java/lang/String.class:0:0:0:0 | String |
| methods3.kt:6:5:6:45 | fooBarMethodExt$default | file:///modules/java.base/java/lang/String.class:0:0:0:0 | String |
| methods5.kt:9:3:9:32 | f1 | file:///!unknown-binary-location/foo/bar/C1.class:0:0:0:0 | C1<T1> |
extensionsMismatch
| methods3.kt:3:1:3:49 | fooBarTopLevelMethodExt | methods3.kt:3:1:3:49 | fooBarTopLevelMethodExt$default |
| methods3.kt:6:5:6:45 | fooBarMethodExt | methods3.kt:6:5:6:45 | fooBarMethodExt$default |