mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-12 14:31:28 +00:00
Implement optional type parameters (#360)
* 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
This commit is contained in:
3
tests/parser/index-declaration.ts
Normal file
3
tests/parser/index-declaration.ts
Normal file
@ -0,0 +1,3 @@
|
||||
class A {
|
||||
[key: i32]: f64;
|
||||
}
|
3
tests/parser/index-declaration.ts.fixture.ts
Normal file
3
tests/parser/index-declaration.ts.fixture.ts
Normal file
@ -0,0 +1,3 @@
|
||||
class A {
|
||||
[key: i32]: f64;
|
||||
}
|
3
tests/parser/optional-typeparameters.ts
Normal file
3
tests/parser/optional-typeparameters.ts
Normal file
@ -0,0 +1,3 @@
|
||||
function a<T=i32>(): T { return 0; }
|
||||
function a<T,U=i32>(): T { return 0; }
|
||||
function a<T,U=i32,V>(): T { return 0; } // ERROR 2706
|
10
tests/parser/optional-typeparameters.ts.fixture.ts
Normal file
10
tests/parser/optional-typeparameters.ts.fixture.ts
Normal file
@ -0,0 +1,10 @@
|
||||
function a<T=i32>(): T {
|
||||
return 0;
|
||||
}
|
||||
function a<T, U=i32>(): T {
|
||||
return 0;
|
||||
}
|
||||
function a<T, U=i32, V>(): T {
|
||||
return 0;
|
||||
}
|
||||
// ERROR 2706: "Required type parameters may not follow optional type parameters." in optional-typeparameters.ts:3:19
|
Reference in New Issue
Block a user