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

[6.0] GetVar(inputIndex, varId) for reading context variable from another input and fix for Context.getVar #1016

Merged
merged 18 commits into from
Oct 24, 2024

Conversation

kushti
Copy link
Member

@kushti kushti commented Jun 29, 2024

This PR contains:

  • fix for CONTEXT.getVar failing deserialization and compilation ( close Context.getVar failing compilation (and likely can't be deserialized) #978 )

  • CONTEXT.getVarFromInput method to read context variable from any input.

    Note, that the new method is intentionally not throwing an exception on expected vs real types. This can be used to have getVar alternative without an exception, as in:

     {
         val idx = CONTEXT.selfBoxIndex
         sigmaProp(CONTEXT.getVarFromInput[Int](idx.toShort, 1.toByte).get == 5)
     }

@kushti kushti added this to the v6.0 milestone Jun 29, 2024
@kushti kushti self-assigned this Jun 29, 2024
@kushti kushti changed the title [6.0] Fix for Context.getVar [6.0] GetVar(inputIndex, varId) for reading context variable from another input an fix for Context.getVar Aug 20, 2024
@kushti kushti changed the title [6.0] GetVar(inputIndex, varId) for reading context variable from another input an fix for Context.getVar [6.0] GetVar(inputIndex, varId) for reading context variable from another input and fix for Context.getVar Sep 17, 2024
@kushti kushti requested a review from aslesarenko September 30, 2024 13:13
/**
* A variant of `getVar` to extract a context variable by id and type from any input
*
* @param inputId - input index
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is index, then better call it inputIndex

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed

docs/LangSpec.md Outdated Show resolved Hide resolved
docs/LangSpec.md Outdated Show resolved Hide resolved
} else {
an[Exception] should be thrownBy(varTest())
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing test case for different actual and expected types.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworked into more nuanced check (for sigma.validation.ValidationException now)

reg1 -> UnitConstant.instance
))
)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What this test means?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this test related to the PR ? Also, why to ask others about tests introduced by you (starting from 4f2579bbaeec )3def75d42629d7821073f39804b2 )

@kushti
Copy link
Member Author

kushti commented Oct 21, 2024

@aslesarenko comments addressed , please make another pass

kushti and others added 2 commits October 24, 2024 19:54
Co-authored-by: Alexander Slesarenko <aslesarenko@users.noreply.github.com>
Co-authored-by: Alexander Slesarenko <aslesarenko@users.noreply.github.com>
@kushti kushti merged commit b074b28 into v6.0.0 Oct 24, 2024
4 checks passed
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