Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imported entities name clash lead to override errors #315

Closed
Schahen opened this issue Jun 23, 2020 · 0 comments
Closed

Imported entities name clash lead to override errors #315

Schahen opened this issue Jun 23, 2020 · 0 comments
Labels
compilation-failure kotlin code is generated but this code fails to be compiled
Milestone

Comments

@Schahen
Copy link
Contributor

Schahen commented Jun 23, 2020

Consider following code:
core.d.ts:

declare namespace Core {
    interface SomeEvent {}

    interface SomeDomain {
        add(evt: SomeEvent);
    }
}

events.d.ts:

declare module "myevents" {
    export interface SomeEvent extends Core.SomeEvent {}
}

index.d.ts:

/// <reference path="./core.d.ts" />
/// <reference path="./events.d.ts" />

declare module "mydomain" {
    import {SomeEvent} from "myevents";

    class MyDomain implements Core.SomeDomain {
        add(evt: SomeEvent); 
    }
}

After translation we end up with following MyDomain definition:

package mydomain

import myevents.SomeEvent
import Core.SomeDomain

external open class MyDomain : SomeDomain {
    open fun add(evt: SomeEvent)
    override fun add(evt: SomeEvent)
}

which won't compile because:

out/index.mydomain.module_node_3_minimal.kt:23:15: error: class 'MyDomain' is not abstract and does not implement abstract member public abstract fun add(evt: SomeEvent): Unit defined in Core.SomeDomain
external open class MyDomain : SomeDomain {
              ^
out/index.mydomain.module_node_3_minimal.kt:25:5: error: 'add' overrides nothing
    override fun add(evt: SomeEvent)

Here's what's happening here - SomeEvent from "events" and SomeEvent from core are actually clashing.

@Schahen Schahen added the compilation-failure kotlin code is generated but this code fails to be compiled label Jun 23, 2020
@Schahen Schahen added this to the 0.5.4 milestone Jun 23, 2020
@Schahen Schahen changed the title Imported entities name clash lead to overrider errors Imported entities name clash lead to override errors Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compilation-failure kotlin code is generated but this code fails to be compiled
Projects
None yet
Development

No branches or pull requests

1 participant