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

Matching constructor parameter name and member variable name leads to invalid code #72

Open
erikkaplun opened this issue Nov 20, 2013 · 0 comments

Comments

@erikkaplun
Copy link

this:

class Foo {
    private int bar;
    public Foo(int bar) {
        this.bar = bar * 2; // ok in Java
    }
}

gets converted to:

class Foo(bar: Int) {
    private val bar = bar * 2 // compiler complains that recursive val requires type
}

Should be handled for example by prefixing the member variable with _ perhaps; or the other way around, especially when the member variable is public and naming matters.

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

1 participant