mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-25 15:12:12 +00:00
* Add a NATIVE<T> macro type to simplify use of a native WebAssembly type * Add default type parameters for internal helpers for explicit loads and stores * Unify loadUnsafe/loadUnsafeWithOffset etc. into one * Renamed loadUnsafe etc. into just LOAD, like a macro * Implement parsing of index signatures, but ignore them, for properly linting code * Refactor TypedArray<T> to use macros
29 lines
492 B
TypeScript
29 lines
492 B
TypeScript
function testConcrete<T,U = i32>(a: T): U {
|
|
return a;
|
|
}
|
|
|
|
function testDerived<T,U = T>(a: T): U {
|
|
return a;
|
|
}
|
|
|
|
testConcrete<i32>(1);
|
|
testDerived<i32>(2);
|
|
|
|
class TestConcrete<T,U = i32> {
|
|
test<V = i32>(a: T, b: U): V {
|
|
return a + b;
|
|
}
|
|
}
|
|
|
|
class TestDerived<T,U = T> {
|
|
test<V = U>(a: T, b: U): V {
|
|
return a + b;
|
|
}
|
|
}
|
|
|
|
import "allocator/arena";
|
|
var tConcrete = new TestConcrete<i32>();
|
|
tConcrete.test<i32>(1, 2);
|
|
var tDerived = new TestDerived<f64>()
|
|
tDerived.test<f64>(1, 2);
|