[Chapel Merge] Add a primitive "get visible symbols" that prints

Branch: refs/heads/master
Revision: 0dcc6e5
Author: daviditen
Log Message:

Merge pull request #16267 from daviditen/print-visible

Add a primitive “get visible symbols” that prints visible symbols

[reviewed by @lydia-duncan]

Add a primitive that prints the symbols visible from the point where it is
called. The primitive is handled near the end of scopeResolve and is then
removed.

To build the list of visible symbols, walk over all gVarSymbols, gFnSymbols,
and gTypeSymbols and try to lookup() them from the primitive call site. Build
a map from filename to set of symbols and add the visible ones to the set.
Then walk the map and its sets to sort and print all visible symbols grouped
by filename.

The primitive can also have an argument ignoreInternalModules that defaults
to true. If used it must use named argument passing and have a literal true or
false value.

Add tests of the primitive and the errors it can issue when misused.

Modified Files:
A test/trivial/diten/printVisibleConflict.chpl
A test/trivial/diten/printVisibleConflict.compopts
A test/trivial/diten/printVisibleConflict.good
A test/trivial/diten/printvisible.chpl
A test/trivial/diten/printvisible.compopts
A test/trivial/diten/printvisible.good
A test/trivial/diten/printvisibleExtraArg.chpl
A test/trivial/diten/printvisibleExtraArg.good
A test/trivial/diten/printvisibleOptFalse.chpl
A test/trivial/diten/printvisibleOptFalse.compopts
A test/trivial/diten/printvisibleOptFalse.good
A test/trivial/diten/printvisibleOptFalse.prediff
A test/trivial/diten/printvisibleOptTrue.chpl
A test/trivial/diten/printvisibleOptTrue.compopts
A test/trivial/diten/printvisibleOptTrue.good
A test/trivial/diten/printvisibleWrongName.chpl
A test/trivial/diten/printvisibleWrongName.good
A test/trivial/diten/printvisibleWrongValue.chpl
A test/trivial/diten/printvisibleWrongValue.good
A test/visibility/private/variables/accessSiblingPrint.chpl
A test/visibility/private/variables/accessSiblingPrint.compopts
A test/visibility/private/variables/accessSiblingPrint.good
A test/visibility/private/variables/privateToParentPrint.chpl
A test/visibility/private/variables/privateToParentPrint.compopts
A test/visibility/private/variables/privateToParentPrint.good
M compiler/AST/primitive.cpp
M compiler/include/primitive_list.h
M compiler/include/scopeResolve.h
M compiler/passes/scopeResolve.cpp

Compare: https://github.com/chapel-lang/chapel/compare/2c95b3a11187...0dcc6e59f7b1