Kotlin / Kotlin/dukat

Use fully qualified names when needed

Open
#32 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

translation-failure
Dominant language
Kotlin
Stars
591
Forks
40
PR merge metrics
No merged PRs in 30d

Description

Let's say we have following declarations:

/// <reference path="_referenced.d.ts" />

declare interface SomeStaticAPI {
  (ping: SomeNamespace.Initializable): boolean
}

and in _referenced.d.ts suppose we have

declare namespace SomeNamespace {
  interface Initializable {}
}

What happens
We'll get

external interface SomeStaticAPI {
    @nativeInvoke
    operator fun invoke(ping: SomeNamespace.Initializable): Boolean
}

So far so good, however this won't compile if we set explicitely qualified package name, since actually we should resolve to this:

package org.jetbrains.declaration.SomeNamespace

declare namespace SomeNamespace {
  interface Initializable {}
}

package org.jetbrains.declaration

declare interface SomeStaticAPI {
  (ping: org.jetbrains.declaration.SomeNamespace.Initializable): boolean
}

now it's not the case and many real-life scenarios are actually ruined by this.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the declarations in the issue as a minimal reproduction, then trace how SomeNamespace.Initializable is resolved when an explicit package is configured. Done means SomeStaticAPI refers to org.jetbrains.declaration.SomeNamespace.Initializable and the generated Kotlin declarations compile.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin, typescript
Domain
compilers, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.