-
Notifications
You must be signed in to change notification settings - Fork 936
Fix NRE in linq processing of custom components #2941
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
Changes from 2 commits
89061f2
6321fe0
5b5a47e
f21b1b2
62e11d3
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 |
---|---|---|
|
@@ -272,6 +272,18 @@ public void NestedComponentPropertyCastTest() | |
o => o?.Name == "component[OtherProperty1]"); | ||
} | ||
|
||
[Test] | ||
public void CompositePropertyTest() | ||
{ | ||
var query = session.Query<Glarch>().Select(o => o.Multiple.count); | ||
AssertSupported( | ||
query, | ||
typeof(Glarch).FullName, | ||
"Multiple.count", | ||
o => o is Int32Type, | ||
o => o?.Name == typeof(MultiplicityType).FullName); | ||
} | ||
|
||
[Test] | ||
public void ManyToOneTest() | ||
{ | ||
|
@@ -807,7 +819,7 @@ private void AssertResult( | |
Assert.That(() => expectedMemberType(memberType), $"Invalid member type: {memberType?.Name ?? "null"}"); | ||
Assert.That(() => expectedComponentType(componentType), $"Invalid component type: {componentType?.Name ?? "null"}"); | ||
|
||
if (found) | ||
if (found && (componentType == null || componentType.PropertyNullability != null)) | ||
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. Maybe instead make nullability parameter nullable. And check that 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. I am adding a commit doing what I think you are meaning, but I do not see this as an improvement. It looks to me as a less understandable way of testing, and maybe more brittle, subject to cause the test to fail if we start implementing that nullability property for custom composite type. 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. But with your initial change
I see no problem with adjusting existing test cases when behavior is changed. nit: I would also add optional 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. Ok, I thought the test parsing the query would also cause the method to be called, but I had not checked. I have added your nit. |
||
{ | ||
Assert.That(_tryGetMappedNullability(Sfi, queryModel.SelectClause.Selector, out var isNullable), Is.True, "Expression should be supported"); | ||
Assert.That(nullability, Is.EqualTo(isNullable), "Nullability is not correct"); | ||
|
Uh oh!
There was an error while loading. Please reload this page.
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 am not sure why those changes occur. Let's get rid of them, if that is not an unstable generation artifact.
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 think I just made some whitespace changes for #2772 and forgot to regenerate async code.