[DSLX:cleanup] Remove ConstantArray node from AST, it is misleading / not useful. #1753
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously
ConstantArray
was trying to convey some type-system-level properties as imbued in an AST node, but it was not fully accurate, and generally only served to confuse things. This gets us back to where the AST just represents the parsed syntax and the typechecker figures out constexpr properties and annotates them in the type information. This also allows us to seal up the Array AST node as final — subclassing of AST nodes can be awkward, we generally use hierarchy in the AST very sparingly.This reworks the deduce routine a bit to consolidate on the main discrepancy that was there between Arrays and ConstArrays, which was that we would, for user convenience, annotate the element type on any un-annotated numerical literals contained within the array. This will become better and more general will type inference 2.0 but until that comes we want to make sure we don’t have to change code in a sprawling way.
Just trying to tighten up invariants in advance of somebody investigating #1748