Files
test-repo/tests/flow/classes/expr.js
T
Christopher Chedeau 3375cfe605 Move tests around (#454)
* new_tests

* move_all_clobbered_tests

* remove all the tests that no longer exist

* re-run flow tests

* Move all the flow tests to tests/flow and prettier to tests/

* Move prettier tests to their own folders

* Add jsfmt files

* run prettier snapshot tests
2017-01-24 14:35:37 -08:00

31 lines
860 B
JavaScript

var Bar = class Foo {
static factory(): Foo { // OK: Foo is a type in this scope
return new Foo() // OK: Foo is a runtime binding in this scope
}
};
var bar1: Bar = new Bar() // OK
var bar2: Bar = Bar.factory() // OK
// NB: Don't write expected errors using Foo to avoid error collapse hiding an
// unexpected failure in the above code.
var B = class Baz { }
var b = new Baz(); // error: Baz is not a runtime binding in this scope
var C = class Qux { }
var c: Qux = new C(); // error: Qux is not a type in this scope
// OK: anon classes create no binding, but can be bound manually
var Anon = class { }
var anon: Anon = new Anon();
class Alias { }
var _Alias = class Alias {
static factory(): Alias {
return new Alias();
}
}
var alias1: Alias = new _Alias(); // error: bad pun
var alias2: Alias = _Alias.factory(); // error: bad pun