2014-07-13 01:04:16 +02:00
|
|
|
//// [assignments.ts]
|
|
|
|
// In this file:
|
|
|
|
// Assign to a module
|
|
|
|
// Assign to a class
|
|
|
|
// Assign to an enum
|
|
|
|
// Assign to a function
|
|
|
|
// Assign to a variable
|
|
|
|
// Assign to a parameter
|
|
|
|
// Assign to an interface
|
|
|
|
|
|
|
|
module M { }
|
|
|
|
M = null; // Error
|
|
|
|
|
|
|
|
class C { }
|
|
|
|
C = null; // Error
|
|
|
|
|
|
|
|
enum E { A }
|
|
|
|
E = null; // Error
|
|
|
|
E.A = null; // OK per spec, Error per implementation (509581)
|
|
|
|
|
|
|
|
function fn() { }
|
|
|
|
fn = null; // Should be error
|
|
|
|
|
|
|
|
var v;
|
|
|
|
v = null; // OK
|
|
|
|
|
|
|
|
function fn2(p) {
|
|
|
|
p = null; // OK
|
|
|
|
}
|
|
|
|
|
|
|
|
interface I { }
|
|
|
|
I = null; // Error
|
|
|
|
|
|
|
|
//// [assignments.js]
|
2014-08-19 19:43:13 +02:00
|
|
|
// In this file:
|
|
|
|
// Assign to a module
|
|
|
|
// Assign to a class
|
|
|
|
// Assign to an enum
|
|
|
|
// Assign to a function
|
|
|
|
// Assign to a variable
|
|
|
|
// Assign to a parameter
|
|
|
|
// Assign to an interface
|
2014-08-16 00:49:09 +02:00
|
|
|
M = null; // Error
|
2014-07-13 01:04:16 +02:00
|
|
|
var C = (function () {
|
|
|
|
function C() {
|
|
|
|
}
|
|
|
|
return C;
|
|
|
|
})();
|
2014-08-16 00:49:09 +02:00
|
|
|
C = null; // Error
|
2014-07-13 01:04:16 +02:00
|
|
|
var E;
|
|
|
|
(function (E) {
|
|
|
|
E[E["A"] = 0] = "A";
|
|
|
|
})(E || (E = {}));
|
2014-08-16 00:49:09 +02:00
|
|
|
E = null; // Error
|
|
|
|
0 /* A */ = null; // OK per spec, Error per implementation (509581)
|
2014-07-13 01:04:16 +02:00
|
|
|
function fn() {
|
|
|
|
}
|
2014-08-16 00:49:09 +02:00
|
|
|
fn = null; // Should be error
|
2014-07-13 01:04:16 +02:00
|
|
|
var v;
|
2014-08-16 00:49:09 +02:00
|
|
|
v = null; // OK
|
2014-07-13 01:04:16 +02:00
|
|
|
function fn2(p) {
|
2014-08-16 00:49:09 +02:00
|
|
|
p = null; // OK
|
2014-07-13 01:04:16 +02:00
|
|
|
}
|
2014-08-16 00:49:09 +02:00
|
|
|
I = null; // Error
|