Integrated: 8332725: Binding patterns with inferred type have erroneous node in the AST
Jan Lahoda
jlahoda at openjdk.org
Thu May 30 06:04:12 UTC 2024
On Thu, 23 May 2024 06:25:19 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
> For local variable type inference, javac will set a synthetic type tree/AST for the variable. I.e. having `var v = 0;`, javac will set synthetic `int` to `JCVariableDecl.vartype`.
>
> For binding patterns, this is not done. I.e. having `R(var v)`, the `vartype` in the `JCVariableDecl` inside the binding pattern will not be set. If `Attr.preFlow` or `Attr.postAttr` is called, the missing `vartype` will be set of an erroneous tree node, despite the original code being valid.
>
> The proposal in this PR is to simply set the synthetic type tree, as is done for other cases where `var` is used.
This pull request has now been integrated.
Changeset: 66d9bfce
Author: Jan Lahoda <jlahoda at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/66d9bfce2909c26ad094d5a38c4a9aaa176e8faa
Stats: 93 lines in 2 files changed: 93 ins; 0 del; 0 mod
8332725: Binding patterns with inferred type have erroneous node in the AST
Reviewed-by: asotona
-------------
PR: https://git.openjdk.org/jdk/pull/19357
More information about the compiler-dev
mailing list