[Chapel Merge] Solve two internal errors with importing and super

Branch: refs/heads/main
Revision: 182f103
Author: lydia-duncan
Link: Solve two internal errors with importing and super/this by lydia-duncan · Pull Request #19662 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #19662 from lydia-duncan/internalErrorImport

Solve two internal errors with importing and super/this
[reviewed by @mppf]

Resolves #18732

Before, we were halting inside the compiler when an import statement contained
multiple "this" or "super" but no other names. import super.super; etc should
be valid, while import super.this is not really better than import super;
but shouldn't be a problem to support. Both of these were blocked by two
INT_FATALs in the compiler, so remove those cases and add a warning when an
import statement starts with "super.this" or "this.this".

Note: doesn't generate the warning in all cases we would like. Only detects if
super.this or this.this is the start of the path and will not warn for the middle or
end. I still believe this is better than before (and such cases would have failed to
compile before, despite being valid, if overly verbose). I had initially tried to get
the warning for all cases by modifying the use statement, but I was performing the
modification incorrectly so it didn't work.

Adds tests locking in the new behavior:

  • super.this
  • this.this
  • super.this.super
  • super.super.this - doesn't generate the warning yet, see #19661
  • super.super.this.this - doesn't generate the warning yet, see #19661

Updates two tests to include the new warning. These additions seemed appropriate,
especially since the tests had "error" in their name (but didn't warn before)

Passed a full paratest with futures.

Modified Files:
A test/visibility/import/superImport/superSuper.chpl

A test/visibility/import/superImport/superSuper.good
A test/visibility/import/superImport/superSuperThisThisWarning.bad
A test/visibility/import/superImport/superSuperThisThisWarning.chpl
A test/visibility/import/superImport/superSuperThisThisWarning.future
A test/visibility/import/superImport/superSuperThisThisWarning.good
A test/visibility/import/superImport/superSuperThisWarning.bad
A test/visibility/import/superImport/superSuperThisWarning.chpl
A test/visibility/import/superImport/superSuperThisWarning.future
A test/visibility/import/superImport/superSuperThisWarning.good
A test/visibility/import/superImport/superThisSuper.chpl
A test/visibility/import/superImport/superThisSuper.good
A test/visibility/import/superImport/superThisWarning.chpl
A test/visibility/import/superImport/superThisWarning.good
M compiler/passes/ResolveScope.cpp
M test/visibility/import/relative/import-relative-error2.good
M test/visibility/relative-use/use-relative-error2.good

Compare: https://github.com/chapel-lang/chapel/compare/96c92bf66a25...182f1035d759