@@ -3931,10 +3931,11 @@ public void testIn3() {
3931
3931
3932
3932
@Test
3933
3933
public void testIn4() {
3934
- testTypes("Date in Object",
3935
- "left side of 'in'\n" +
3936
- "found : function(new:Date, ?=, ?=, ?=, ?=, ?=, ?=, ?=): string\n" +
3937
- "required: string");
3934
+ testTypes(
3935
+ "Date in Object",
3936
+ "left side of 'in'\n"
3937
+ + "found : function(new:Date, ?=, ?=, ?=, ?=, ?=, ?=, ?=): string\n"
3938
+ + "required: (string|symbol)");
3938
3939
}
3939
3940
3940
3941
@Test
@@ -3960,19 +3961,36 @@ public void testIn6() {
3960
3961
public void testIn7() {
3961
3962
// Make sure we do inference in the 'in' expression.
3962
3963
testTypes(
3963
- "/**\n" +
3964
- " * @param {number} x\n" +
3965
- " * @return {number}\n" +
3966
- " */\n" +
3967
- "function g(x) { return 5; }" +
3968
- "function f() {" +
3969
- " var x = {};" +
3970
- " x.foo = '3';" +
3971
- " return g(x.foo) in {};" +
3972
- "}",
3973
- "actual parameter 1 of g does not match formal parameter\n" +
3974
- "found : string\n" +
3975
- "required: number");
3964
+ lines(
3965
+ "/**",
3966
+ " * @param {number} x",
3967
+ " * @return {number}",
3968
+ " */",
3969
+ "function g(x) { return 5; }",
3970
+ "function f() {",
3971
+ " var x = {};",
3972
+ " x.foo = '3';",
3973
+ " return g(x.foo) in {};",
3974
+ "}"),
3975
+ lines(
3976
+ "actual parameter 1 of g does not match formal parameter",
3977
+ "found : string",
3978
+ "required: number"));
3979
+ }
3980
+
3981
+ @Test
3982
+ public void testInWithWellKnownSymbol() {
3983
+ testTypesWithCommonExterns("Symbol.iterator in Object");
3984
+ }
3985
+
3986
+ @Test
3987
+ public void testInWithUniqueSymbol() {
3988
+ testTypes("Symbol('foo') in Object");
3989
+ }
3990
+
3991
+ @Test
3992
+ public void testInWithSymbol() {
3993
+ testTypes("function f(/** symbol */ s) { return s in {}; }");
3976
3994
}
3977
3995
3978
3996
@Test
0 commit comments