Skip to content

Commit

Permalink
reference issue
Browse files Browse the repository at this point in the history
  • Loading branch information
RikkiGibson committed May 29, 2024
1 parent ddafae4 commit 4a6a34f
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ SyntaxKind.IndexerDeclaration or
var symbol = model.GetSymbolInfo(invocation.Expression, cancellationToken).Symbol;
if (symbol is not IMethodSymbol method || method.PartialImplementationPart is not null)
{
// PROTOTYPE(partial-properties): should we also bail out on a partial property?
// https://github.com/dotnet/roslyn/issues/73772: should we also bail out on a partial property?
// We don't handle partial methods yet
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ internal Variables GetRootScope()

internal Variables? GetVariablesForMethodScope(MethodSymbol method)
{
// PROTOTYPE(partial-properties): is this needed if we also delete the weird cascading in EnterParameters?
// https://github.com/dotnet/roslyn/issues/73772: is this needed if we also delete the weird cascading in EnterParameters?
method = method.PartialImplementationPart ?? method;
var variables = this;
while (true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2764,7 +2764,7 @@ private void EnterParameters()
}

// The partial definition part may include optional parameters whose default values we want to simulate assigning at the beginning of the method
// PROTOTYPE(partial-properties): is this actually used/meaningful?
// https://github.com/dotnet/roslyn/issues/73772: is this actually used/meaningful?
methodSymbol = methodSymbol.PartialDefinitionPart ?? methodSymbol;

var methodParameters = methodSymbol.Parameters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void processMembers(IEnumerable<ISymbol> members)
memberSet.Add(member);

// Ensure that we include symbols for both parts of partial methods.
// PROTOTYPE(partial-properties): also cascade to partial property implementation part
// https://github.com/dotnet/roslyn/issues/73772: also cascade to partial property implementation part
if (member is IMethodSymbol method &&
!(method.PartialImplementationPart is null))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ static bool shouldIncludeSymbol(ISymbolInternal symbol, SyntaxTree tree, Cancell
}
}

// PROTOTYPE(partial-properties): should we also check IPropertySymbol?
// https://github.com/dotnet/roslyn/issues/73772: should we also check IPropertySymbol?
// there is no interface IPropertySymbolInternal
// where are tests for this?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ private void CalculateChanges(

// Partial methods are supplied as implementations but recorded
// internally as definitions since definitions are used in emit.
// PROTOTYPE(partial-properties): should we also make sure to use the definition for a partial property?
// https://github.com/dotnet/roslyn/issues/73772: should we also make sure to use the definition for a partial property?
if (newMember.Kind == SymbolKind.Method)
{
var newMethod = (IMethodSymbolInternal)newMember;
Expand Down
2 changes: 1 addition & 1 deletion src/Compilers/Core/Portable/Emit/SemanticEdit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public SemanticEdit(SemanticEditKind kind, ISymbol? oldSymbol, ISymbol? newSymbo
}
}

// PROTOTYPE(partial-properties): should we also do this check for partial properties?
// https://github.com/dotnet/roslyn/issues/73772: should we also do this check for partial properties?
if (oldSymbol is IMethodSymbol { PartialImplementationPart: not null })
{
throw new ArgumentException("Partial method implementation required", nameof(oldSymbol));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public partial void M() { }
var implementation = definition.PartialImplementationPart;

// Assert that both the definition and implementation resolve back to themselves
// PROTOTYPE(partial-properties): add a similar test for properties
// https://github.com/dotnet/roslyn/issues/73772: add a similar test for properties
Assert.Equal(definition, ResolveSymbol(definition, comp, SymbolKeyComparison.None));
Assert.Equal(implementation, ResolveSymbol(implementation, comp, SymbolKeyComparison.None));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private static ImmutableArray<RoslynNavigationBarItem> GetMembersInTypes(
continue;
}

// PROTOTYPE(partial-properties): also do this for properties?
// https://github.com/dotnet/roslyn/issues/73772: also do this for properties?
var method = member as IMethodSymbol;
if (method != null && method.PartialImplementationPart != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected override async Task<ISymbol> GenerateMemberAsync(ISymbol member, IName
if (enclosingSymbol.TypeKind is not (TypeKind.Struct or TypeKind.Class))
return null;

// PROTOTYPE(partial-properties): should we also get partial property symbols here?
// https://github.com/dotnet/roslyn/issues/73772: should we also get partial property symbols here?
var symbols = semanticModel.LookupSymbols(position, container: enclosingSymbol)
.OfType<IMethodSymbol>()
.Where(m => IsPartial(m) && m.PartialImplementationPart == null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private async Task<IEnumerable<INamedTypeSymbol>> GetAllTypesAsync(CancellationT
return namespaces.GetAllTypes(cancellationToken);
}

// PROTOTYPE(partial-properties): also do this for properties?
// https://github.com/dotnet/roslyn/issues/73772: also do this for properties?
private static IMethodSymbol GetPartialImplementationPartOrNull(ISymbol symbol)
=> (symbol.Kind == SymbolKind.Method) ? ((IMethodSymbol)symbol).PartialImplementationPart : null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3185,7 +3185,7 @@ IFieldSymbol or
// The partial type needs to be specified in the following cases:
// 1) partial method is updated (in case both implementation and definition are updated)
// 2) partial type is updated
// PROTOTYPE(partial-properties): do we also need to check IPropertySymbol.PartialDefinitionPart here?
// https://github.com/dotnet/roslyn/issues/73772: do we also need to check IPropertySymbol.PartialDefinitionPart here?
var partialType = editKind == SemanticEditKind.Update && symbol is IMethodSymbol { PartialDefinitionPart: not null }
? symbolCache.GetKey(symbol.ContainingType, cancellationToken)
: IsPartialTypeEdit(oldSymbol, newSymbol, oldTree, newTree)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ private static bool ParsePrimaryParameterBackingFieldName(string fieldName, [Not
=> (IMethodSymbol?)constructor.ContainingType.GetMembers(WellKnownMemberNames.DeconstructMethodName).FirstOrDefault(
static (symbol, constructor) => symbol is IMethodSymbol method && HasDeconstructorSignature(method, constructor), constructor)?.PartialAsImplementation();

// PROTOTYPE(partial-properties): does this helper need to be updated to use IPropertySymbol.PartialImplementationPart?
// https://github.com/dotnet/roslyn/issues/73772: does this helper need to be updated to use IPropertySymbol.PartialImplementationPart?
public static ISymbol PartialAsImplementation(this ISymbol symbol)
=> symbol is IMethodSymbol { PartialImplementationPart: { } impl } ? impl : symbol;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ SymbolKey CreateSymbolKey(SemanticEditDescription edit)

// Symbol key will happily resolve to a definition part that has no implementation, so we validate that
// differently
// PROTOTYPE(partial-properties): what about deletion of partial property?
// https://github.com/dotnet/roslyn/issues/73772: what about deletion of partial property?
if (expectedOldSymbol is IMethodSymbol { IsPartialDefinition: true } &&
symbolKey.Resolve(oldCompilation, ignoreAssemblyKey: true).Symbol is IMethodSymbol resolvedMethod)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ SymbolKind.Local or

// If this is a parameter symbol for a partial method definition, be sure we visited
// the implementation part's body.
// PROTOTYPE(partial-properties): also do this for properties
// https://github.com/dotnet/roslyn/issues/73772: also do this for properties
if (renamedSymbol is IParameterSymbol renamedParameterSymbol &&
renamedSymbol.ContainingSymbol is IMethodSymbol methodSymbol &&
methodSymbol.PartialImplementationPart != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected override ValueTask<ImmutableArray<ISymbol>> DetermineCascadedSymbolsAs

private static ImmutableArray<ISymbol> GetOtherPartsOfPartial(IMethodSymbol symbol)
{
// PROTOTYPE(partial-properties): define/use a similar helper for PropertySymbolReferenceFinder+PropertyAccessorSymbolReferenceFinder?
// https://github.com/dotnet/roslyn/issues/73772: define/use a similar helper for PropertySymbolReferenceFinder+PropertyAccessorSymbolReferenceFinder?
if (symbol.PartialDefinitionPart != null)
return [symbol.PartialDefinitionPart];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private static void CascadeBetweenPartialMethodParameters(
IParameterSymbol parameter,
ArrayBuilder<ISymbol> results)
{
// PROTOTYPE(partial-properties): also cascade partial indexer parameters
// https://github.com/dotnet/roslyn/issues/73772: also cascade partial indexer parameters
if (parameter.ContainingSymbol is IMethodSymbol method)
{
var ordinal = parameter.Ordinal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private static ImmutableArray<Location> GetConflictLocations(ISymbol renamedMemb
{
if (signatureToConflictingMember.TryGetValue(signature, out var conflictingSymbol))
{
// PROTOTYPE(partial-properties): add other partial property part as conflicting symbol
// https://github.com/dotnet/roslyn/issues/73772: add other partial property part as conflicting symbol
if (isMethod && conflictingSymbol is IMethodSymbol conflictingMethod && renamedMember is IMethodSymbol renamedMethod)
{
if (!(conflictingMethod.PartialDefinitionPart != null && Equals(conflictingMethod.PartialDefinitionPart, renamedMethod)) &&
Expand Down

0 comments on commit 4a6a34f

Please sign in to comment.