Skip to content

Conversation

@Tosoks67
Copy link
Contributor

@Tosoks67 Tosoks67 commented Nov 21, 2025

Added an abstract bool method EqualCondition to Value (takes Value as the only parameter; It's basically the condition that's checked in the Equals override and the == and !=)

made the switches look good (perfectionist ahh)

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

5 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

} = null!;


public override bool EqualCondition(Value other) => other is CollectionValue otherP && CastedValues.SequenceEqual(otherP.CastedValues) && Type == otherP.Type;
Copy link

Choose a reason for hiding this comment

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

logic: SequenceEqual uses default equality comparison which may not invoke the custom EqualCondition methods on Value elements. Consider using a custom comparer or manually iterating through elements to call EqualCondition. Should the collection equality check use the custom EqualCondition method for comparing individual Value elements instead of relying on default equality?

Prompt To Fix With AI
This is a comment left during a code review.
Path: ValueSystem/CollectionValue.cs
Line: 53:53

Comment:
**logic:** SequenceEqual uses default equality comparison which may not invoke the custom EqualCondition methods on Value elements. Consider using a custom comparer or manually iterating through elements to call EqualCondition. Should the collection equality check use the custom EqualCondition method for comparing individual Value elements instead of relying on default equality?

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Tosoks67 weź rzuć okiem na to, chyba dobry catch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dodany fix do pull requesta

public bool IsValid => value is not null;
public object Value => value ?? throw new ScriptRuntimeError("Value of reference is invalid.");

public override bool EqualCondition(Value other) => other is ReferenceValue otherP && Value.Equals(otherP.Value);
Copy link

Choose a reason for hiding this comment

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

logic: Calling Value property on invalid references will throw ScriptRuntimeError. Consider checking IsValid on both references before accessing Value properties to avoid exceptions during equality comparisons. Should equality comparison between invalid references return false, or should it throw an exception as currently implemented?

Prompt To Fix With AI
This is a comment left during a code review.
Path: ValueSystem/ReferenceValue.cs
Line: 11:11

Comment:
**logic:** Calling `Value` property on invalid references will throw `ScriptRuntimeError`. Consider checking `IsValid` on both references before accessing `Value` properties to avoid exceptions during equality comparisons. Should equality comparison between invalid references return false, or should it throw an exception as currently implemented?

How can I resolve this? If you propose a fix, please make it concise.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

5 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Collaborator

@Elektryk-Andrzej Elektryk-Andrzej left a comment

Choose a reason for hiding this comment

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

lgtm

@Elektryk-Andrzej Elektryk-Andrzej merged commit a239762 into ScriptedEvents:main Nov 21, 2025
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