@@ -8921,15 +8921,18 @@ public void testHigherOrderFunctions2() {
8921
8921
public void testHigherOrderFunctions3() {
8922
8922
newTest()
8923
8923
.addSource("/** @type {function(this:Array):Date} */var f; new f")
8924
- .addDiagnostic("cannot instantiate non-constructor")
8924
+ .addDiagnostic(
8925
+ "cannot instantiate non-constructor, found type: function(this:Array): (Date|null)")
8925
8926
.run();
8926
8927
}
8927
8928
8928
8929
@Test
8929
8930
public void testHigherOrderFunctions4() {
8930
8931
newTest()
8931
8932
.addSource("/** @type {function(this:Array, ...number):Date} */var f; new f")
8932
- .addDiagnostic("cannot instantiate non-constructor")
8933
+ .addDiagnostic(
8934
+ "cannot instantiate non-constructor, found type: function(this:Array, ...number):"
8935
+ + " (Date|null)")
8933
8936
.run();
8934
8937
}
8935
8938
@@ -11535,14 +11538,21 @@ public void testAssignToUntypedProperty() {
11535
11538
11536
11539
@Test
11537
11540
public void testNew1() {
11538
- newTest().addSource("new 4").addDiagnostic(TypeCheck.NOT_A_CONSTRUCTOR).run();
11541
+ newTest()
11542
+ .addSource("new 4")
11543
+ .addDiagnostic("cannot instantiate non-constructor, found type: number")
11544
+ .run();
11545
+ newTest()
11546
+ .addSource("new 4")
11547
+ .addDiagnostic("cannot instantiate non-constructor, found type: number")
11548
+ .run();
11539
11549
}
11540
11550
11541
11551
@Test
11542
11552
public void testNew2() {
11543
11553
newTest()
11544
11554
.addSource("var Math = {}; new Math()")
11545
- .addDiagnostic(TypeCheck.NOT_A_CONSTRUCTOR )
11555
+ .addDiagnostic("cannot instantiate non-constructor, found type: {}" )
11546
11556
.run();
11547
11557
}
11548
11558
@@ -11560,7 +11570,7 @@ public void testNew4() {
11560
11570
public void testNew5() {
11561
11571
newTest()
11562
11572
.addSource("function A(){}; new A();")
11563
- .addDiagnostic(TypeCheck.NOT_A_CONSTRUCTOR )
11573
+ .addDiagnostic("cannot instantiate non-constructor, found type: function(): undefined" )
11564
11574
.run();
11565
11575
}
11566
11576
@@ -11629,7 +11639,7 @@ public void testNew11() {
11629
11639
+ " var c2 = function(){};"
11630
11640
+ " c1.prototype = new c2;"
11631
11641
+ "}")
11632
- .addDiagnostic(TypeCheck.NOT_A_CONSTRUCTOR )
11642
+ .addDiagnostic("cannot instantiate non-constructor, found type: function(): undefined" )
11633
11643
.run();
11634
11644
}
11635
11645
@@ -11697,7 +11707,7 @@ public void testNew16() {
11697
11707
public void testNew17() {
11698
11708
newTest()
11699
11709
.addSource("var goog = {}; goog.x = 3; new goog.x")
11700
- .addDiagnostic("cannot instantiate non-constructor")
11710
+ .addDiagnostic("cannot instantiate non-constructor, found type: number ")
11701
11711
.run();
11702
11712
}
11703
11713
@@ -14908,7 +14918,7 @@ public void testStaticDataPropertyOnNestedInterface() {
14908
14918
public void testInterfaceInstantiation() {
14909
14919
newTest()
14910
14920
.addSource("/** @interface */var f = function(){}; new f")
14911
- .addDiagnostic("cannot instantiate non-constructor")
14921
+ .addDiagnostic("cannot instantiate non-constructor, found type: (typeof f) ")
14912
14922
.run();
14913
14923
}
14914
14924
@@ -16935,7 +16945,7 @@ public void testTypeCheckStandaloneAST() {
16935
16945
16936
16946
assertThat(compiler.getWarningCount()).isEqualTo(1);
16937
16947
assertThat(compiler.getWarnings().get(0).getDescription())
16938
- .isEqualTo("cannot instantiate non-constructor");
16948
+ .isEqualTo("cannot instantiate non-constructor, found type: function(): undefined ");
16939
16949
}
16940
16950
16941
16951
@Test
@@ -21446,7 +21456,7 @@ public void testSymbol2() {
21446
21456
.addSource(
21447
21457
"/** @const */", //
21448
21458
"var o = new Symbol();")
21449
- .addDiagnostic("cannot instantiate non-constructor")
21459
+ .addDiagnostic("cannot instantiate non-constructor, found type: (typeof Symbol) ")
21450
21460
.includeDefaultExterns()
21451
21461
.run();
21452
21462
}
0 commit comments