[Chapel Merge] Fix bug where public/private use and import statem

Branch: refs/heads/main
Revision: 2b23102
Author: lydia-duncan
Link: Fix bug where public/private use and import statements impacted documentation by lydia-duncan · Pull Request #20285 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #20285 from lydia-duncan/chpldocImportComment

Fix bug where public/private use and import statements impacted documentation
[reviewed by @arezaii]

Prior to this change, in the new parser public and private use and
import statements were accidentally impacting the detected started
location of symbols declared immediately after them. This caused the
documentation comments attached to those symbols to be dropped on
the floor, impacting symbols such as:

  • BlockDim
  • iomode
    and others declared at the beginning of each documentation page.

Resolves #20005

In more detail, this was because public and private would make the
ParserContext explicitly update its tracked location. However, no part
of the use or import statement production would clear the location
information afterwards, which meant that it did not get updated for the
next declared symbol. This change adds calls to clear the location after
the operations on the import and use statements have been

Removes the .bad and .future file on the test added to track this issue.
Also adds versions of the test for explicitly public use statements,
default visibility import statements, except and only clauses and
those combinations with renaming.

With the parser changes, these tests all pass (though only the public
use one failed without the change). Also passed a full paratest with

Modified Files:
A test/chpldoc/functions/importBeforeFunc.doc.catfiles

A test/chpldoc/functions/importBeforeFunc.doc.chpl
A test/chpldoc/functions/importBeforeFunc.doc.good
A test/chpldoc/functions/publicUseBeforeFunc.doc.catfiles
A test/chpldoc/functions/publicUseBeforeFunc.doc.chpl
A test/chpldoc/functions/publicUseBeforeFunc.doc.good
A test/chpldoc/functions/useExceptBeforeFunc.doc.catfiles
A test/chpldoc/functions/useExceptBeforeFunc.doc.chpl
A test/chpldoc/functions/useExceptBeforeFunc.doc.good
A test/chpldoc/functions/useExceptRenameBeforeFunc.doc.catfiles
A test/chpldoc/functions/useExceptRenameBeforeFunc.doc.chpl
A test/chpldoc/functions/useExceptRenameBeforeFunc.doc.good
A test/chpldoc/functions/useOnlyBeforeFunc.doc.catfiles
A test/chpldoc/functions/useOnlyBeforeFunc.doc.chpl
A test/chpldoc/functions/useOnlyBeforeFunc.doc.good
A test/chpldoc/functions/useOnlyRenameBeforeFunc.doc.catfiles
A test/chpldoc/functions/useOnlyRenameBeforeFunc.doc.chpl
A test/chpldoc/functions/useOnlyRenameBeforeFunc.doc.good
R test/chpldoc/functions/privateUseBug.doc.bad
R test/chpldoc/functions/privateUseBug.doc.future
M compiler/dyno/lib/parsing/bison-chpl-lib.cpp
M compiler/dyno/lib/parsing/bison-chpl-lib.h
M compiler/dyno/lib/parsing/chpl.ypp

Compare: https://github.com/chapel-lang/chapel/compare/a2c705358757...2b231023583b