Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
jcouv committed Jun 21, 2023
1 parent 58f7312 commit eb8b887
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ internal static ObsoleteDiagnosticKind GetObsoleteDiagnosticKind(Symbol symbol,
{
case ObsoleteAttributeKind.None:
return ObsoleteDiagnosticKind.NotObsolete;
case ObsoleteAttributeKind.WindowsExperimental:
case ObsoleteAttributeKind.Experimental:
case ObsoleteAttributeKind.NewExperimental:
return ObsoleteDiagnosticKind.Diagnostic;
case ObsoleteAttributeKind.Uninitialized:
// If we haven't cracked attributes on the symbol at all or we haven't
Expand Down Expand Up @@ -155,15 +155,15 @@ static DiagnosticInfo createObsoleteDiagnostic(Symbol symbol, BinderFlags locati
return null;
}

if (data.Kind == ObsoleteAttributeKind.Experimental)
if (data.Kind == ObsoleteAttributeKind.WindowsExperimental)
{
Debug.Assert(data.Message == null);
Debug.Assert(!data.IsError);
// Provide an explicit format for fully-qualified type names.
return new CSDiagnosticInfo(ErrorCode.WRN_Experimental, new FormattedSymbol(symbol, SymbolDisplayFormat.CSharpErrorMessageFormat));
}

if (data.Kind == ObsoleteAttributeKind.NewExperimental)
if (data.Kind == ObsoleteAttributeKind.Experimental)
{
Debug.Assert(data.Message is null);
Debug.Assert(!data.IsError);
Expand Down
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Portable/Symbols/Symbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1320,8 +1320,8 @@ internal ThreeState ObsoleteState
switch (ObsoleteKind)
{
case ObsoleteAttributeKind.None:
case ObsoleteAttributeKind.WindowsExperimental:
case ObsoleteAttributeKind.Experimental:
case ObsoleteAttributeKind.NewExperimental:
return ThreeState.False;
case ObsoleteAttributeKind.Uninitialized:
return ThreeState.Unknown;
Expand Down
8 changes: 4 additions & 4 deletions src/Compilers/CSharp/Portable/Symbols/Symbol_Attributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ internal static bool EarlyDecodeDeprecatedOrExperimentalOrObsoleteAttribute(
{
kind = ObsoleteAttributeKind.Deprecated;
}
else if (CSharpAttributeData.IsTargetEarlyAttribute(type, syntax, AttributeDescription.ExperimentalAttribute))
else if (CSharpAttributeData.IsTargetEarlyAttribute(type, syntax, AttributeDescription.WindowsExperimentalAttribute))
{
kind = ObsoleteAttributeKind.Experimental;
kind = ObsoleteAttributeKind.WindowsExperimental;
}
else if (CSharpAttributeData.IsTargetEarlyAttribute(type, syntax, AttributeDescription.NewExperimentalAttribute))
else if (CSharpAttributeData.IsTargetEarlyAttribute(type, syntax, AttributeDescription.ExperimentalAttribute))
{
kind = ObsoleteAttributeKind.NewExperimental;
kind = ObsoleteAttributeKind.Experimental;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Microsoft.CodeAnalysis.CSharp.UnitTests
{
public class AttributeTests_Experimental : CSharpTestBase
public class AttributeTests_WindowsExperimental : CSharpTestBase
{
private const string DeprecatedAttributeSource =
@"using System;
Expand Down
16 changes: 8 additions & 8 deletions src/Compilers/Core/Portable/MetadataReader/PEModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1164,24 +1164,24 @@ internal ObsoleteAttributeData TryGetDeprecatedOrExperimentalOrObsoleteAttribute
}

// [Windows.Foundation.Metadata.Experimental] is always a warning, not an error.
info = FindTargetAttribute(token, AttributeDescription.ExperimentalAttribute);
info = FindTargetAttribute(token, AttributeDescription.WindowsExperimentalAttribute);
if (info.HasValue)
{
return TryExtractExperimentalDataFromAttribute(info);
return TryExtractWindowsExperimentalDataFromAttribute(info);
}

// [Experimental] is always a warning, not an error, so search for it last.
info = FindTargetAttribute(token, AttributeDescription.NewExperimentalAttribute);
info = FindTargetAttribute(token, AttributeDescription.ExperimentalAttribute);
if (info.HasValue)
{
return TryExtractNewExperimentalDataFromAttribute(info, decoder);
return TryExtractExperimentalDataFromAttribute(info, decoder);
}

return null;
}

#nullable enable
private ObsoleteAttributeData? TryExtractNewExperimentalDataFromAttribute(AttributeInfo attributeInfo, IAttributeNamedArgumentDecoder decoder)
private ObsoleteAttributeData? TryExtractExperimentalDataFromAttribute(AttributeInfo attributeInfo, IAttributeNamedArgumentDecoder decoder)
{
Debug.Assert(attributeInfo.HasValue);
if (!TryGetAttributeReader(attributeInfo.Handle, out var sig))
Expand All @@ -1202,7 +1202,7 @@ internal ObsoleteAttributeData TryGetDeprecatedOrExperimentalOrObsoleteAttribute
}

string? urlFormat = crackUrlFormat(decoder, ref sig);
return new ObsoleteAttributeData(ObsoleteAttributeKind.NewExperimental, message: null, isError: false, diagnosticId, urlFormat);
return new ObsoleteAttributeData(ObsoleteAttributeKind.Experimental, message: null, isError: false, diagnosticId, urlFormat);

static string? crackUrlFormat(IAttributeNamedArgumentDecoder decoder, ref BlobReader sig)
{
Expand Down Expand Up @@ -1692,14 +1692,14 @@ private ObsoleteAttributeData TryExtractDeprecatedDataFromAttribute(AttributeInf
}
}

private ObsoleteAttributeData TryExtractExperimentalDataFromAttribute(AttributeInfo attributeInfo)
private ObsoleteAttributeData TryExtractWindowsExperimentalDataFromAttribute(AttributeInfo attributeInfo)
{
Debug.Assert(attributeInfo.HasValue);

switch (attributeInfo.SignatureIndex)
{
case 0: // ExperimentalAttribute()
return ObsoleteAttributeData.Experimental;
return ObsoleteAttributeData.WindowsExperimental;

default:
throw ExceptionUtilities.UnexpectedValue(attributeInfo.SignatureIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,8 @@ static AttributeDescription()
internal static readonly AttributeDescription NullableAttribute = new AttributeDescription("System.Runtime.CompilerServices", "NullableAttribute", s_signaturesOfNullableAttribute);
internal static readonly AttributeDescription NullableContextAttribute = new AttributeDescription("System.Runtime.CompilerServices", "NullableContextAttribute", s_signaturesOfNullableContextAttribute);
internal static readonly AttributeDescription NullablePublicOnlyAttribute = new AttributeDescription("System.Runtime.CompilerServices", "NullablePublicOnlyAttribute", s_signatures_HasThis_Void_Boolean_Only);
internal static readonly AttributeDescription ExperimentalAttribute = new AttributeDescription("Windows.Foundation.Metadata", "ExperimentalAttribute", s_signatures_HasThis_Void_Only);
internal static readonly AttributeDescription NewExperimentalAttribute = new AttributeDescription("System.Diagnostics.CodeAnalysis", "ExperimentalAttribute", s_signatures_HasThis_Void_String_Only);
internal static readonly AttributeDescription WindowsExperimentalAttribute = new AttributeDescription("Windows.Foundation.Metadata", "ExperimentalAttribute", s_signatures_HasThis_Void_Only);
internal static readonly AttributeDescription ExperimentalAttribute = new AttributeDescription("System.Diagnostics.CodeAnalysis", "ExperimentalAttribute", s_signatures_HasThis_Void_String_Only);
internal static readonly AttributeDescription ExcludeFromCodeCoverageAttribute = new AttributeDescription("System.Diagnostics.CodeAnalysis", "ExcludeFromCodeCoverageAttribute", s_signatures_HasThis_Void_Only);
internal static readonly AttributeDescription EnumeratorCancellationAttribute = new AttributeDescription("System.Runtime.CompilerServices", "EnumeratorCancellationAttribute", s_signatures_HasThis_Void_Only);
internal static readonly AttributeDescription SkipLocalsInitAttribute = new AttributeDescription("System.Runtime.CompilerServices", "SkipLocalsInitAttribute", s_signatures_HasThis_Void_Only);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,15 @@ internal ObsoleteAttributeData DecodeObsoleteAttribute(ObsoleteAttributeKind kin
return DecodeObsoleteAttribute();
case ObsoleteAttributeKind.Deprecated:
return DecodeDeprecatedAttribute();
case ObsoleteAttributeKind.WindowsExperimental:
return DecodeWindowsExperimentalAttribute();
case ObsoleteAttributeKind.Experimental:
return DecodeExperimentalAttribute();
case ObsoleteAttributeKind.NewExperimental:
return decodeNewExperimentalAttribute();
return decodeExperimentalAttribute();
default:
throw ExceptionUtilities.UnexpectedValue(kind);
}

ObsoleteAttributeData decodeNewExperimentalAttribute()
ObsoleteAttributeData decodeExperimentalAttribute()
{
// ExperimentalAttribute(string diagnosticId)
Debug.Assert(this.CommonConstructorArguments.Length == 1);
Expand All @@ -283,7 +283,7 @@ ObsoleteAttributeData decodeNewExperimentalAttribute()
}
}

return new ObsoleteAttributeData(ObsoleteAttributeKind.NewExperimental, message: null, isError: false, diagnosticId, urlFormat);
return new ObsoleteAttributeData(ObsoleteAttributeKind.Experimental, message: null, isError: false, diagnosticId, urlFormat);
}
}

Expand Down Expand Up @@ -372,11 +372,11 @@ private ObsoleteAttributeData DecodeDeprecatedAttribute()
/// <summary>
/// Decode the arguments to ExperimentalAttribute. ExperimentalAttribute has 0 arguments.
/// </summary>
private ObsoleteAttributeData DecodeExperimentalAttribute()
private ObsoleteAttributeData DecodeWindowsExperimentalAttribute()
{
// ExperimentalAttribute()
Debug.Assert(this.CommonConstructorArguments.Length == 0);
return ObsoleteAttributeData.Experimental;
return ObsoleteAttributeData.WindowsExperimental;
}

internal static void DecodeMethodImplAttribute<T, TAttributeSyntaxNode, TAttributeData, TAttributeLocation>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ internal enum ObsoleteAttributeKind
Uninitialized,
Obsolete,
Deprecated,
WindowsExperimental,
Experimental,
NewExperimental,
}

/// <summary>
Expand All @@ -22,7 +22,7 @@ internal enum ObsoleteAttributeKind
internal sealed class ObsoleteAttributeData
{
public static readonly ObsoleteAttributeData Uninitialized = new ObsoleteAttributeData(ObsoleteAttributeKind.Uninitialized, message: null, isError: false, diagnosticId: null, urlFormat: null);
public static readonly ObsoleteAttributeData Experimental = new ObsoleteAttributeData(ObsoleteAttributeKind.Experimental, message: null, isError: false, diagnosticId: null, urlFormat: null);
public static readonly ObsoleteAttributeData WindowsExperimental = new ObsoleteAttributeData(ObsoleteAttributeKind.WindowsExperimental, message: null, isError: false, diagnosticId: null, urlFormat: null);

public const string DiagnosticIdPropertyName = "DiagnosticId";
public const string UrlFormatPropertyName = "UrlFormat";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Select Case symbol.ObsoleteKind
Case ObsoleteAttributeKind.None
Return ObsoleteDiagnosticKind.NotObsolete
Case ObsoleteAttributeKind.Experimental, ObsoleteAttributeKind.NewExperimental
Case ObsoleteAttributeKind.WindowsExperimental, ObsoleteAttributeKind.Experimental
Return ObsoleteDiagnosticKind.Diagnostic
Case ObsoleteAttributeKind.Uninitialized
' If we haven't cracked attributes on the symbol at all or we haven't
Expand Down Expand Up @@ -115,15 +115,15 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
' uninitialized.
Debug.Assert(Not data.IsUninitialized)

If data.Kind = ObsoleteAttributeKind.Experimental Then
If data.Kind = ObsoleteAttributeKind.WindowsExperimental Then
Debug.Assert(data.Message Is Nothing)
Debug.Assert(Not data.IsError)
' Provide an explicit format for fully-qualified type names.
Return ErrorFactory.ErrorInfo(ERRID.WRN_Experimental, New FormattedSymbol(symbol, SymbolDisplayFormat.VisualBasicErrorMessageFormat))
End If


If data.Kind = ObsoleteAttributeKind.NewExperimental Then
If data.Kind = ObsoleteAttributeKind.Experimental Then
Debug.Assert(data.Message Is Nothing)
Debug.Assert(Not data.IsError)
' Provide an explicit format for fully-qualified type names.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
result = result Or QuickAttributes.Obsolete
ElseIf Matches(name, inAttribute, AttributeDescription.DeprecatedAttribute) Then
result = result Or QuickAttributes.Obsolete
ElseIf Matches(name, inAttribute, AttributeDescription.ExperimentalAttribute) Then
ElseIf Matches(name, inAttribute, AttributeDescription.WindowsExperimentalAttribute) Then
result = result Or QuickAttributes.Obsolete
ElseIf Matches(name, inAttribute, AttributeDescription.NewExperimentalAttribute) Then
ElseIf Matches(name, inAttribute, AttributeDescription.ExperimentalAttribute) Then
result = result Or QuickAttributes.Obsolete
ElseIf Matches(name, inAttribute, AttributeDescription.MyGroupCollectionAttribute) Then
result = result Or QuickAttributes.TypeIdentifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
checker.AddName(AttributeDescription.CaseInsensitiveExtensionAttribute.Name, QuickAttributes.Extension)
checker.AddName(AttributeDescription.ObsoleteAttribute.Name, QuickAttributes.Obsolete)
checker.AddName(AttributeDescription.DeprecatedAttribute.Name, QuickAttributes.Obsolete)
checker.AddName(AttributeDescription.WindowsExperimentalAttribute.Name, QuickAttributes.Obsolete)
checker.AddName(AttributeDescription.ExperimentalAttribute.Name, QuickAttributes.Obsolete)
checker.AddName(AttributeDescription.NewExperimentalAttribute.Name, QuickAttributes.Obsolete)
checker.AddName(AttributeDescription.MyGroupCollectionAttribute.Name, QuickAttributes.MyGroupCollection)
checker.AddName(AttributeDescription.TypeIdentifierAttribute.Name, QuickAttributes.TypeIdentifier)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1817,8 +1817,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Case AttributeDescription.CaseInsensitiveExtensionAttribute.Name,
AttributeDescription.ObsoleteAttribute.Name,
AttributeDescription.DeprecatedAttribute.Name,
AttributeDescription.WindowsExperimentalAttribute.Name,
AttributeDescription.ExperimentalAttribute.Name,
AttributeDescription.NewExperimentalAttribute.Name,
AttributeDescription.MyGroupCollectionAttribute.Name,
AttributeDescription.TypeIdentifierAttribute.Name

Expand Down
2 changes: 1 addition & 1 deletion src/Compilers/VisualBasic/Portable/Symbols/Symbol.vb
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Friend ReadOnly Property ObsoleteState As ThreeState
Get
Select Case ObsoleteKind
Case ObsoleteAttributeKind.None, ObsoleteAttributeKind.Experimental, ObsoleteAttributeKind.NewExperimental
Case ObsoleteAttributeKind.None, ObsoleteAttributeKind.WindowsExperimental, ObsoleteAttributeKind.Experimental
Return ThreeState.False
Case ObsoleteAttributeKind.Uninitialized
Return ThreeState.Unknown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
kind = ObsoleteAttributeKind.Obsolete
ElseIf VisualBasicAttributeData.IsTargetEarlyAttribute(type, syntax, AttributeDescription.DeprecatedAttribute) Then
kind = ObsoleteAttributeKind.Deprecated
ElseIf VisualBasicAttributeData.IsTargetEarlyAttribute(type, syntax, AttributeDescription.WindowsExperimentalAttribute) Then
kind = ObsoleteAttributeKind.WindowsExperimental
ElseIf VisualBasicAttributeData.IsTargetEarlyAttribute(type, syntax, AttributeDescription.ExperimentalAttribute) Then
kind = ObsoleteAttributeKind.Experimental
ElseIf VisualBasicAttributeData.IsTargetEarlyAttribute(type, syntax, AttributeDescription.NewExperimentalAttribute) Then
kind = ObsoleteAttributeKind.NewExperimental
Else
boundAttribute = Nothing
obsoleteData = Nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Imports Xunit

Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics

Public Class AttributeTests_Experimental
Public Class AttributeTests_WindowsExperimental
Inherits BasicTestBase

Private Shared ReadOnly DeprecatedAndExperimentalAttributeSource As XElement =
Expand Down

0 comments on commit eb8b887

Please sign in to comment.