From 004b1d9e7b7c8850c70724d4c535b18294e7a436 Mon Sep 17 00:00:00 2001 From: Penelope Haze Date: Sat, 22 Feb 2025 22:05:40 -0500 Subject: [PATCH] Exclude NoConstFold from Typemaker Type var --- DMCompiler/DM/DMValueType.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DMCompiler/DM/DMValueType.cs b/DMCompiler/DM/DMValueType.cs index a6ef541b8d..6b4be7bd30 100644 --- a/DMCompiler/DM/DMValueType.cs +++ b/DMCompiler/DM/DMValueType.cs @@ -1,4 +1,4 @@ -namespace DMCompiler.DM; +namespace DMCompiler.DM; // If you are modifying this, you must also modify OpenDreamShared.Dream.DreamValueType !! // Unfortunately the client needs this and it can't reference DMCompiler due to the sandbox @@ -59,7 +59,7 @@ public readonly struct DMComplexValueType { public readonly DMListValueTypes? ListValueTypes; public DMComplexValueType(DMValueType type, DreamPath? typePath) { - Type = type & ~(DMValueType.Unimplemented | DMValueType.CompiletimeReadonly); // Ignore these 2 types + Type = type & ~(DMValueType.Unimplemented | DMValueType.CompiletimeReadonly | DMValueType.NoConstFold); // Ignore these 3 types TypePath = typePath; IsUnimplemented = type.HasFlag(DMValueType.Unimplemented); IsCompileTimeReadOnly = type.HasFlag(DMValueType.CompiletimeReadonly); @@ -96,6 +96,8 @@ internal bool MatchesType(DMCompiler compiler, DMComplexValueType type) { } var theirPath = type.AsPath(); if (type.ListValueTypes is null && theirPath is not null) { + if (theirPath == TypePath!.Value) // exception for /icon and similar, which may not have entries in the object tree + return true; compiler.DMObjectTree.TryGetDMObject(theirPath!.Value, out var theirObject); if (theirObject?.IsSubtypeOf(TypePath!.Value) is true) { return true;