Skip to content

Commit

Permalink
Fix nested list types in Typemaker
Browse files Browse the repository at this point in the history
  • Loading branch information
out-of-phaze committed Feb 6, 2025
1 parent e9f13d0 commit edc3a1d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions DMCompiler/DM/DMValueType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ internal bool MatchesType(DMCompiler compiler, DMComplexValueType type) {
return true;
}
var theirPath = type.AsPath();

Check warning

Code scanning / InspectCode

Incorrect blank lines: Blank lines are missing elsewhere Warning

Blank lines are missing, expected minimum 1 instead of 0
if (theirPath is not null) {
if (type.ListValueTypes is null && theirPath is not null) {
compiler.DMObjectTree.TryGetDMObject(theirPath!.Value, out var theirObject);

Check warning

Code scanning / InspectCode

Redundant nullable warning suppression expression Warning

The nullable warning suppression expression is redundant
if (theirObject?.IsSubtypeOf(TypePath!.Value) is true) {
return true;
Expand All @@ -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.

Check warning

Code scanning / InspectCode

Incorrect blank lines: Blank lines are missing elsewhere Warning

Blank lines are missing, expected minimum 1 instead of 0
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;
Expand Down

0 comments on commit edc3a1d

Please sign in to comment.