https://github.com/mendess/jscodegenbugrepro
A reproduction of a kotlin/js bug
https://github.com/mendess/jscodegenbugrepro
Last synced: 2 months ago
JSON representation
A reproduction of a kotlin/js bug
- Host: GitHub
- URL: https://github.com/mendess/jscodegenbugrepro
- Owner: mendess
- License: mit
- Created: 2022-05-20T09:52:39.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-09-01T17:36:03.000Z (almost 3 years ago)
- Last Synced: 2025-02-08T22:46:28.666Z (4 months ago)
- Language: Kotlin
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kotlin/Js codegen bug
### Kotlin Version: 1.6.20
### Kotlin/JS compiler: IRThis is a minimal reproduction of the bug. The bug arises from extending an
abstract class defined in a kt mp library, that has a method with a **defaulted**
parameter.The extending class, if it is defined in JS land, will not work when called by
the kt library, as the kt library will try to call the mangled method on this
"native" type which does not exist.Note that this only affects classes defined outside the ktmp library. Classes
defined in the library, always work, both when instanciated outside the library
and inside.Stack trace:
```typescript
TypeError: this.adapter_1.method_3w4bny_k$ is not a function
at AdapterUser.method (/home/src/commonMain/kotlin/xyz/mendess/Adapter.kt:20:17)
at Object. (/home/work/projects/JsCodeGenBugRepro/example/web/index.ts:14:6)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Module.m._compile (/home/work/projects/JsCodeGenBugRepro/example/web/node_modules/ts-node/src/index.ts:1455:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Object.require.extensions. [as .ts] (/home/work/projects/JsCodeGenBugRepro/example/web/node_modules/ts-node/src/index.ts:1458:12)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:827:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at phase4 (/home/work/projects/JsCodeGenBugRepro/example/web/node_modules/ts-node/src/bin.ts:567:12)
```