Kotlin / Kotlin/dukat

Interface member vs inline extension member (strange behaviour)

Open
#83 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
591
Forks
40
PR merge metrics
No merged PRs in 30d

Description

I observe strange behavior. Localized as much as I could.
Check this -> [issue83.zip](https://github.com/Kotlin/dukat/files/3460986/issue83.zip)

To reproduce:
1. run `dukat application.d.ts`
2. check files `nativescript-error.kt` and `tns-core-modules.kt`. You'll find such extension property and function there:
```kotlin
// nativescript-error.kt
// ...
inline var NativeScriptError.someProp: Any get() = this.asDynamic().someProp; set(value) { this.asDynamic().someProp = value }
```
```kotlin
// tns-core-modules.kt
// ...
inline fun Body.formData(): Promise { return this.asDynamic().formData() }
```
3. Remove something from file `application.d.ts`. For example, lines 21-23 with comment.
4. Check file `tns-core-modules.kt`. Instead of a function there will be an interface
```kotlin
// tns-core-modules.kt
// ...
external interface Body {
fun formData(): Promise
}
```

You can experiment and delete other lines in files to understand what this behavior depends on. Personally, I do not understand this. 😄 (reference paths, comments, amount of lines in files...)

Other notice. When such `inline fun` or` inline var` appear, interfaces, which those members extends, disappear (so they extend nonexistent interfaces).

And one more notice. Such members are located in the same file with `external` declarations. It is not useful, because I often add to this file `@file:JsModule()` declaration.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the attached issue83.zip and application.d.ts, run `dukat application.d.ts`, and compare nativescript-error.kt and tns-core-modules.kt before and after removing lines 21–23. Trace why generated inline members replace or remove interface members, then verify generation is stable and interfaces remain valid, including external declarations in the same file.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin, typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.