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

Implement 516 behavior for ~= and ~! #2212

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ike709
Copy link
Collaborator

@ike709 ike709 commented Feb 11, 2025

@boring-cyborg boring-cyborg bot added the Runtime Involves the OpenDream server/runtime label Feb 11, 2025
@amylizzle amylizzle mentioned this pull request Feb 10, 2025
25 tasks
@@ -372,6 +372,8 @@ public override DreamValue OperatorEquivalent(DreamValue b) {
return DreamValue.False;
if (GetLength() != secondList.GetLength())
return DreamValue.False;
if(IsAssociative && (!secondList.IsAssociative || secondList.GetAssociativeValues().Count != GetAssociativeValues().Count))
Copy link
Member

@wixoaGit wixoaGit Feb 15, 2025

Choose a reason for hiding this comment

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

list(a=null) ~= list("a") is TRUE so returning early if IsAssociative != secondList.IsAssociative is incorrect. At least as long as IsAssociative can still treat all-null associative values as associative.

if (IsAssociative) {
var secondListAssoc = secondList.GetAssociativeValues();
foreach (var kvp in GetAssociativeValues()) {
if(!secondListAssoc.TryGetValue(kvp.Key, out var assocValue) || !assocValue.Equals(kvp.Value))
Copy link
Member

Choose a reason for hiding this comment

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

The lack of a value in either assoc lists should be treated as null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Runtime Involves the OpenDream server/runtime size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants