mirror of
https://github.com/ton-blockchain/ton
synced 2025-02-15 04:32:21 +00:00
16 lines
329 B
Text
16 lines
329 B
Text
fun incrementOrSetNull(mutate x: int?) {
|
|
if (random()) { x! += 1; }
|
|
else { x = null; }
|
|
}
|
|
|
|
fun cantCallMutateMethodNotNullable() {
|
|
var x = 1;
|
|
incrementOrSetNull(mutate x);
|
|
return x;
|
|
}
|
|
|
|
/**
|
|
@compilation_should_fail
|
|
@stderr can not pass `int` to mutate `int?`
|
|
@stderr because mutation is not type compatible
|
|
*/
|