Beef
Beef copied to clipboard
Generic types that call it's own comptime methods will execute with unspecialized parameters, causing errors
class RangeConstraint<TNum, TRange>
where TNum : const int
where TRange : const ClosedRange
{
struct Ok;
public typealias Res = comptype(Check());
// Workaround: uncomment following
//public static bool Contains(Object range, int num) => false;
//public static bool Contains(ClosedRange range, int num) => range.Contains(num);
[Comptime]
static Type Check()
{
// Workaround: uncomment following
// if (!Contains(TRange, TNum))
// return typeof(void);
if (!TRange.Contains(TNum)) // Workaround: comment out
return typeof(void);// Workaround: comment out
return typeof(Ok);
}
}
After workaround, IDE falsely reports errors (on and off) when working in a file containing the code