More on patterns, generics, null and primitives

Ali Ebrahimi ali.ebrahimi1781 at
Sat Dec 9 04:58:03 UTC 2017


we would infer the type of y from the static type of X, and would most
> likely use the same inference algorithm as we do for locals.  Since
> inference would say "you can't infer the null type", we wouldn't get
> farther.
So with current spec 'null matches var x' would not compile or results in
false? But the last I tried current prototype accept this code.
If we accept this code then we have the following problem:

if( null matches var x || true){

     what is type x here?

If the user said
>     (null instanceof Object x)
There is typo here  (null instanceof Object)? no binding variable here?

it would be a different story, since there's no inference to do.  But null
> instanceof anything already has a defined answer -- no.


Best Regards,
Ali Ebrahimi

More information about the amber-spec-observers mailing list