Avoid unnecessarily creating TypeReferences on import #970
Loading…
Reference in a new issue
No description provided.
Delete branch "Unity-Technologies/avoid-unnecessary-import"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When importing a TypeSpecification, an element type or generic argument could be a TypeDefinition within the current module. When this happens, a new TypeReference does not need to be created. This can lead to a TypeReference being added to the typeref table for a type that is already in the assembly. This seems to hold together, although I don't think it's ideal. And really my goal is to avoid failing this logic in the ILLink test framework
github.com/dotnet/runtime@cec44d6dff/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs (L56)This fix superceeds https://github.com/jbevain/cecil/pull/138. I've left that fix in since that API is exposed publically and others could be depending on it.
While I was adjusting this logic, I thought I would apply the same logic to a TypeReference where the scope is the current modules assembly. This case is a bit contrived as it shouldn't happen, but if it did, it would result in the same circular reference problem as https://github.com/jbevain/cecil/pull/138
@jbevain I don't think the linux CI failure is related to my changes.
This is related to actions/runner-images#11101
I fixed it in #972
Now you can just sync your branch
@jbevain What do you think about these changes?
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.