-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: remove unauthorized spec #92
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
base: main
Are you sure you want to change the base?
Changes from all commits
8dc82c5
11a7e7c
f795bc7
084022f
3ab4132
0db64bf
71078ef
a927661
c96e2c9
51ec2c6
3447488
441ce14
0d63406
f78186f
58bd276
342ff30
65e9ae6
d40c388
1e110a0
08359f5
5a57983
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -246,12 +246,12 @@ | |
|
|
||
| int expectedRequiredByteLength = -(24 + (4 * IntPtr.Size)); | ||
| TestAssert.Equal(expectedRequiredByteLength, VariableRecordView.RequiredByteLength, nameof(VariableRecordView.RequiredByteLength)); | ||
| TestAssert.Equal(source.Text, view.Text.ToString(), nameof(view.Text)); | ||
| TestAssert.SequenceEqual<int>(source.Values, view.Values, nameof(view.Values)); | ||
| TestAssert.Equal(source.OptionalNumber, view.OptionalNumber, nameof(view.OptionalNumber)); | ||
| TestAssert.Equal(source.Child.Identifier, view.Child.Identifier, nameof(view.Child.Identifier)); | ||
| TestAssert.Equal(source.Child.State, view.Child.State, nameof(view.Child.State)); | ||
| TestAssert.Equal(source.Tail, view.Tail, nameof(view.Tail)); | ||
| TestAssert.Equal(source.Text, view.Text.ToString(), nameof(source.Text)); | ||
| TestAssert.SequenceEqual<int>(source.Values, view.Values, nameof(source.Values)); | ||
| TestAssert.Equal(source.OptionalNumber, view.OptionalNumber, nameof(source.OptionalNumber)); | ||
| TestAssert.Equal(source.Child.Identifier, view.Child?.Identifier ?? -1, nameof(source.Child.Identifier)); | ||
| TestAssert.Equal(source.Child.State, view.Child?.State ?? ByteState.None, nameof(source.Child.State)); | ||
| TestAssert.Equal(source.Tail, view.Tail, nameof(source.Tail)); | ||
|
Comment on lines
+249
to
+254
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win Assert the absent child view. Line 252 verifies only the present-child path. Add 🤖 Prompt for AI Agents |
||
| int textFieldOffset = BinaryPrimitives.ReadInt32LittleEndian(buffer.AsSpan(0, 4)); | ||
| int valuesFieldOffset = BinaryPrimitives.ReadInt32LittleEndian(buffer.AsSpan(4, 4)); | ||
| int optionalNumberFieldOffset = BinaryPrimitives.ReadInt32LittleEndian(buffer.AsSpan(8, 4)); | ||
|
|
@@ -284,8 +284,8 @@ | |
| TestAssert.Equal(source.Text, view.Text.ToString(), nameof(view.Text)); | ||
| TestAssert.SequenceEqual<int>(source.Values, view.Values, nameof(view.Values)); | ||
| TestAssert.Equal(source.OptionalNumber, view.OptionalNumber, nameof(view.OptionalNumber)); | ||
| TestAssert.Equal(source.Child.Identifier, view.Child.Identifier, nameof(view.Child.Identifier)); | ||
| TestAssert.Equal(source.Child.State, view.Child.State, nameof(view.Child.State)); | ||
| TestAssert.Equal(source.Child.Identifier, view.Child?.Identifier ?? -1, nameof(FixedClassView.Identifier)); | ||
| TestAssert.Equal(source.Child.State, view.Child?.State ?? ByteState.None, nameof(FixedClassView.State)); | ||
| TestAssert.Equal(source.Tail, view.Tail, nameof(view.Tail)); | ||
|
|
||
| ReadOnlyMemory<byte> borrowedSerializedMemory = view; | ||
|
|
@@ -521,9 +521,9 @@ | |
| _ = view.Text.Length; | ||
| _ = view.Values.Length; | ||
| _ = view.OptionalNumber; | ||
| FixedClassView childView = view.Child; | ||
| _ = childView.Identifier; | ||
| _ = childView.State; | ||
| FixedClassView? childView = view.Child; | ||
| _ = childView?.Identifier; | ||
| _ = childView?.State; | ||
| _ = view.Tail; | ||
| }, | ||
| nameof(VariableRecord)); | ||
|
|
@@ -777,7 +777,7 @@ | |
| // 2. Assert that nested non-blittable type returns view | ||
| PropertyInfo? childProperty = typeof(VariableRecordView).GetProperty(nameof(VariableRecordView.Child)); | ||
| Assert.NotNull(childProperty); | ||
| Assert.Equal(typeof(FixedClassView), childProperty!.PropertyType); | ||
| Assert.Equal(typeof(FixedClassView?), childProperty!.PropertyType); | ||
| } | ||
|
|
||
| public void StrictBlittableStructTests() | ||
|
|
@@ -1248,13 +1248,13 @@ | |
| int writtenBytes = container.Serialize(buffer); | ||
| var view = new DuplicateInstanceContainerView(buffer.AsMemory(0, writtenBytes)); | ||
|
|
||
| TestAssert.Equal(100, view.Foo.Value, nameof(view.Foo.Value)); | ||
|
Check failure on line 1251 in tests/SerializationTests.cs
|
||
| TestAssert.Equal(100, view.Bar.Value, nameof(view.Bar.Value)); | ||
|
Check failure on line 1252 in tests/SerializationTests.cs
|
||
| TestAssert.Equal(200, view.Baz.Value, nameof(view.Baz.Value)); | ||
|
Check failure on line 1253 in tests/SerializationTests.cs
|
||
|
|
||
| TestAssert.Equal(42, view.Foo.Nested.NestedValue, nameof(view.Foo.Nested.NestedValue)); | ||
|
Check failure on line 1255 in tests/SerializationTests.cs
|
||
| TestAssert.Equal(42, view.Bar.Nested.NestedValue, nameof(view.Bar.Nested.NestedValue)); | ||
|
Check failure on line 1256 in tests/SerializationTests.cs
|
||
| TestAssert.Equal(42, view.Baz.Nested.NestedValue, nameof(view.Baz.Nested.NestedValue)); | ||
|
Check failure on line 1257 in tests/SerializationTests.cs
|
||
|
|
||
| TestAssert.Equal(writtenBytes, view.GetByteLength(), "SharedReferenceInstances GetByteLength"); | ||
| } | ||
|
|
||
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.
📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Resolve the nullability warnings.
Lines 1282-1283 pass
field.NestedSerializableTypeto a non-null parameter. The preview checks report a possible null argument. Preserve the field-kind invariant explicitly withfield.NestedSerializableType!, or restructure the branch so nullable flow analysis can prove it.Proposed fix
📝 Committable suggestion
🧰 Tools
🪛 GitHub Check: generated-source-preview / preview (Debug)
[warning] 1283-1283:
Possible null reference argument for parameter 'symbol' in 'string ZeroSerializerGenerator.GetQualifiedViewName(INamedTypeSymbol symbol)'.
[warning] 1282-1282:
Possible null reference argument for parameter 'symbol' in 'string ZeroSerializerGenerator.GetQualifiedViewName(INamedTypeSymbol symbol)'.
[warning] 1283-1283:
Possible null reference argument for parameter 'symbol' in 'string ZeroSerializerGenerator.GetQualifiedViewName(INamedTypeSymbol symbol)'.
[warning] 1282-1282:
Possible null reference argument for parameter 'symbol' in 'string ZeroSerializerGenerator.GetQualifiedViewName(INamedTypeSymbol symbol)'.
🪛 GitHub Check: generated-source-preview / preview (Release)
[warning] 1283-1283:
Possible null reference argument for parameter 'symbol' in 'string ZeroSerializerGenerator.GetQualifiedViewName(INamedTypeSymbol symbol)'.
[warning] 1282-1282:
Possible null reference argument for parameter 'symbol' in 'string ZeroSerializerGenerator.GetQualifiedViewName(INamedTypeSymbol symbol)'.
[warning] 1283-1283:
Possible null reference argument for parameter 'symbol' in 'string ZeroSerializerGenerator.GetQualifiedViewName(INamedTypeSymbol symbol)'.
[warning] 1282-1282:
Possible null reference argument for parameter 'symbol' in 'string ZeroSerializerGenerator.GetQualifiedViewName(INamedTypeSymbol symbol)'.
🤖 Prompt for AI Agents
Source: Linters/SAST tools