-
Notifications
You must be signed in to change notification settings - Fork 111
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
Macro implementations and conformance test fixes #1003
Macro implementations and conformance test fixes #1003
Conversation
} | ||
if (parameterPresence == PresenceBitmap.GROUP) { | ||
} else if (parameterPresence == PresenceBitmap.GROUP) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗺️ This was a bug I discovered that was causing +
cardinality to be read incorrectly.
// Add an empty expression group if nothing present. | ||
int index = expressions.size() + 1; | ||
expressions.add(new Expression.ExpressionGroup(index, index)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗺️ When there's nothing there, and we're expecting a parameter, we need to create a "nothing" expression. (In this case, it's an empty expression group, but I think that there's probably a good justification for introducing a NothingExpression
.)
@@ -34,6 +34,8 @@ internal class IonManagedWriter_1_1( | |||
private val onClose: () -> Unit, | |||
) : _Private_IonWriter, MacroAwareIonWriter { | |||
|
|||
internal fun getRawUserWriter(): IonRawWriter_1_1 = userData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗺️ Hack so that I can convert mangled e-expressions in a toplevel
fragment into serialized data.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## ion-11-encoding #1003 +/- ##
==================================================
Coverage ? 71.07%
Complexity ? 7213
==================================================
Files ? 204
Lines ? 28554
Branches ? 5116
==================================================
Hits ? 20294
Misses ? 6677
Partials ? 1583 ☔ View full report in Codecov by Sentry. |
@@ -2348,7 +2348,7 @@ private void uncheckedReadMacroInvocationHeader(IonTypeID valueTid, Marker marke | |||
private boolean uncheckedReadHeader(final int typeIdByte, final boolean isAnnotated, final Marker markerToSet) { | |||
IonTypeID valueTid = typeIds[typeIdByte]; | |||
if (!valueTid.isValid) { | |||
throw new IonException("Invalid type ID."); | |||
throw new IonException("Invalid type ID: " + valueTid.theByte); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗺️ Minor improvement for ease of debugging.
@JvmStatic | ||
fun exactlyOneFlexInt(name: String) = Parameter(name, ParameterEncoding.FlexInt, ParameterCardinality.ExactlyOne) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗺️ This is now unused now that all system macros use tagged parameters.
@@ -356,7 +356,7 @@ private fun TestCaseSupport.denotesStruct(expectation: SeqElement, reader: IonRe | |||
private fun TestCaseSupport.denotesSymtok(expectation: AnyElement, actual: SymbolToken) { | |||
when (expectation) { | |||
is TextElement -> assertEquals(expectation.textValue, actual.text, createFailureMessage(expectation)) | |||
is IntElement -> assertEquals(expectation.longValue, actual.sid, createFailureMessage(expectation)) | |||
is IntElement -> assertEquals(expectation.longValue.toInt(), actual.sid, createFailureMessage(expectation)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗺️ ...because 0 and 0L aren't equal when they are boxed, I guess.
val m = if (isQualifiedSystemMacro) SystemMacro.get(macroRef) else getMacro(macroRef) | ||
val m = if (isQualifiedSystemMacro) SystemMacro.getMacroOrSpecialForm(macroRef) else getMacro(macroRef) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗺️ This fixes a bug that prevented the macro compiler from recognizing special forms.
additionalSkipFilter: (File, String) -> Boolean = { _, _ -> true } | ||
/** A predicate that returns `true` iff the test case should be skipped. */ | ||
additionalSkipFilter: (File, String) -> Boolean = { _, _ -> false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗺️ I changed this because it was confusing when I went to use it for the incremental reader conformance tests.
// Write an expression group | ||
writer as IonManagedWriter_1_1 | ||
val rawWriter = writer.getRawUserWriter() | ||
rawWriter.stepInExpressionGroup(usingLengthPrefix = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need eventually need a way to exercise delimited expression groups here too...? This question is likely applicable in many places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so because this is a toplevel
fragment, which is supposed to be encoding-agnostic. Expression groups should have full test coverage from other test cases that use text
or binary
fragments so that we can precisely control which text tokens or bytes are present in the encoding.
"in binary with a user macro address" in completeTestName -> false | ||
|
||
// FIXME: Timestamp should not allow an offset of +/-1440 | ||
"the offset argument must be less than 1440" in completeTestName -> false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being able to skip individual tests in a file by name is super nice.
Issue #, if available:
None
Description of changes:
ion-java
to a commit ofion-tests
that includes system macro and other test cases.make_timestamp
,delta
, andsum
system macrosrepeat
system macro to be aligned with the specification (i.e. allow a repeat count of 0, and allow repeating an empty stream)Annot
->annot
(for compliance with the spec)mactab
fragmentstoplevel
fragmentsBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.