mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-15 06:44:10 +02:00
30 lines
537 B
Beef
30 lines
537 B
Beef
#pragma warning disable 168
|
|
|
|
using System;
|
|
|
|
namespace Tests
|
|
{
|
|
class Reflection2
|
|
{
|
|
public typealias RemovePtr<T> = comptype(RemovePtr(typeof(T)));
|
|
|
|
[Comptime]
|
|
public static Type RemovePtr(Type type)
|
|
{
|
|
if (type.IsPointer)
|
|
return type.UnderlyingType;
|
|
|
|
return type;
|
|
}
|
|
|
|
[Test]
|
|
public static void TestBasics()
|
|
{
|
|
const Type t = typeof(StringView);
|
|
int fieldCount = t.FieldCount;
|
|
|
|
Test.Assert(typeof(RemovePtr<int32>) == typeof(int32));
|
|
Test.Assert(typeof(RemovePtr<uint32*>) == typeof(uint32));
|
|
}
|
|
}
|
|
}
|