Skip to content

Commit

Permalink
PR Feedback. VB's MergeUseSiteInfo now behaves the same as C#, taki…
Browse files Browse the repository at this point in the history
…ng the first argument byref instead of byvalue.
  • Loading branch information
333fred committed May 13, 2022
1 parent 1507a85 commit 7f0369a
Show file tree
Hide file tree
Showing 20 changed files with 160 additions and 183 deletions.
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Portable/Symbols/EventSymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public sealed override bool HasUnsupportedMetadata
get
{
DiagnosticInfo? info = GetUseSiteInfo().DiagnosticInfo;
return (object?)info != null && info.Code == (int)ErrorCode.ERR_BindToBogus;
return (object?)info != null && info.Code is (int)ErrorCode.ERR_BindToBogus or (int)ErrorCode.ERR_UnsupportedCompilerFeature;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Compilers/CSharp/Portable/Symbols/FieldSymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ internal bool CalculateUseSiteDiagnostic(ref UseSiteInfo<AssemblySymbol> result)
}

/// <summary>
/// Return error code that has highest priority while calculating use site error for this symbol.
/// Returns true if the error code is highest priority while calculating use site error for this symbol.
/// </summary>
protected sealed override bool IsHighestPriorityUseSiteErrorCode(int code) => code is (int)ErrorCode.ERR_UnsupportedCompilerFeature or (int)ErrorCode.ERR_BindToBogus;

Expand All @@ -382,7 +382,7 @@ public sealed override bool HasUnsupportedMetadata
get
{
DiagnosticInfo info = GetUseSiteInfo().DiagnosticInfo;
return (object)info != null && info.Code == (int)ErrorCode.ERR_BindToBogus;
return (object)info != null && info.Code is (int)ErrorCode.ERR_BindToBogus or (int)ErrorCode.ERR_UnsupportedCompilerFeature;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Compilers/CSharp/Portable/Symbols/MethodSymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ static bool isGenericMethod([DisallowNull] MethodSymbol? method)
#nullable disable

/// <summary>
/// Return error code that has highest priority while calculating use site error for this symbol.
/// Returns true if the error code is highest priority while calculating use site error for this symbol.
/// </summary>
protected sealed override bool IsHighestPriorityUseSiteErrorCode(int code) => code is (int)ErrorCode.ERR_UnsupportedCompilerFeature or (int)ErrorCode.ERR_BindToBogus;

Expand All @@ -1065,7 +1065,7 @@ public sealed override bool HasUnsupportedMetadata
get
{
DiagnosticInfo info = GetUseSiteInfo().DiagnosticInfo;
return (object)info != null && info.Code == (int)ErrorCode.ERR_BindToBogus;
return (object)info != null && info.Code is (int)ErrorCode.ERR_BindToBogus or (int)ErrorCode.ERR_UnsupportedCompilerFeature;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Portable/Symbols/ParameterSymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ public sealed override bool HasUnsupportedMetadata
{
UseSiteInfo<AssemblySymbol> info = default;
DeriveUseSiteInfoFromParameter(ref info, this);
return info.DiagnosticInfo?.Code == (int)ErrorCode.ERR_BogusType;
return info.DiagnosticInfo?.Code is (int)ErrorCode.ERR_BogusType or (int)ErrorCode.ERR_UnsupportedCompilerFeature;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Portable/Symbols/PropertySymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ internal bool CalculateUseSiteDiagnostic(ref UseSiteInfo<AssemblySymbol> result)
}

/// <summary>
/// Return error code that has highest priority while calculating use site error for this symbol.
/// Returns true if the error code is highest priority while calculating use site error for this symbol.
/// </summary>
protected sealed override bool IsHighestPriorityUseSiteErrorCode(int code) => code is (int)ErrorCode.ERR_UnsupportedCompilerFeature or (int)ErrorCode.ERR_BindToBogus;

Expand Down
4 changes: 2 additions & 2 deletions src/Compilers/CSharp/Portable/Symbols/Symbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ protected AssemblySymbol PrimaryDependency
}

/// <summary>
/// Return error code that has highest priority while calculating use site error for this symbol.
/// Returns true if the error code is the highest priority while calculating use site error for this symbol.
/// Supposed to be ErrorCode, but it causes inconsistent accessibility error.
/// </summary>
protected virtual bool IsHighestPriorityUseSiteErrorCode(int code) => true;
Expand Down Expand Up @@ -967,7 +967,7 @@ public virtual bool HasUnsupportedMetadata
{
get
{
return false;
return GetUseSiteInfo().DiagnosticInfo?.Code == (int)ErrorCode.ERR_UnsupportedCompilerFeature;
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/Compilers/CSharp/Portable/Symbols/TypeSymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -517,17 +517,18 @@ internal Microsoft.Cci.PrimitiveTypeCode PrimitiveTypeCode
#region Use-Site Diagnostics

/// <summary>
/// Return error code that has highest priority while calculating use site error for this symbol.
/// Returns true if the error code is highest priority while calculating use site error for this symbol.
/// </summary>
protected sealed override bool IsHighestPriorityUseSiteErrorCode(int code) => code is (int)ErrorCode.ERR_UnsupportedCompilerFeature or (int)ErrorCode.ERR_BindToBogus;
protected sealed override bool IsHighestPriorityUseSiteErrorCode(int code)
=> code is (int)ErrorCode.ERR_UnsupportedCompilerFeature or (int)ErrorCode.ERR_BindToBogus or (int)ErrorCode.ERR_BogusType;


public sealed override bool HasUnsupportedMetadata
{
get
{
DiagnosticInfo info = GetUseSiteInfo().DiagnosticInfo;
return (object)info != null && info.Code == (int)ErrorCode.ERR_BogusType;
return (object)info != null && info.Code is (int)ErrorCode.ERR_BogusType or (int)ErrorCode.ERR_UnsupportedCompilerFeature;
}
}

Expand Down
Loading

0 comments on commit 7f0369a

Please sign in to comment.