[Chapel Merge] Move typeExpr/initExpr to Formal/Variable Decl

Branch: refs/heads/master
Revision: c95d6a9
Author: mppf
Log Message:

Merge pull request #17740 from mppf/move-type-init-to-decl

Move typeExpr/initExpr to Formal/Variable Decl

This PR changes the typeExpr and initExpr for Formal and Variable to be
stored in the FormalDecl or VariableDecl rather than in the Sym.

There are three reasons for this.

First, the previous strategy was intended to preserve a property that all
Decls will have just one child. That's no longer true now that we have
MultiDecl (and we will soon also have TupleDecl).

Second, when we assign IDs to Symbols, we do that in a different manner
for Syms vs Expressions. Syms are named with the symbol name but
Expressions just get a postorder traversal integer within the parent Sym.
I'd like scope-resolution to be able to use these IDs in a natural
manner. So, I'd like only those Syms that create a new scope to contain
children. (E.g. Function creates a scope for the formals and body; but
Variable does not introduce a new scope). So it is more natural for the
VariableDecl/FormalDecl to contain the typeExpr/initExpr.

Third, storing the typeExpr/initExpr in the FormalDecl/VariableDecl was
requested by a reviewer in earlier discussions.

Reviewed by @lydia-duncan - thanks!

Modified Files:
M compiler/next/include/chpl/uast/ASTClassesList.h

M compiler/next/include/chpl/uast/Formal.h
M compiler/next/include/chpl/uast/FormalDecl.h
M compiler/next/include/chpl/uast/SymDecl.h
M compiler/next/include/chpl/uast/Variable.h
M compiler/next/include/chpl/uast/VariableDecl.h
M compiler/next/lib/uast/Builder.cpp
M compiler/next/lib/uast/Formal.cpp
M compiler/next/lib/uast/FormalDecl.cpp
M compiler/next/lib/uast/Variable.cpp
M compiler/next/lib/uast/VariableDecl.cpp
M compiler/next/test/frontend/testParseFunctions.cpp

Compare: https://github.com/chapel-lang/chapel/compare/7cc7fae9dbe0...c95d6a9e204e