Branch: refs/heads/main
Revision: a59d902
Author: lydia-duncan
Link: Unavailable
Log Message:
Merge pull request #18677 from lydia-duncan/limitationOperators
Add support for listing operators in limitation clauses
[reviewed by @mppf]
Prior to this work, listing operators in only
, except
or import
clauses
resulted in a syntax error. This change makes it so that operators can
be listed in the only
or except
clause of a use
statement, or in the
list of symbols brought in for unqualified access via an import
statement.
Resolves #17003
As part of this work, we had to fix a couple of bugs. Overload sets were
not accounting for operators properly, which caused issues for the IO
operator, <~>
. Additionally, the handling of except
clauses and methods
did not properly adjust for operators (since operators weren't able to be in
except
clauses), accidentally making it impossible to exclude an operator.
That bug has now been fixed as well.
We also had to remove the parser support for except *
, which was
deprecated last release. Its presence in the parser led to reduce/reduce
conflicts, and since it was already deprecated we just removed parser
support for it. Also removed remaining code in the compiler that handled
it (a case each in UseStmt building and forwarding statement support that
transformed it into only;
- as a result, no further modifications are
necessary).
Added tests for:
- every operator in an
only
list (as the only symbol, as the first symbol,
and as the last symbol listed) - every operator in an
import
list surrounded by{}
(as the only symbol,
as the first symbol, and as the last symbol listed) - every operator as the last name in an
import
statement (e.g.import M.+
) - every operator except
=
in anexcept
list (because we shouldn't write=
overloads outside the type's defining module)
Removes the tests for deprecating except *
(which previously enabled
qualified access only for the listed module).
Passed a full paratest with futures
Modified Files:
A test/classes/forwarding/forwardOp.bad
A test/classes/forwarding/forwardOp.chpl
A test/classes/forwarding/forwardOp.future
A test/classes/forwarding/forwardOp.good
A test/visibility/except/operatorsExceptions/COMPOPTS
A test/visibility/except/operatorsExceptions/DefinesOp.chpl
A test/visibility/except/operatorsExceptions/DefinesOp.notest
A test/visibility/except/operatorsExceptions/PREDIFF
A test/visibility/except/operatorsExceptions/exceptAddition.chpl
A test/visibility/except/operatorsExceptions/exceptAddition.good
A test/visibility/except/operatorsExceptions/exceptAlign.chpl
A test/visibility/except/operatorsExceptions/exceptAlign.good
A test/visibility/except/operatorsExceptions/exceptAnd.chpl
A test/visibility/except/operatorsExceptions/exceptAnd.good
A test/visibility/except/operatorsExceptions/exceptAndEquals.chpl
A test/visibility/except/operatorsExceptions/exceptAndEquals.good
A test/visibility/except/operatorsExceptions/exceptBy.chpl
A test/visibility/except/operatorsExceptions/exceptBy.good
A test/visibility/except/operatorsExceptions/exceptCast.chpl
A test/visibility/except/operatorsExceptions/exceptCast.good
A test/visibility/except/operatorsExceptions/exceptCount.chpl
A test/visibility/except/operatorsExceptions/exceptCount.good
A test/visibility/except/operatorsExceptions/exceptDivideEquals.chpl
A test/visibility/except/operatorsExceptions/exceptDivideEquals.good
A test/visibility/except/operatorsExceptions/exceptDivision.chpl
A test/visibility/except/operatorsExceptions/exceptDivision.good
A test/visibility/except/operatorsExceptions/exceptEquality.chpl
A test/visibility/except/operatorsExceptions/exceptEquality.good
A test/visibility/except/operatorsExceptions/exceptExponent.chpl
A test/visibility/except/operatorsExceptions/exceptExponent.good
A test/visibility/except/operatorsExceptions/exceptExponentEquals.chpl
A test/visibility/except/operatorsExceptions/exceptExponentEquals.good
A test/visibility/except/operatorsExceptions/exceptGreaterThan.chpl
A test/visibility/except/operatorsExceptions/exceptGreaterThan.good
A test/visibility/except/operatorsExceptions/exceptGreaterThanOrEqual.chpl
A test/visibility/except/operatorsExceptions/exceptGreaterThanOrEqual.good
A test/visibility/except/operatorsExceptions/exceptIO.chpl
A test/visibility/except/operatorsExceptions/exceptIO.good
A test/visibility/except/operatorsExceptions/exceptInequality.chpl
A test/visibility/except/operatorsExceptions/exceptInequality.good
A test/visibility/except/operatorsExceptions/exceptLessThan.chpl
A test/visibility/except/operatorsExceptions/exceptLessThan.good
A test/visibility/except/operatorsExceptions/exceptLessThanOrEqual.chpl
A test/visibility/except/operatorsExceptions/exceptLessThanOrEqual.good
A test/visibility/except/operatorsExceptions/exceptMinusEquals.chpl
A test/visibility/except/operatorsExceptions/exceptMinusEquals.good
A test/visibility/except/operatorsExceptions/exceptMod.chpl
A test/visibility/except/operatorsExceptions/exceptMod.good
A test/visibility/except/operatorsExceptions/exceptModEquals.chpl
A test/visibility/except/operatorsExceptions/exceptModEquals.good
A test/visibility/except/operatorsExceptions/exceptMultiplication.chpl
A test/visibility/except/operatorsExceptions/exceptMultiplication.good
A test/visibility/except/operatorsExceptions/exceptNegation.chpl
A test/visibility/except/operatorsExceptions/exceptNegation.good
A test/visibility/except/operatorsExceptions/exceptNot.chpl
A test/visibility/except/operatorsExceptions/exceptNot.good
A test/visibility/except/operatorsExceptions/exceptOr.chpl
A test/visibility/except/operatorsExceptions/exceptOr.good
A test/visibility/except/operatorsExceptions/exceptOrEquals.chpl
A test/visibility/except/operatorsExceptions/exceptOrEquals.good
A test/visibility/except/operatorsExceptions/exceptPlusEquals.chpl
A test/visibility/except/operatorsExceptions/exceptPlusEquals.good
A test/visibility/except/operatorsExceptions/exceptPositiveIdentity.chpl
A test/visibility/except/operatorsExceptions/exceptPositiveIdentity.good
A test/visibility/except/operatorsExceptions/exceptShiftLeft.chpl
A test/visibility/except/operatorsExceptions/exceptShiftLeft.good
A test/visibility/except/operatorsExceptions/exceptShiftLeftEquals.chpl
A test/visibility/except/operatorsExceptions/exceptShiftLeftEquals.good
A test/visibility/except/operatorsExceptions/exceptShiftRight.chpl
A test/visibility/except/operatorsExceptions/exceptShiftRight.good
A test/visibility/except/operatorsExceptions/exceptShiftRightEquals.chpl
A test/visibility/except/operatorsExceptions/exceptShiftRightEquals.good
A test/visibility/except/operatorsExceptions/exceptStarEquals.chpl
A test/visibility/except/operatorsExceptions/exceptStarEquals.good
A test/visibility/except/operatorsExceptions/exceptSubtraction.chpl
A test/visibility/except/operatorsExceptions/exceptSubtraction.good
A test/visibility/except/operatorsExceptions/exceptSwap.chpl
A test/visibility/except/operatorsExceptions/exceptSwap.good
A test/visibility/except/operatorsExceptions/exceptUnaryNot.chpl
A test/visibility/except/operatorsExceptions/exceptUnaryNot.good
A test/visibility/except/operatorsExceptions/exceptXor.chpl
A test/visibility/except/operatorsExceptions/exceptXor.good
A test/visibility/except/operatorsExceptions/exceptXorEquals.chpl
A test/visibility/except/operatorsExceptions/exceptXorEquals.good
A test/visibility/import/enablesUnqualified/multipleUnqualified/operatorsAlone.chpl
A test/visibility/import/enablesUnqualified/multipleUnqualified/operatorsAlone.good
A test/visibility/import/enablesUnqualified/multipleUnqualified/operatorsFirst.chpl
A test/visibility/import/enablesUnqualified/multipleUnqualified/operatorsFirst.good
A test/visibility/import/enablesUnqualified/multipleUnqualified/operatorsLast.chpl
A test/visibility/import/enablesUnqualified/multipleUnqualified/operatorsLast.good
A test/visibility/import/enablesUnqualified/operatorsAlone.chpl
A test/visibility/import/enablesUnqualified/operatorsAlone.good
A test/visibility/only/operatorsAlone.chpl
A test/visibility/only/operatorsAlone.good
A test/visibility/only/operatorsFirst.chpl
A test/visibility/only/operatorsFirst.good
A test/visibility/only/operatorsLast.chpl
A test/visibility/only/operatorsLast.good
R test/deprecated/exceptEverything-qual.good
R test/deprecated/exceptEverything.chpl
R test/deprecated/exceptEverything.compopts
R test/deprecated/exceptEverything.good
R test/deprecated/exceptEverythingField.chpl
R test/deprecated/exceptEverythingField.good
M compiler/AST/build.cpp
M compiler/include/bison-chapel.h
M compiler/next/lib/parsing/bison-chpl-lib.cpp
M compiler/next/lib/parsing/bison-chpl-lib.h
M compiler/next/lib/parsing/chpl.ypp
M compiler/next/lib/parsing/flex-chpl-lib.cpp
M compiler/next/lib/parsing/flex-chpl-lib.h
M compiler/next/test/parsing/testParseImport.cpp
M compiler/next/test/parsing/testParseUse.cpp
M compiler/parser/bison-chapel.cpp
M compiler/parser/chapel.ypp
M compiler/resolution/functionResolution.cpp
M compiler/resolution/visibleFunctions.cpp
Compare: https://github.com/chapel-lang/chapel/compare/69341d747657...a59d902eb098