Initial type parameter inference, see #61

This catches the most common cases but doesn't yet implement inference involving the return type because some prequesites are not yet in place (see test case).
This commit is contained in:
dcodeIO
2018-04-13 12:25:27 +02:00
parent 748e811137
commit ee73a4d28f
11 changed files with 385 additions and 43 deletions

View File

@ -13,8 +13,22 @@ export declare const NaN: f64; // | f32
export declare const Infinity: f64; // | f32
export declare function isNaN<T>(value: T): bool;
// export function isNaN<T>(value: T): bool {
// return isFloat(value)
// ? sizeof<T>() == 32
// ? (reinterpret<u32>(value) & -1 >>> 1) > 0xFF << 23
// : (reinterpret<u64>(value) & -1 >>> 1) > 0x7FF << 52
// : false;
// }
export declare function isFinite<T>(value: T): bool;
// export function isFinite<T>(value: T): bool {
// return isFloat(value)
// ? sizeof<T>() == 32
// ? (reinterpret<u32>(value) & -1 >>> 1) < 0xFF << 23
// : (reinterpret<u64>(value) & -1 >>> 1) < 0x7FF << 52
// : true;
// }
export declare function clz<T>(value: T): T;