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

Child interface should redeclare ambiguous parent member #269

Closed
Schahen opened this issue Apr 27, 2020 · 1 comment
Closed

Child interface should redeclare ambiguous parent member #269

Schahen opened this issue Apr 27, 2020 · 1 comment
Labels
compilation-failure kotlin code is generated but this code fails to be compiled domain:override missing overrides, redundant overrides, duplicate overrides etc. kotlin-design limitations due to the design of kotlin language
Milestone

Comments

@Schahen
Copy link
Contributor

Schahen commented Apr 27, 2020

The interface DuplexOptions from this snippet of code:

interface InputOptions {
  highWaterMark?: number;
  encoding?: string;
  objectMode?: boolean;
}

interface OutputOptions {
  highWaterMark?: number;
  decodeStrings?: boolean;
  objectMode?: boolean;
  defaultEncoding?: string;
}

interface DuplexOptions extends InputOptions, OutputOptions {
}

Is compiled to following kotlin code

external interface DuplexOptions : InputOptions, OutputOptions

However it actually should explicitly redeclare highWaterMark and objectMode, otherwise one get:

class 'DuplexOptions' must override public open var highWaterMark: Number? defined in InputOptions because it inherits multiple interface methods of it
@Schahen Schahen added compilation-failure kotlin code is generated but this code fails to be compiled kotlin-design limitations due to the design of kotlin language labels Apr 27, 2020
@Schahen
Copy link
Contributor Author

Schahen commented Apr 27, 2020

I've just realised that nullable are translated similar which seems to me questionable:

interface InputOptions {
  a: number | undefined;
}

will become:

external interface InputOptions {
    var a: Number?
        get() = definedExternally
        set(value) = definedExternally
}

@Schahen Schahen added the domain:override missing overrides, redundant overrides, duplicate overrides etc. label May 13, 2020
@Schahen Schahen added this to the 0.5.4 milestone Jun 23, 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 domain:override missing overrides, redundant overrides, duplicate overrides etc. kotlin-design limitations due to the design of kotlin language
Projects
None yet
Development

No branches or pull requests

1 participant