mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-01-13 15:38:06 -05:00
21 lines
313 B
TypeScript
21 lines
313 B
TypeScript
//! test_output(E: TypeError{"message":"Cannot mutate this because it is const"})
|
|
|
|
export default function () {
|
|
const foo = new Foo();
|
|
foo.callInc(); // Should throw
|
|
|
|
return foo.x;
|
|
}
|
|
|
|
class Foo {
|
|
x = 0;
|
|
|
|
inc() {
|
|
this.x++;
|
|
}
|
|
|
|
callInc() {
|
|
this.inc(); // Needs to propagate the constness
|
|
}
|
|
}
|