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

Window cannot extends Window #131

Open
GarouDan opened this issue Jun 2, 2016 · 1 comment
Open

Window cannot extends Window #131

GarouDan opened this issue Jun 2, 2016 · 1 comment

Comments

@GarouDan
Copy link

GarouDan commented Jun 2, 2016

When we try to extend the jsweet.dom.Window like this

import jsweet.dom.Window;

public class Window extends Window {
}

we got this error:

Description Resource Path Location Type
Cycle detected: the type Window cannot extend/implement itself or one of its own member types Window.java .../controller line 5 Java Problem

But this code works:

import jsweet.dom.Window;

public class Window2 extends Window {
}

So we can't use the same name. But this is strange since we are on a different packages.
I saw the jsweet.dom.Window code and maybe this happens because it has another properties with the type Window. But I think we should be able to extend as in the first example.

Is this a bug?

@renaudpawlak
Copy link
Contributor

Thank you for reporting this issue. It has to do with how JSweet and TypeScript work, so it is not really a JSweet bug (at least it is shared responsibilities).

At runtime, the Window class, which is part of the JavaScript DOM, is not actually in the jsweet.dom package. This package is here for Java naming and referencing purpose at compile time, but it is erased by JSweet and don't exist at runtime (note also that def.libname packages in candies have no runtime existence).

Additionally, in TypeScript, there is no easy way to reference a global element when it is hidden by a local element (see this complicated TypeScript issue: microsoft/TypeScript#983).

We could do a fix, indeed (I see how), but it would be quite complicated for what it would bring. So far I will not assign it for any milestone because it is not a crucial issue, but I will keep it in mind for later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants