Skip to content

Misc Parity Fixes - #2669

Open
ike709 wants to merge 9 commits into
OpenDreamProject:masterfrom
ike709:misc_builtins
Open

Misc Parity Fixes#2669
ike709 wants to merge 9 commits into
OpenDreamProject:masterfrom
ike709:misc_builtins

Conversation

@ike709

@ike709 ike709 commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator
  • Fixes misc builtins not properly handling some bad args
  • Fixes incorrect list size handling, particularly for multidimensional lists
  • Fixes some bitwise operator behavior on lists

All of the new unit tests were passing in BYOND but not in OpenDream prior to these changes.

@ike709
ike709 requested a review from wixoaGit July 20, 2026 06:39
@boring-cyborg boring-cyborg Bot added Compiler Involves the OpenDream compiler Runtime Involves the OpenDream server/runtime labels Jul 20, 2026
Comment thread DMCompiler/DM/Expressions/Builtins.cs Fixed
// BYOND's one-dimensional list produces null when its runtime size is negative
// This is different from multidimensional lists, where the negative dimensions become zero
if (dimensionCount == 1 && dimensionSizes[0].TryGetValueAsInteger(out int size) && size < 0) {
dimensionSizes[0].Dispose();
Comment thread OpenDreamRuntime/Procs/DMOpcodeHandlers.cs Fixed
Comment thread OpenDreamRuntime/Procs/DMOpcodeHandlers.cs Dismissed
@wixoaGit

Copy link
Copy Markdown
Member

I think you've encountered a refcounting bug in BYOND with this one
image

@ike709

ike709 commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator Author

I slapped NOBYOND on the test pending a response to https://www.byond.com/forum/post/2989691

Comment thread DMCompiler/DM/Expressions/Builtins.cs Outdated
Comment thread OpenDreamRuntime/Procs/DMOpcodeHandlers.cs Outdated
Comment thread OpenDreamRuntime/Procs/DMOpcodeHandlers.cs Outdated
using var associativeValue = list.GetValue(value);
foreach (DreamValue value in list.EnumerateValues()) {
bool retained = secondList?.ContainsValue(value) ?? value == second;
if (!retained || !retainedValues.Add(value))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

list(1, 1, 1) & list(1, 1) should give you list(1, 1). The way this HashSet is used, you'd only get list(1).

ike709 and others added 3 commits July 27, 2026 01:30
Co-authored-by: wixoa <wixoag@gmail.com>
Co-authored-by: wixoa <wixoag@gmail.com>
Co-authored-by: wixoa <wixoag@gmail.com>
Comment thread OpenDreamRuntime/Procs/DMOpcodeHandlers.cs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Compiler Involves the OpenDream compiler Runtime Involves the OpenDream server/runtime size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants