Skip to content

Implement expression group transcription for conformance DSL. #953

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

nirosys
Copy link
Contributor

@nirosys nirosys commented Apr 10, 2025

Issue #, if available: #935

Description of changes:
This PR adds support for transcribing expression groups in the toplevel clause of the DSL, similar to expression invocations.

Additionally, a small change was also made to the mactab clause to automatically include the current unnamed module when re-defining it in order to keep $ion imported.

Example usage:

(ion_1_1
   (toplevel ('#$:values' ('#$:' 0 1 2)))
   (produces 0 1 2)
)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

codecov bot commented Apr 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.58%. Comparing base (138ed13) to head (ee4a692).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #953      +/-   ##
==========================================
- Coverage   78.58%   78.58%   -0.01%     
==========================================
  Files         138      138              
  Lines       35210    35210              
  Branches    35210    35210              
==========================================
- Hits        27671    27670       -1     
  Misses       5475     5475              
- Partials     2064     2065       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nirosys nirosys marked this pull request as ready for review April 10, 2025 23:34
@jobarr-amzn jobarr-amzn requested a review from popematt April 15, 2025 21:23
@nirosys
Copy link
Contributor Author

nirosys commented May 22, 2025

Coming back to this. After merging with main, to resolve conflicts, some of the conformance dsl tests are failing.

Post-merge the toplevel fragment now handles pre-populating macros that are defined in the toplevel's sub-elements. Unfortunately those elements are then serialized to the input doc which re-defines the macros, resulting in decoding errors.

For example one of the tests uses the following 2 fragments:

   (mactab (macro m (v!) (%v)))
   (:m 1)

The test is to ensure that we don't add new IVMs between the fragments, which was an issue previously.

When these fragments are serialized, it produces (formatting added):

$ion_1_1
$ion::(module _ (symbol_table _ ) (macro_table _ (macro m (v ) ('%' v ) ) ) )
$ion::(module _ (macro_table _ (macro m (v '!' ) ('%' v ) ) ) )
(:m 1)

It appears the change made to the top-level fragment is adding the macros, but they're being written out in addition to the toplevel elements that are defining them as well. This results in an error when deserializing:

Decoding(DecodingError { description: "macro named 'm' already exists", position: None })

It might be better to walk the toplevel elements looking for encoding directives and register them as we find them so that we can skip serializing them with the rest of the elements.

Looking to see how involved that will be.

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