Skip to content

Commit

Permalink
Remove RuntimeSupportsNumericIntPtr setter
Browse files Browse the repository at this point in the history
  • Loading branch information
jcouv committed Oct 5, 2022
1 parent ad69fb6 commit 34ac0ac
Show file tree
Hide file tree
Showing 5 changed files with 374 additions and 458 deletions.
9 changes: 3 additions & 6 deletions src/Compilers/CSharp/Portable/Symbols/AssemblySymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -442,19 +442,16 @@ internal bool RuntimeSupportsStaticAbstractMembersInInterfaces

/// <summary>
/// Whether the target runtime supports numeric IntPtr types.
/// This test hook should be removed once TargetFramework.Net70 is added.
/// Tracked by https://github.com/dotnet/roslyn/issues/61235
/// </summary>
internal virtual bool RuntimeSupportsNumericIntPtr
internal bool RuntimeSupportsNumericIntPtr
{
get
{
// CorLibrary should never be null, but that invariant is broken in some cases for MissingAssemblySymbol.
// Tracked by https://github.com/dotnet/roslyn/issues/61262
return CorLibrary?.RuntimeSupportsNumericIntPtr == true;
return CorLibrary is not null &&
RuntimeSupportsFeature(SpecialMember.System_Runtime_CompilerServices_RuntimeFeature__NumericIntPtr);
}

set => CorLibrary.RuntimeSupportsNumericIntPtr = value;
}

protected bool RuntimeSupportsFeature(SpecialMember feature)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,38 +32,6 @@ internal abstract class MetadataOrSourceAssemblySymbol
private int _cachedSpecialTypes;

private NativeIntegerTypeSymbol[] _lazyNativeIntegerTypes;
private ThreeState _lazyRuntimeSupportsNumericIntPtr = ThreeState.Unknown;

internal override bool RuntimeSupportsNumericIntPtr
{
get
{
if ((object)CorLibrary == this)
{
if (!_lazyRuntimeSupportsNumericIntPtr.HasValue())
{
_lazyRuntimeSupportsNumericIntPtr = RuntimeSupportsFeature(SpecialMember.System_Runtime_CompilerServices_RuntimeFeature__NumericIntPtr).ToThreeState();
}

return _lazyRuntimeSupportsNumericIntPtr.Value();
}

return base.RuntimeSupportsNumericIntPtr;
}
set
{
Debug.Assert(value);
Debug.Assert(!RuntimeSupportsFeature(SpecialMember.System_Runtime_CompilerServices_RuntimeFeature__NumericIntPtr));
if ((object)CorLibrary == this)
{
Debug.Assert(!_lazyRuntimeSupportsNumericIntPtr.HasValue());
_lazyRuntimeSupportsNumericIntPtr = value.ToThreeState();
return;
}

base.RuntimeSupportsNumericIntPtr = value;
}
}

/// <summary>
/// Lookup declaration for predefined CorLib type in this Assembly.
Expand Down
15 changes: 0 additions & 15 deletions src/Compilers/CSharp/Portable/Symbols/MissingCorLibrarySymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,5 @@ internal override NamedTypeSymbol GetDeclaredSpecialType(SpecialType type)

return _lazySpecialTypes[(int)type];
}

internal override bool RuntimeSupportsNumericIntPtr
{
get
{
// For now we assume that it is not supported by default
Debug.Assert((object)CorLibrary == this);
return false;
}
set
{
Debug.Assert((object)CorLibrary == this);
throw ExceptionUtilities.Unreachable();
}
}
}
}
Loading

0 comments on commit 34ac0ac

Please sign in to comment.