Ensure declaring compilation can be located for source symbols created during compilation for EE evaluation.#60152
Conversation
…d during compilation for EE evaluation. Fixes dotnet#59093. Related to dotnet#58198.
| (object)null); | ||
| _allTypeParameters = container.TypeParameters.Concat(_typeParameters); | ||
| this.TypeMap = new TypeMap(allSourceTypeParameters, _allTypeParameters); | ||
| _allTypeParameters = container.TypeParameters.Concat(_typeParameters).Concat(_typeParameters); |
There was a problem hiding this comment.
What is the purpose of the double Concat? #Resolved
There was a problem hiding this comment.
What is the purpose of the double Concat?
We added some new type parameters to allSourceTypeParameters above, they should be pared with entries in _allTypeParameters. They should be paired with the same _typeParameters.
1 similar comment
| { | ||
| if (IsViableSourceMethod(candidateMethod, desiredMethodName, desiredTypeParameters, sourceMethodMustBeInstance)) | ||
| { | ||
| MethodSymbol sourceMethod = new EECompilationContextMethod(candidateSubstitutedSourceMethod.DeclaringCompilation!, candidateMethod.OriginalDefinition); |
There was a problem hiding this comment.
Is ! necessary?
Yes, despite the assert above, a nullable warning is reported here. I will open an issue after the change is merged.
| public PlaceholderLocal(Symbol containingSymbol, object identifier, TypeWithAnnotations type) | ||
| { | ||
| Debug.Assert(identifier != null); | ||
| Debug.Assert(containingSymbol is null || containingSymbol.DeclaringCompilation is not null); |
There was a problem hiding this comment.
Unfortunately there are other scenarios (not EE related) when this assert is going to fail. For whatever reason AttributeSemanticModel uses the attribute type as member symbol and it is used as the symbol for region flow analysis, which makes little sense in my opinion.
Fixes #59093.
Related to #58198.