Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STORY-1740: omit implicit parameter in operations and function calls #457

Merged
merged 24 commits into from
Dec 6, 2022

Conversation

SimonCockx
Copy link
Contributor

@SimonCockx SimonCockx commented Dec 1, 2022

Features:

  • Added synonym it for item. (need to decide on a final name for it!)
  • Can omit the first parameter of any operation in a context where an implicit parameter is present. (extract [...], sum, CallToFunc, +10, etc, translates to it extract [...], it sum, CallToFunc(it), it+10)
  • Conditions now have access to item/it to reference the instance being checked.
  • Can directly access attributes of item/it wherever it exists, no need to write item ->.

Bug fixes (that I know of):

  • addressed antlr warnings about ambiguous parsing paths.
  • conditions are more robust. E.g., the following now runs fine.
type Foo
  a int (0..1)
  condition C:
    a exists
  • nested inline functions are more robust.
  • using item in a context where it doesn't exist is not allowed anymore.

and lots and lots of clean-ups.

Two particular challenging technicalities:

  • Making the argument of a unary function call optional has as consequence that the parser cannot distinguish between variable references (RosettaCallableCall) and function calls (RosettaCallableWithArgsCall), because there might not be any parentheses. I therefore joint the concept into one: RosettaSymbolReference. This had a lot of impact in every part of the project.
  • A question arises what to do with validation errors if the target of the error is an omitted parameter (e.g., omitting it in it sum where it is a list of Foo => should give a type error on it). Xtext by default just red-underlines the container (e.g., in this case sum would be red-underlined instead of it, which is okay for now), but Xsemantics filters out these validation errors. That needed a fix: see RetainXsemanticsIssuesOnGeneratedInputsFilter.

.gitignore Show resolved Hide resolved
@SimonCockx SimonCockx marked this pull request as ready for review December 2, 2022 13:37
@SimonCockx SimonCockx merged commit 04b3b3d into master Dec 6, 2022
@SimonCockx SimonCockx deleted the story-1740 branch December 6, 2022 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants