Branch: refs/heads/main
Revision: 702ed4d
Author: arezaii
Link: dyno: batch of changes to fix test failures using dyno parser by arezaii · Pull Request #19587 · chapel-lang/chapel · GitHub
Log Message:
Merge pull request #19587 from arezaii/dyno-test-fix
dyno: batch of changes to fix test failures using dyno parser
This PR contains many changes to address test failures when
using the dyno
parser. Prior to this change, there were 348 failing
tests. With these updates, the number of failing tests falls to 226.
A list of included changes, from PR messages:
fix parsing bad label definitions, adjust error message wording
-
handle case when a label doesn't match up with a valid statement
which was previously causing an internal compiler error (segfault)
when trying to test the type of the statement -
adjust error messages when redefining an existing type or the
keyword 'this' to align them with old parser messages.
handle parsing pragmas that aren't attached to stmts
- add check for existence of statement before checking type
when building pragma statements to prevent segfault
handle conversion of empty only visibility clause on use stmt
- the old parser relied on a list with an empty element in it to
properly account for an only with no limitations. We were passing
a totally empty message so we failed to convert use A only;
fix extra space in function userString, add space when printing use
-
in the case of a function that takes an array as an argument
and and has no specified return type, we would insert an extra
trailing space. e.g maxIndex(A: [?D]) becomes maxIndex(A: [?D] )
Added special handling for this case to get alignment between the
old and dyno parsers. Update .good file for test that exposed this. -
add a space between the visibility and the use keyword when printing
ause
node from uAST to chapel syntax.
handle an empty actuals list in a new expression
- handle special case where incorrect call new A;
needs to recognize the actual expression is NULL
and create an empty list rather than a list with a
NULL value. Specialize error message to match old
parser.
dyno parser changes to EnumElement
-
add symbol attributes to EnumElements, which can happen when an
enum value gets deprecated. -
change logic when an EnumElement returns its initialization
expression based off an astList size > 0 and adding 1 to the
index of the Attributes. Check for case when an element has
an attribute, but no initialization expression.
dyno parser update to handle import of operators
-
the visibility clause type NONE is used with importing
operators. The assertion that with NONE that the limitation
count be 0 was too restrictive for the case of something like:
import this.opdef.align; -
add import cases to stringify tests
dyno parse fix for imports, add ref flag to temp tuple var in uAST->AST
-
change the production for import some.place.op; which was causing
failures in tests with that pattern. -
set storage flag on temp variable when converting TupleDecl in
uAST to BlockStmt in old AST. Required small changes to function
we were using to attach symbol storage. -
update dyno parser based on updated production definition.
-
drop expectation of return type when printing a function signature
in one test.
dyno parser print module names like old parser
add -
to all global strings, align error messages with old parser
-
modify error message when parsing an invalid index expression
to match that of the old parser. -
modify error when building a bad visibility clause to math that
of the old parser. TODO: This needs to be handled for more cases
than justuse
. Bad import statements may also follow this path. -
adjust warning of '--' and '++' to change the op to '-' or '+'
respectively, as the old parser did.
add space after printing keyword in user string
- add printing of a space after keywords sync and single
so function signatures would print out with a space
between the keyword and the type.
dyno: when converting fncalls, check for square brackets
- copy the square brackets property from the FnCall uast node to
the converted ast node
dyno: specialize error message for new dot expressions without parens
- calling new M.Q results in an error and that error message needs
to match (for now) the error message from the old parser, indicating
that the new call is missing its argument list.
dyno: specialize error messages for new dot expressions
- add special handling for cases that require disambiguation
with parentheses
remove named arguments from primitive calls
-
dyno will not support named argument calls so remove the named
argument calls in the tests and the requirement that get visible
symbols use named arguments. -
update test .good files based on new error messages
dyno: convert dot expressions for chapel keywords align and by
- in the conversion of dot expressions we were not handling special
chapel keywords align and by if they were the member of the dot
expression. Add some special handling to convert these to proper
chpl_align and chpl_by as needed.
dyno: match error message on unknown pragma to old parser
- update the text output when encountering an unknown pragma
to match that of the old parser
update captureString lexing to remove extra space
-
when parsing a dot expression, if the lhs of the .
was a recognized keyword (like type), then we were
leaving a space between the lhs and the .rhs. Add
special handling for this case to the lexer. -
adjust test .good file for expected result
update test .good files to reflect line number changes
- I added a comment line to some tests that exercise print visible symbols
primitive call and neglected to update the line numbers in the .good
files to account for the additional line. This change addresses that.
relax conditions when removing extra space in captureString
- remove the condition that the previous token needed to be a
]
to remove an extra space when the next token is either a dot
or a closing paren.
dyno: update parser to use error messages like old parser
- when redefining certain keywords like none, true, or false,
update the error message to match the old parser.
dyno: when converting While nodes, convert conditionals like old parser
- add a call to
buildIfVar
for conditionals which arevar
assignments
so the converted AST matches what the old parser would emit
dyno: fix chapel syntax printing for FnCalls
- the
FnCall
printer was not handling a postfix?
properly, printing
it in front of the type instead of after. This update fixes that
by checking the actual when the called expression is a reserved
word like borrowed or shared.
dyno: add error when deprecating forwarded statements
- the old parser emits an error when a user tries to mark a
forwarding
decl as deprecated. Add the same error for dyno.
dyno: add spaces around assignment operator def when printing
- add space to match old parser output when printing the signature
of the assignment operator. When the old parser goes away, we
will want to come and remove these spaces as they likely should
be ignored in operators.
dyno: check forwarding decl attributes not null before reading
dyno: relax condition deciding isLoopMaybeArray
dyno: print names for named actuals in FnCalls
- Add functionality for FnCalls to print their named actuals, if
they exist, when printing Chapel syntax
TESTING:
- [x] paratest
- [x] paratest with
--dyno-
(226 failures vs 348 on main)
reviewed by @mppf - thanks!
Modified Files:
M compiler/dyno/include/chpl/queries/all-global-strings.h
M compiler/dyno/include/chpl/uast/EnumElement.h
M compiler/dyno/lib/parsing/ParserContextImpl.h
M compiler/dyno/lib/parsing/bison-chpl-lib.cpp
M compiler/dyno/lib/parsing/chpl.ypp
M compiler/dyno/lib/parsing/flex-chpl-lib.cpp
M compiler/dyno/lib/parsing/flex-chpl-lib.h
M compiler/dyno/lib/uast/chpl-syntax-printer.cpp
M compiler/dyno/test/uast/testStringify.cpp
M compiler/include/flex-chapel.h
M compiler/parser/chapel.lex
M compiler/parser/flex-chapel.cpp
M compiler/parser/parser.cpp
M compiler/passes/convert-uast.cpp
M compiler/passes/scopeResolve.cpp
M test/arrays/marybeth/test_arrayops.good
M test/classes/delete-free/owned/owned-record-instantiation-types-user-init-owns-error.good
M test/functions/generic/genericArgDotType2.good
M test/functions/vass/return-type-function-failure.good
M test/library/standard/LinkedLists/bradc/emptySeq3.good
M test/trivial/diten/printVisibleConflict.chpl
M test/trivial/diten/printVisibleConflict.good
M test/trivial/diten/printvisible.chpl
M test/trivial/diten/printvisible.good
M test/trivial/diten/printvisibleOptFalse.chpl
M test/trivial/diten/printvisibleOptFalse.good
M test/trivial/diten/printvisibleOptTrue.chpl
M test/trivial/diten/printvisibleOptTrue.good
M test/trivial/diten/printvisibleWrongName.chpl
M test/trivial/diten/printvisibleWrongName.good
M test/trivial/diten/printvisibleWrongValue.chpl
M test/trivial/diten/printvisibleWrongValue.good
M test/types/sync/ferguson/sync-copy-init-cannot-coerce2.good
M test/types/sync/vass/ref-sync-4.good
M test/types/sync/vass/ref-sync-5-blank.good
M test/types/sync/vass/ref-sync-5-ref.good
M test/types/sync/vass/ref-sync-6-blank.good
M test/types/sync/vass/ref-sync-6-ref.good
M test/users/engin/partial_reduction_support/modules/dsiMethods.chpl
M test/visibility/private/variables/accessSiblingPrint.chpl
M test/visibility/private/variables/accessSiblingPrint.good
M test/visibility/private/variables/privateToParentPrint.chpl
M test/visibility/private/variables/privateToParentPrint.good
Compare: https://github.com/chapel-lang/chapel/compare/4609fa37beed...702ed4d2ffd4