mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-12 06:21:29 +00:00
Support definite assignment assertion x!: i32
(#260)
This commit is contained in:
committed by
Daniel Wirtz
parent
e58582e9e9
commit
0bb5cb829e
9
tests/parser/definite-assignment-assertion.ts
Normal file
9
tests/parser/definite-assignment-assertion.ts
Normal file
@ -0,0 +1,9 @@
|
||||
class C {
|
||||
x!: i32;
|
||||
x!: i32 = 0;
|
||||
static x!: i32;
|
||||
}
|
||||
function f(): void {
|
||||
let x!: i32;
|
||||
let x!: i32 = 0;
|
||||
}
|
12
tests/parser/definite-assignment-assertion.ts.fixture.ts
Normal file
12
tests/parser/definite-assignment-assertion.ts.fixture.ts
Normal file
@ -0,0 +1,12 @@
|
||||
class C {
|
||||
x!: i32;
|
||||
x!: i32 = 0;
|
||||
static x!: i32;
|
||||
}
|
||||
function f(): void {
|
||||
let x!: i32;
|
||||
let x!: i32 = 0;
|
||||
}
|
||||
// ERROR 1255: "A definite assignment assertion '!' is not permitted in this context." in definite-assignment-assertion.ts:3:10
|
||||
// ERROR 1255: "A definite assignment assertion '!' is not permitted in this context." in definite-assignment-assertion.ts:4:14
|
||||
// ERROR 1255: "A definite assignment assertion '!' is not permitted in this context." in definite-assignment-assertion.ts:8:6
|
3
tests/parser/optional-property.ts
Normal file
3
tests/parser/optional-property.ts
Normal file
@ -0,0 +1,3 @@
|
||||
class C {
|
||||
x?: i32;
|
||||
}
|
4
tests/parser/optional-property.ts.fixture.ts
Normal file
4
tests/parser/optional-property.ts.fixture.ts
Normal file
@ -0,0 +1,4 @@
|
||||
class C {
|
||||
x: i32;
|
||||
}
|
||||
// ERROR 219: "Optional properties are not supported." in optional-property.ts:2:9
|
Reference in New Issue
Block a user