-
Notifications
You must be signed in to change notification settings - Fork 245
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
Check that there are not static and non-static members with the same name #427
Comments
Yes, it's definitely allowed in TypeScript. I ran into this doing the rename of all L1 classes to add the |
While we're at it, we should guard against having statics with the same name as a class we're inheriting from. |
Okay I'm not sure about the second one actually. Java allows this: class Henk {
public static void henk() {
System.out.println("Inherited henk");
}
}
class Main extends Henk {
public static void main(String[] args) {
Main.henk();
}
} C# does too: using System;
class Henk {
public static void henk() {
Console.WriteLine ("Inherited Henk");
}
}
class MainClass : Henk {
public static void Main (string[] args) {
MainClass.henk();
}
} Works the same in TypeScript: class Henk {
public static henk() {
console.log('Inherited henk');
}
}
class Main extends Henk {
}
Main.henk(); I don't see any problem. |
This is not allowed in Java, and leads to compiler warnings in C#. Fixes #427.
It's definitely not allowed in Java, but probably is allowed in TypeScript, so jsii should guard against it.
The text was updated successfully, but these errors were encountered: