diff --git a/DMCompiler/DM/DMValueType.cs b/DMCompiler/DM/DMValueType.cs index 7346a0d77f..a4c31598e8 100644 --- a/DMCompiler/DM/DMValueType.cs +++ b/DMCompiler/DM/DMValueType.cs @@ -95,7 +95,7 @@ internal bool MatchesType(DMCompiler compiler, DMComplexValueType type) { return true; } var theirPath = type.AsPath(); - if (theirPath is not null) { + if (type.ListValueTypes is null && theirPath is not null) { compiler.DMObjectTree.TryGetDMObject(theirPath!.Value, out var theirObject); if (theirObject?.IsSubtypeOf(TypePath!.Value) is true) { return true; @@ -120,7 +120,8 @@ internal bool MatchesType(DMCompiler compiler, DMComplexValueType type) { return ourObject?.IsSubtypeOf(type.TypePath!.Value) ?? false; } // If ListValueTypes is non-null, we do more advanced checks. - if (TypePath!.Value == DreamPath.List && ListValueTypes is not null && type.ListValueTypes is not null) { + // The other type's must also be non-null, because we consider empty lists as matching. + if (ListValueTypes is not null && type.ListValueTypes is not null) { // Have to do an actual match check here. This can get expensive, but thankfully it's pretty rare. if (!ListValueTypes.NestedListKeyType.MatchesType(compiler, type.ListValueTypes!.NestedListKeyType)) return false;