Skip to content

Commit

Permalink
Work around IsPrimitive compilation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalStrehovsky committed Jan 22, 2024
1 parent 8f2d412 commit 36533db
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/libraries/System.Private.CoreLib/src/System/Type.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,15 @@ public virtual Type[] GetGenericParameterConstraints()
public virtual bool IsEnum { [Intrinsic] get => IsSubclassOf(typeof(Enum)); }
public bool IsMarshalByRef => IsMarshalByRefImpl();
protected virtual bool IsMarshalByRefImpl() => false;
public bool IsPrimitive { [Intrinsic] get => IsPrimitiveImpl(); }
public bool IsPrimitive
{
#if NATIVEAOT
// https://github.com/dotnet/runtime/issues/97272
[MethodImpl(MethodImplOptions.NoOptimization)]
#endif
[Intrinsic]
get => IsPrimitiveImpl();
}
protected abstract bool IsPrimitiveImpl();
public bool IsValueType { [Intrinsic] get => IsValueTypeImpl(); }
protected virtual bool IsValueTypeImpl() => IsSubclassOf(typeof(ValueType));
Expand Down

0 comments on commit 36533db

Please sign in to comment.