Skip to content

Commit

Permalink
Merge pull request #506 from ElektroKill/fix/resolver-null-resolution…
Browse files Browse the repository at this point in the history
…scope

Fixed `Resolver` for `null` `TypeRef.ResolutionScope`
  • Loading branch information
wtfsck authored Jul 8, 2023
2 parents 97e07a8 + 07a11f9 commit a6c474f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/DotNet/Resolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ public TypeDef Resolve(TypeRef typeRef, ModuleDef sourceModule) {
ResolveExportedType(new ModuleDef[] { resolvedModule }, typeRef, sourceModule);
}

if (nonNestedResolutionScope is null) {
// ECMA II.22.38 states that in this case we should check ExportedTypes only.
// The CLR however checks both TypeDefs and ExportedTypes, with TypeDefs taking precedence.
return nonNestedModule.Find(typeRef) ?? ResolveExportedType(new ModuleDef[] { nonNestedModule }, typeRef, sourceModule);
}

return null;
}

Expand Down

0 comments on commit a6c474f

Please sign in to comment.