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

Python: return a subclass of a known class implementing an interface #976

Closed
1 of 4 tasks
eladb opened this issue Nov 12, 2019 · 0 comments · Fixed by #980
Closed
1 of 4 tasks

Python: return a subclass of a known class implementing an interface #976

eladb opened this issue Nov 12, 2019 · 0 comments · Fixed by #980
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@eladb
Copy link
Contributor

eladb commented Nov 12, 2019

🐛 Bug Report

Affected Languages

  • TypeScript or Javascript
  • Python
  • Java
  • .NET (C#, F#, ...)

General Information

  • JSII Version: 0.20.4

What is the problem?

export interface IReturn {
  readonly foo: number;
}

export class Base {
}

export class SomeType {
  static returnReturn(): IReturn {
    class Derived extends Base implements IReturn {
      foo: 333
    }
  }
}

When calling SomeTime.return_return() from Python, the returned object will be Base instead of IReturn.

See aws/aws-cdk#4966

@eladb eladb added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 12, 2019
eladb pushed a commit that referenced this issue Nov 13, 2019
- implement the test for #976 in Java and .NET (PASSED)
- port `canLeverageIndirectInterfacePolymorphsm` to python (PASSED)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant