[External] : Re: Evolving past reference type patterns

Brian Goetz brian.goetz at oracle.com
Fri Apr 15 22:27:25 UTC 2022


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);
>
>


More information about the amber-spec-observers mailing list