CLS: display auto-computed instantiations for procedures that are only generic because of array formals#28502
Open
DanilaFe wants to merge 12 commits intochapel-lang:mainfrom
Open
CLS: display auto-computed instantiations for procedures that are only generic because of array formals#28502DanilaFe wants to merge 12 commits intochapel-lang:mainfrom
DanilaFe wants to merge 12 commits intochapel-lang:mainfrom
Conversation
Signed-off-by: Danila Fedorin <[email protected]>
Signed-off-by: Danila Fedorin <[email protected]>
Signed-off-by: Danila Fedorin <[email protected]>
Signed-off-by: Danila Fedorin <[email protected]>
Signed-off-by: Danila Fedorin <[email protected]>
Signed-off-by: Danila Fedorin <[email protected]>
Signed-off-by: Danila Fedorin <[email protected]>
Signed-off-by: Danila Fedorin <[email protected]>
Signed-off-by: Danila Fedorin <[email protected]>
Signed-off-by: Danila Fedorin <[email protected]>
Signed-off-by: Danila Fedorin <[email protected]>
Signed-off-by: Danila Fedorin <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR stemmed from my attempt to use CLS with the Mason codebase.
The main trouble with the mason codebase is that nearly every module is written in terms of a main (not
main) function that just accepts the CLI arguments for the sub-command, likemasonUpdate([] string). The trouble with functions like this is that under the current semantics of Chapel, they are generic. Without any calls to instantiate them1, they are left entirely generic and no useful information is shown in the editor.This PR improves on this situation by detecting procedures that are only generic due to their array formals, and computed an instantiation of these procedures with the generic formals instantiated with default-rectangular array types. This works as follows:
[] eltType, which can be any rank, we arbitrarily pick a rank of 1, and compute a one-dimensional default-rectangular domain with which to create the array. This is handled bycomputeDefaultBoundedRange,computeDefaultRectangularDomain, andcomputeDefaultRectangularArray.rebuildDomainInstanceandcomputeDefaultRectangularArray.The result:
Footnotes
Technically, the main procedure from Mason calls the functions and instantiates them. However, two pieces are missing for that to be reflected in CLS: for one, cross-file instantiations are not collected, and for another, we'd still need to default-instantiate the
mainproc with a one-dimensional, default-rectangular array of strings. ↩