Also, the following would be an error, even though the two are naturally dual:

record Foo(int x) { }

Foo f = new Foo(aShort);

if (f instanceof Foo(short x)) { ... }  // would be an error without `short x` applicable to int



On 4/15/2022 6:25 PM, Brian Goetz wrote:

    ​
    Can you provides examples of such refactorings ?


Refactoring

    int x = aShort;
    foo(x, x);

to

    let int x = aShort
    in foo(x, x);


Reply via email to