mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-24 12:11:50 +00:00
possible-null assignment to non-null, notes
This commit is contained in:
@ -99,14 +99,23 @@ export function testLogicalAndMulti(a: Ref | null, b: Ref | null): void {
|
||||
if (a && b) {
|
||||
if (isNullable(a)) ERROR("should be non-nullable");
|
||||
if (isNullable(b)) ERROR("should be non-nullable");
|
||||
} else {
|
||||
if (!isNullable(a)) ERROR("should be nullable");
|
||||
if (!isNullable(b)) ERROR("should be nullable");
|
||||
}
|
||||
}
|
||||
|
||||
export function testLogicalOrMulti(a: Ref | null, b: Ref | null): void {
|
||||
if (!a || !b) {
|
||||
// something
|
||||
if (!isNullable(a)) ERROR("should be nullable");
|
||||
if (!isNullable(b)) ERROR("should be nullable");
|
||||
} else {
|
||||
if (isNullable(a)) ERROR("should be non-nullable");
|
||||
if (isNullable(b)) ERROR("should be non-nullable");
|
||||
}
|
||||
}
|
||||
|
||||
export function testAssign(a: Ref | null, b: Ref): void {
|
||||
a = b;
|
||||
if (isNullable(a)) ERROR("should be non-nullable");
|
||||
}
|
||||
|
Reference in New Issue
Block a user