Kotlin / Kotlin/dukat

Generated equals may not override `Any#equals`

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

Description

Some libraries, in this case `js-joda`, declare their equals methods as taking (TypeScript) `any`. This results in the Kotlin stub function `override fun equals(other: Any): Boolean`, however this doesn't actually override `Any#equals` which is defined as nullable: `fun equals(other: Any?): Boolean`. I think the correct behavior here would be to emit `other: Any?` in the stub, since TypeScript's `any` type may be null/undefined as well.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how TypeScript `any` is mapped to Kotlin parameter types and where generated `equals` declarations are emitted. Reproduce the conversion for the `js-joda` declarations, then verify that the generated signature uses nullable `Any?` and correctly overrides Kotlin `Any#equals`.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.