From 5af94fa0ca4b106e55e02eace7ce0ca90c78b986 Mon Sep 17 00:00:00 2001 From: csigs Date: Tue, 25 Feb 2020 16:10:24 +0000 Subject: [PATCH 01/17] LEGO: check in for master to temporary branch. --- .../diagnosticMessages.generated.json.lcl | 1054 ++++++++++++++++- .../diagnosticMessages.generated.json.lcl | 376 +++++- .../diagnosticMessages.generated.json.lcl | 1054 ++++++++++++++++- .../diagnosticMessages.generated.json.lcl | 1054 ++++++++++++++++- .../diagnosticMessages.generated.json.lcl | 1054 ++++++++++++++++- 5 files changed, 4552 insertions(+), 40 deletions(-) diff --git a/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl index 30f53dedccb..8ef087c7cfa 100644 --- a/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -51,12 +51,18 @@ + + + + + + @@ -99,6 +105,9 @@ + + + @@ -216,6 +225,9 @@ + + + @@ -231,6 +243,9 @@ + + + @@ -420,6 +435,9 @@ + + + @@ -435,6 +453,9 @@ + + + @@ -510,12 +531,18 @@ + + + + + + @@ -594,6 +621,9 @@ + + + @@ -648,12 +678,18 @@ + + + + + + @@ -777,8 +813,8 @@ - - + + @@ -834,6 +870,9 @@ + + + @@ -978,6 +1017,9 @@ + + + @@ -1011,18 +1053,27 @@ + + + + + + + + + @@ -1038,18 +1089,27 @@ + + + + + + + + + @@ -1074,6 +1134,9 @@ + + + @@ -1110,18 +1173,27 @@ + + + + + + + + + @@ -1149,6 +1221,9 @@ + + + @@ -1164,6 +1239,9 @@ + + + @@ -1215,12 +1293,18 @@ + + + + + + @@ -1290,6 +1374,9 @@ + + + @@ -1305,6 +1392,9 @@ + + + @@ -1320,6 +1410,9 @@ + + + @@ -1344,6 +1437,9 @@ + + + @@ -1386,12 +1482,18 @@ + + + + + + @@ -1416,24 +1518,36 @@ + + + + + + + + + + + + @@ -1485,6 +1599,9 @@ + + + @@ -1500,6 +1617,9 @@ + + + @@ -1560,6 +1680,9 @@ + + + @@ -1575,6 +1698,9 @@ + + + @@ -1590,12 +1716,18 @@ + + + + + + @@ -1719,6 +1851,9 @@ + + + @@ -1734,6 +1869,9 @@ + + + @@ -1794,12 +1932,18 @@ + + + + + + @@ -1851,12 +1995,18 @@ + + + + + + @@ -1902,12 +2052,18 @@ + + + + + + @@ -1959,6 +2115,9 @@ + + + @@ -1992,6 +2151,9 @@ + + + @@ -2043,6 +2205,9 @@ + + + @@ -2070,6 +2235,9 @@ + + + @@ -2085,6 +2253,9 @@ + + + @@ -2109,6 +2280,9 @@ + + + @@ -2133,12 +2307,18 @@ + + + + + + @@ -2190,6 +2370,9 @@ + + + @@ -2223,6 +2406,9 @@ + + + @@ -2286,6 +2472,9 @@ + + + @@ -2328,48 +2517,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -2457,18 +2670,27 @@ + + + + + + + + + @@ -2526,6 +2748,9 @@ + + + @@ -2568,6 +2793,9 @@ + + + @@ -2700,6 +2928,9 @@ + + + @@ -2826,6 +3057,9 @@ + + + @@ -2868,6 +3102,9 @@ + + + @@ -2883,6 +3120,9 @@ + + + @@ -2925,12 +3165,18 @@ + + + + + + @@ -2946,6 +3192,9 @@ + + + @@ -2997,6 +3246,9 @@ + + + @@ -3021,12 +3273,18 @@ + + + + + + @@ -3042,12 +3300,18 @@ + + + + + + @@ -3063,12 +3327,18 @@ + + + + + + @@ -3093,12 +3363,18 @@ + + + + + + @@ -3123,6 +3399,9 @@ + + + @@ -3147,12 +3426,18 @@ + + + + + + @@ -3168,18 +3453,27 @@ + + + + + + + + + @@ -3225,12 +3519,18 @@ + + + + + + @@ -3264,6 +3564,9 @@ + + + @@ -3345,12 +3648,18 @@ + + + + + + @@ -3402,42 +3711,63 @@ + + + + + + {1}'?]]> + + {1}'?]]> + + + + + + + + + + + + + @@ -3483,6 +3813,9 @@ + + + @@ -3498,6 +3831,9 @@ + + + @@ -3732,6 +4068,9 @@ + + + @@ -3774,24 +4113,36 @@ + + + + + + + + + + + + @@ -3816,6 +4167,9 @@ + + + @@ -3840,6 +4194,9 @@ + + + @@ -3882,6 +4239,9 @@ + + + @@ -3915,12 +4275,18 @@ + + + + + + @@ -4038,6 +4404,9 @@ + + + @@ -4152,6 +4521,9 @@ + + + @@ -4167,8 +4539,8 @@ - - + + @@ -4308,6 +4680,9 @@ + + + @@ -4395,24 +4770,36 @@ + + + + + + + + + + + + @@ -4473,6 +4860,9 @@ + + + @@ -4488,6 +4878,9 @@ + + + @@ -4503,6 +4896,9 @@ + + + @@ -4596,6 +4992,9 @@ + + + @@ -4737,6 +5136,9 @@ + + + @@ -4752,6 +5154,9 @@ + + + @@ -4785,6 +5190,9 @@ + + + @@ -4881,6 +5289,9 @@ + + + @@ -4926,6 +5337,9 @@ + + + @@ -4950,6 +5364,9 @@ + + + @@ -5019,6 +5436,9 @@ + + + @@ -5076,6 +5496,9 @@ + + + @@ -5214,6 +5637,9 @@ + + + @@ -5493,6 +5919,9 @@ + + + @@ -5622,6 +6051,9 @@ + + + @@ -5694,6 +6126,9 @@ + + + @@ -5874,6 +6309,9 @@ + + + @@ -5943,24 +6381,36 @@ + + + + + + + + + + + + @@ -5994,6 +6444,9 @@ + + + @@ -6018,6 +6471,9 @@ + + + @@ -6072,6 +6528,9 @@ + + + @@ -6114,6 +6573,9 @@ + + + @@ -6204,18 +6666,27 @@ + + + + + + + + + @@ -6231,24 +6702,36 @@ + + + + + + + + + + + + @@ -6273,12 +6756,18 @@ + + + + + + @@ -6294,12 +6783,18 @@ + + + + + + @@ -6315,6 +6810,9 @@ + + + @@ -6438,6 +6936,9 @@ + + + @@ -6519,6 +7020,9 @@ + + + @@ -6552,6 +7056,9 @@ + + + @@ -6603,6 +7110,9 @@ + + + @@ -6636,6 +7146,9 @@ + + + @@ -6696,6 +7209,9 @@ + + + @@ -6765,6 +7281,9 @@ + + + @@ -6780,18 +7299,27 @@ + + + + + + + + + @@ -6996,12 +7524,18 @@ + + + + + + @@ -7080,6 +7614,9 @@ + + + @@ -7095,6 +7632,9 @@ + + + @@ -7110,6 +7650,9 @@ + + + @@ -7134,6 +7677,9 @@ + + + @@ -7149,30 +7695,45 @@ + + + + + + + + + + + + + + + @@ -7188,6 +7749,9 @@ + + + @@ -7221,12 +7785,18 @@ + + + + + + @@ -7350,12 +7920,18 @@ + + + + + + @@ -7383,12 +7959,18 @@ + + + + + + @@ -7413,6 +7995,9 @@ + + + @@ -7428,12 +8013,18 @@ + + + + + + @@ -7512,6 +8103,9 @@ + + + @@ -7572,12 +8166,18 @@ + + + + + + @@ -7737,6 +8337,9 @@ + + + @@ -7761,6 +8364,9 @@ + + + @@ -7785,6 +8391,9 @@ + + + @@ -7836,18 +8445,27 @@ + + + + + + + + + @@ -7863,6 +8481,9 @@ + + + @@ -7887,6 +8508,9 @@ + + + @@ -7902,6 +8526,9 @@ + + + @@ -8085,12 +8712,18 @@ + + + + + + @@ -8106,6 +8739,9 @@ + + + @@ -8397,12 +9033,18 @@ + + + + + + @@ -8481,6 +9123,9 @@ + + + @@ -8514,6 +9159,9 @@ + + + @@ -8529,12 +9177,18 @@ + + + + + + @@ -8550,6 +9204,9 @@ + + + @@ -8565,18 +9222,27 @@ + + + + + + + + + @@ -8628,12 +9294,18 @@ + + + + + + @@ -8769,6 +9441,9 @@ + + + @@ -8838,6 +9513,9 @@ + + + @@ -8853,12 +9531,18 @@ + + + + + + @@ -8883,12 +9567,18 @@ + + + + + + @@ -8940,6 +9630,9 @@ + + + @@ -8964,24 +9657,36 @@ + + + + + + + + + + + + @@ -9006,6 +9711,9 @@ + + + @@ -9033,18 +9741,27 @@ + + + + + + + + + @@ -9060,12 +9777,18 @@ + + + + + + @@ -9090,6 +9813,9 @@ + + + @@ -9123,6 +9849,9 @@ + + + @@ -9138,12 +9867,18 @@ + + + + + + @@ -9198,14 +9933,17 @@ + + + - - + + @@ -9216,8 +9954,8 @@ - - + + @@ -9228,6 +9966,9 @@ + + + @@ -9243,12 +9984,18 @@ + + + + + + @@ -9309,6 +10056,9 @@ + + + @@ -9336,6 +10086,9 @@ + + + @@ -9363,6 +10116,9 @@ + + + @@ -9396,6 +10152,9 @@ + + + @@ -9411,30 +10170,45 @@ + + + + + + + + + + + + + + + @@ -9468,24 +10242,36 @@ + + + + + + + + + + + + @@ -9501,48 +10287,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -9558,18 +10368,27 @@ + + + + + + + + + @@ -9594,6 +10413,9 @@ + + + @@ -9621,12 +10443,18 @@ + + + + + + @@ -9660,12 +10488,18 @@ + + + + + + @@ -9690,12 +10524,18 @@ + + + + + + @@ -9861,6 +10701,9 @@ + + + @@ -9876,6 +10719,9 @@ + + + @@ -9909,6 +10755,9 @@ + + + @@ -9924,12 +10773,18 @@ + + + + + + @@ -9954,6 +10809,9 @@ + + + @@ -9978,6 +10836,9 @@ + + + @@ -10002,6 +10863,9 @@ + + + @@ -10071,6 +10935,9 @@ + + + @@ -10122,12 +10989,18 @@ + + + + + + @@ -10191,6 +11064,9 @@ + + + @@ -10305,12 +11181,18 @@ '}` or `>`?]]> + + '}` 或 `>`?]]> + + + + @@ -10326,12 +11208,18 @@ + + + + + + @@ -10347,6 +11235,9 @@ + + + @@ -10371,18 +11262,27 @@ + + + + + + + + + @@ -10470,6 +11370,9 @@ + + + @@ -10485,6 +11388,9 @@ + + + @@ -10509,6 +11415,9 @@ + + + @@ -10551,12 +11460,18 @@ + + + + + + @@ -10617,6 +11532,9 @@ + + + @@ -10632,12 +11550,18 @@ + + + + + + @@ -10671,6 +11595,9 @@ + + + @@ -10686,24 +11613,36 @@ + + + + + + + + + + + + @@ -10719,6 +11658,9 @@ + + + @@ -10752,6 +11694,9 @@ + + + @@ -10776,18 +11721,27 @@ + + + + + + + + + @@ -10821,6 +11775,9 @@ + + + @@ -10944,6 +11901,9 @@ + + + @@ -10959,6 +11919,9 @@ + + + @@ -10983,6 +11946,9 @@ + + + @@ -10998,6 +11964,9 @@ + + + @@ -11022,18 +11991,27 @@ + + + + + + + + + @@ -11049,6 +12027,9 @@ + + + @@ -11064,18 +12045,27 @@ + + + + + + + + + @@ -11091,6 +12081,9 @@ + + + @@ -11109,6 +12102,9 @@ + + + @@ -11181,6 +12177,9 @@ + + + @@ -11199,6 +12198,9 @@ + + + @@ -11223,6 +12225,9 @@ + + + @@ -11310,12 +12315,18 @@ + + + + + + @@ -11385,12 +12396,18 @@ + + + + + + @@ -11406,18 +12423,27 @@ + + + + + + + + + @@ -11442,6 +12468,9 @@ + + + @@ -11514,6 +12543,9 @@ + + + @@ -11637,12 +12669,18 @@ + + + + + + diff --git a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl index 95ea52c8066..f7db3963f3a 100644 --- a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -60,12 +60,18 @@ + + + + + + @@ -108,6 +114,9 @@ + + + @@ -225,6 +234,9 @@ + + + @@ -240,6 +252,9 @@ + + + @@ -444,6 +459,9 @@ + + + @@ -603,6 +621,9 @@ + + + @@ -657,12 +678,18 @@ + + + + + + @@ -786,8 +813,8 @@ - - + + @@ -987,6 +1014,9 @@ + + + @@ -1020,18 +1050,27 @@ + + + + + + + + + @@ -1047,18 +1086,27 @@ + + + + + + + + + @@ -1083,6 +1131,9 @@ + + + @@ -1119,18 +1170,27 @@ + + + + + + + + + @@ -1161,6 +1221,9 @@ + + + @@ -1176,6 +1239,9 @@ + + + @@ -1227,12 +1293,18 @@ + + + + + + @@ -1302,6 +1374,9 @@ + + + @@ -1356,6 +1431,9 @@ + + + @@ -1398,12 +1476,18 @@ + + + + + + @@ -1428,24 +1512,36 @@ + + + + + + + + + + + + @@ -1497,6 +1593,9 @@ + + + @@ -1512,6 +1611,9 @@ + + + @@ -1572,6 +1674,9 @@ + + + @@ -1587,6 +1692,9 @@ + + + @@ -1731,6 +1839,9 @@ + + + @@ -1869,6 +1980,9 @@ + + + @@ -2055,6 +2169,9 @@ + + + @@ -2145,12 +2262,18 @@ + + + + + + @@ -2235,6 +2358,9 @@ + + + @@ -3075,12 +3201,18 @@ + + + + + + @@ -3105,12 +3237,18 @@ + + + + + + @@ -3135,6 +3273,9 @@ + + + @@ -3159,12 +3300,18 @@ + + + + + + @@ -3180,6 +3327,9 @@ + + + @@ -3192,6 +3342,9 @@ + + + @@ -3414,6 +3567,9 @@ + + + @@ -3744,6 +3900,9 @@ + + + @@ -3828,6 +3987,9 @@ + + + @@ -4164,6 +4326,9 @@ + + + @@ -4179,8 +4344,8 @@ - - + + @@ -4425,6 +4590,9 @@ + + + @@ -4485,6 +4653,9 @@ + + + @@ -4515,6 +4686,9 @@ + + + @@ -4749,6 +4923,9 @@ + + + @@ -4797,6 +4974,9 @@ + + + @@ -4938,6 +5118,9 @@ + + + @@ -5706,6 +5889,9 @@ + + + @@ -5973,6 +6159,9 @@ + + + @@ -6126,6 +6315,9 @@ + + + @@ -6531,6 +6723,9 @@ + + + @@ -6792,18 +6987,27 @@ + + + + + + + + + @@ -7173,6 +7377,9 @@ + + + @@ -7200,6 +7407,9 @@ + + + @@ -7239,6 +7449,9 @@ + + + @@ -7401,6 +7614,9 @@ + + + @@ -7440,6 +7656,9 @@ + + + @@ -7584,6 +7803,9 @@ + + + @@ -7854,6 +8076,9 @@ + + + @@ -8103,6 +8328,9 @@ + + + @@ -8493,6 +8721,9 @@ + + + @@ -8526,6 +8757,9 @@ + + + @@ -8589,6 +8823,9 @@ + + + @@ -8781,6 +9018,9 @@ + + + @@ -9150,6 +9390,9 @@ + + + @@ -9216,8 +9459,8 @@ - - + + @@ -9228,8 +9471,8 @@ - - + + @@ -9321,6 +9564,9 @@ + + + @@ -9429,12 +9675,18 @@ + + + + + + @@ -9606,6 +9858,9 @@ + + + @@ -9672,12 +9927,18 @@ + + + + + + @@ -9966,6 +10227,9 @@ + + + @@ -10083,6 +10347,9 @@ + + + @@ -10203,6 +10470,9 @@ + + + @@ -10317,12 +10587,18 @@ '}` or `>`?]]> + + '}" o ">"?]]> + + + + @@ -10338,12 +10614,18 @@ + + + + + + @@ -10359,6 +10641,9 @@ + + + @@ -10389,6 +10674,9 @@ + + + @@ -10482,6 +10770,9 @@ + + + @@ -10497,6 +10788,9 @@ + + + @@ -10629,6 +10923,9 @@ + + + @@ -10683,6 +10980,9 @@ + + + @@ -10698,24 +10998,36 @@ + + + + + + + + + + + + @@ -10788,18 +11100,27 @@ + + + + + + + + + @@ -10833,6 +11154,9 @@ + + + @@ -10956,6 +11280,9 @@ + + + @@ -10971,6 +11298,9 @@ + + + @@ -10995,6 +11325,9 @@ + + + @@ -11010,6 +11343,9 @@ + + + @@ -11034,18 +11370,27 @@ + + + + + + + + + @@ -11061,6 +11406,9 @@ + + + @@ -11076,6 +11424,9 @@ + + + @@ -11121,6 +11472,9 @@ + + + @@ -11211,6 +11565,9 @@ + + + @@ -11328,6 +11685,9 @@ + + + diff --git a/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl index 558cd4b5030..4cd8dd1fd21 100644 --- a/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -51,12 +51,18 @@ + + + + + + @@ -99,6 +105,9 @@ + + + @@ -216,6 +225,9 @@ + + + @@ -231,6 +243,9 @@ + + + @@ -420,6 +435,9 @@ + + + @@ -435,6 +453,9 @@ + + + @@ -510,12 +531,18 @@ + + + + + + @@ -594,6 +621,9 @@ + + + @@ -648,12 +678,18 @@ + + + + + + @@ -777,8 +813,8 @@ - - + + @@ -834,6 +870,9 @@ + + + @@ -978,6 +1017,9 @@ + + + @@ -1011,18 +1053,27 @@ + + + + + + + + + @@ -1038,18 +1089,27 @@ + + + + + + + + + @@ -1074,6 +1134,9 @@ + + + @@ -1110,18 +1173,27 @@ + + + + + + + + + @@ -1149,6 +1221,9 @@ + + + @@ -1164,6 +1239,9 @@ + + + @@ -1215,12 +1293,18 @@ + + + + + + @@ -1290,6 +1374,9 @@ + + + @@ -1305,6 +1392,9 @@ + + + @@ -1320,6 +1410,9 @@ + + + @@ -1344,6 +1437,9 @@ + + + @@ -1386,12 +1482,18 @@ + + + + + + @@ -1416,24 +1518,36 @@ + + + + + + + + + + + + @@ -1485,6 +1599,9 @@ + + + @@ -1500,6 +1617,9 @@ + + + @@ -1560,6 +1680,9 @@ + + + @@ -1575,6 +1698,9 @@ + + + @@ -1590,12 +1716,18 @@ + + + + + + @@ -1719,6 +1851,9 @@ + + + @@ -1734,6 +1869,9 @@ + + + @@ -1794,12 +1932,18 @@ + + + + + + @@ -1851,12 +1995,18 @@ + + + + + + @@ -1902,12 +2052,18 @@ + + + + + + @@ -1959,6 +2115,9 @@ + + + @@ -1992,6 +2151,9 @@ + + + @@ -2043,6 +2205,9 @@ + + + @@ -2070,6 +2235,9 @@ + + + @@ -2085,6 +2253,9 @@ + + + @@ -2109,6 +2280,9 @@ + + + @@ -2133,12 +2307,18 @@ + + + + + + @@ -2190,6 +2370,9 @@ + + + @@ -2223,6 +2406,9 @@ + + + @@ -2286,6 +2472,9 @@ + + + @@ -2328,48 +2517,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -2457,18 +2670,27 @@ + + + + + + + + + @@ -2526,6 +2748,9 @@ + + + @@ -2568,6 +2793,9 @@ + + + @@ -2700,6 +2928,9 @@ + + + @@ -2826,6 +3057,9 @@ + + + @@ -2868,6 +3102,9 @@ + + + @@ -2883,6 +3120,9 @@ + + + @@ -2925,12 +3165,18 @@ + + + + + + @@ -2946,6 +3192,9 @@ + + + @@ -2997,6 +3246,9 @@ + + + @@ -3021,12 +3273,18 @@ + + + + + + @@ -3042,12 +3300,18 @@ + + + + + + @@ -3063,12 +3327,18 @@ + + + + + + @@ -3093,12 +3363,18 @@ + + + + + + @@ -3123,6 +3399,9 @@ + + + @@ -3147,12 +3426,18 @@ + + + + + + @@ -3168,18 +3453,27 @@ + + + + + + + + + @@ -3225,12 +3519,18 @@ + + + + + + @@ -3264,6 +3564,9 @@ + + + @@ -3345,12 +3648,18 @@ + + + + + + @@ -3402,42 +3711,63 @@ + + + + + + {1}'?]]> + + {1}' に制約されることを意図していましたか?]]> + + + + + + + + + + + + + @@ -3483,6 +3813,9 @@ + + + @@ -3498,6 +3831,9 @@ + + + @@ -3732,6 +4068,9 @@ + + + @@ -3774,24 +4113,36 @@ + + + + + + + + + + + + @@ -3816,6 +4167,9 @@ + + + @@ -3840,6 +4194,9 @@ + + + @@ -3882,6 +4239,9 @@ + + + @@ -3915,12 +4275,18 @@ + + + + + + @@ -4038,6 +4404,9 @@ + + + @@ -4152,6 +4521,9 @@ + + + @@ -4167,8 +4539,8 @@ - - + + @@ -4308,6 +4680,9 @@ + + + @@ -4395,24 +4770,36 @@ + + + + + + + + + + + + @@ -4473,6 +4860,9 @@ + + + @@ -4488,6 +4878,9 @@ + + + @@ -4503,6 +4896,9 @@ + + + @@ -4596,6 +4992,9 @@ + + + @@ -4737,6 +5136,9 @@ + + + @@ -4752,6 +5154,9 @@ + + + @@ -4785,6 +5190,9 @@ + + + @@ -4881,6 +5289,9 @@ + + + @@ -4926,6 +5337,9 @@ + + + @@ -4950,6 +5364,9 @@ + + + @@ -5019,6 +5436,9 @@ + + + @@ -5076,6 +5496,9 @@ + + + @@ -5214,6 +5637,9 @@ + + + @@ -5493,6 +5919,9 @@ + + + @@ -5622,6 +6051,9 @@ + + + @@ -5694,6 +6126,9 @@ + + + @@ -5874,6 +6309,9 @@ + + + @@ -5943,24 +6381,36 @@ + + + + + + + + + + + + @@ -5994,6 +6444,9 @@ + + + @@ -6018,6 +6471,9 @@ + + + @@ -6072,6 +6528,9 @@ + + + @@ -6114,6 +6573,9 @@ + + + @@ -6204,18 +6666,27 @@ + + + + + + + + + @@ -6231,24 +6702,36 @@ + + + + + + + + + + + + @@ -6273,12 +6756,18 @@ + + + + + + @@ -6294,12 +6783,18 @@ + + + + + + @@ -6315,6 +6810,9 @@ + + + @@ -6438,6 +6936,9 @@ + + + @@ -6519,6 +7020,9 @@ + + + @@ -6552,6 +7056,9 @@ + + + @@ -6603,6 +7110,9 @@ + + + @@ -6636,6 +7146,9 @@ + + + @@ -6696,6 +7209,9 @@ + + + @@ -6765,6 +7281,9 @@ + + + @@ -6780,18 +7299,27 @@ + + + + + + + + + @@ -6996,12 +7524,18 @@ + + + + + + @@ -7080,6 +7614,9 @@ + + + @@ -7095,6 +7632,9 @@ + + + @@ -7110,6 +7650,9 @@ + + + @@ -7134,6 +7677,9 @@ + + + @@ -7149,30 +7695,45 @@ + + + + + + + + + + + + + + + @@ -7188,6 +7749,9 @@ + + + @@ -7221,12 +7785,18 @@ + + + + + + @@ -7350,12 +7920,18 @@ + + + + + + @@ -7383,12 +7959,18 @@ + + + + + + @@ -7413,6 +7995,9 @@ + + + @@ -7428,12 +8013,18 @@ + + + + + + @@ -7512,6 +8103,9 @@ + + + @@ -7572,12 +8166,18 @@ + + + + + + @@ -7737,6 +8337,9 @@ + + + @@ -7761,6 +8364,9 @@ + + + @@ -7785,6 +8391,9 @@ + + + @@ -7836,18 +8445,27 @@ + + + + + + + + + @@ -7863,6 +8481,9 @@ + + + @@ -7887,6 +8508,9 @@ + + + @@ -7902,6 +8526,9 @@ + + + @@ -8085,12 +8712,18 @@ + + + + + + @@ -8106,6 +8739,9 @@ + + + @@ -8397,12 +9033,18 @@ + + + + + + @@ -8481,6 +9123,9 @@ + + + @@ -8514,6 +9159,9 @@ + + + @@ -8529,12 +9177,18 @@ + + + + + + @@ -8550,6 +9204,9 @@ + + + @@ -8565,18 +9222,27 @@ + + + + + + + + + @@ -8628,12 +9294,18 @@ + + + + + + @@ -8769,6 +9441,9 @@ + + + @@ -8838,6 +9513,9 @@ + + + @@ -8853,12 +9531,18 @@ + + + + + + @@ -8883,12 +9567,18 @@ + + + + + + @@ -8940,6 +9630,9 @@ + + + @@ -8964,24 +9657,36 @@ + + + + + + + + + + + + @@ -9006,6 +9711,9 @@ + + + @@ -9033,18 +9741,27 @@ + + + + + + + + + @@ -9060,12 +9777,18 @@ + + + + + + @@ -9090,6 +9813,9 @@ + + + @@ -9123,6 +9849,9 @@ + + + @@ -9138,12 +9867,18 @@ + + + + + + @@ -9198,14 +9933,17 @@ + + + - - + + @@ -9216,8 +9954,8 @@ - - + + @@ -9228,6 +9966,9 @@ + + + @@ -9243,12 +9984,18 @@ + + + + + + @@ -9309,6 +10056,9 @@ + + + @@ -9336,6 +10086,9 @@ + + + @@ -9363,6 +10116,9 @@ + + + @@ -9396,6 +10152,9 @@ + + + @@ -9411,30 +10170,45 @@ + + + + + + + + + + + + + + + @@ -9468,24 +10242,36 @@ + + + + + + + + + + + + @@ -9501,48 +10287,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -9558,18 +10368,27 @@ + + + + + + + + + @@ -9594,6 +10413,9 @@ + + + @@ -9621,12 +10443,18 @@ + + + + + + @@ -9660,12 +10488,18 @@ + + + + + + @@ -9690,12 +10524,18 @@ + + + + + + @@ -9861,6 +10701,9 @@ + + + @@ -9876,6 +10719,9 @@ + + + @@ -9909,6 +10755,9 @@ + + + @@ -9924,12 +10773,18 @@ + + + + + + @@ -9954,6 +10809,9 @@ + + + @@ -9978,6 +10836,9 @@ + + + @@ -10002,6 +10863,9 @@ + + + @@ -10071,6 +10935,9 @@ + + + @@ -10122,12 +10989,18 @@ + + + + + + @@ -10191,6 +11064,9 @@ + + + @@ -10305,12 +11181,18 @@ '}` or `>`?]]> + + '}` または `>` を意図していましたか?]]> + + + + @@ -10326,12 +11208,18 @@ + + + + + + @@ -10347,6 +11235,9 @@ + + + @@ -10371,18 +11262,27 @@ + + + + + + + + + @@ -10470,6 +11370,9 @@ + + + @@ -10485,6 +11388,9 @@ + + + @@ -10509,6 +11415,9 @@ + + + @@ -10551,12 +11460,18 @@ + + + + + + @@ -10617,6 +11532,9 @@ + + + @@ -10632,12 +11550,18 @@ + + + + + + @@ -10671,6 +11595,9 @@ + + + @@ -10686,24 +11613,36 @@ + + + + + + + + + + + + @@ -10719,6 +11658,9 @@ + + + @@ -10752,6 +11694,9 @@ + + + @@ -10776,18 +11721,27 @@ + + + + + + + + + @@ -10821,6 +11775,9 @@ + + + @@ -10944,6 +11901,9 @@ + + + @@ -10959,6 +11919,9 @@ + + + @@ -10983,6 +11946,9 @@ + + + @@ -10998,6 +11964,9 @@ + + + @@ -11022,18 +11991,27 @@ + + + + + + + + + @@ -11049,6 +12027,9 @@ + + + @@ -11064,18 +12045,27 @@ + + + + + + + + + @@ -11091,6 +12081,9 @@ + + + @@ -11109,6 +12102,9 @@ + + + @@ -11181,6 +12177,9 @@ + + + @@ -11199,6 +12198,9 @@ + + + @@ -11223,6 +12225,9 @@ + + + @@ -11310,12 +12315,18 @@ + + + + + + @@ -11385,12 +12396,18 @@ + + + + + + @@ -11406,18 +12423,27 @@ + + + + + + + + + @@ -11442,6 +12468,9 @@ + + + @@ -11514,6 +12543,9 @@ + + + @@ -11637,12 +12669,18 @@ + + + + + + diff --git a/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl index 8f80af7f420..f0ab463a4d7 100644 --- a/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -51,12 +51,18 @@ + + + + + + @@ -99,6 +105,9 @@ + + + @@ -216,6 +225,9 @@ + + + @@ -231,6 +243,9 @@ + + + @@ -420,6 +435,9 @@ + + + @@ -435,6 +453,9 @@ + + + @@ -510,12 +531,18 @@ + + + + + + @@ -594,6 +621,9 @@ + + + @@ -648,12 +678,18 @@ + + + + + + @@ -777,8 +813,8 @@ - - + + @@ -834,6 +870,9 @@ + + + @@ -978,6 +1017,9 @@ + + + @@ -1011,18 +1053,27 @@ + + + + + + + + + @@ -1038,18 +1089,27 @@ + + + + + + + + + @@ -1074,6 +1134,9 @@ + + + @@ -1110,18 +1173,27 @@ + + + + + + + + + @@ -1149,6 +1221,9 @@ + + + @@ -1164,6 +1239,9 @@ + + + @@ -1215,12 +1293,18 @@ + + + + + + @@ -1290,6 +1374,9 @@ + + + @@ -1305,6 +1392,9 @@ + + + @@ -1320,6 +1410,9 @@ + + + @@ -1344,6 +1437,9 @@ + + + @@ -1386,12 +1482,18 @@ + + + + + + @@ -1416,24 +1518,36 @@ + + + + + + + + + + + + @@ -1485,6 +1599,9 @@ + + + @@ -1500,6 +1617,9 @@ + + + @@ -1560,6 +1680,9 @@ + + + @@ -1575,6 +1698,9 @@ + + + @@ -1590,12 +1716,18 @@ + + + + + + @@ -1719,6 +1851,9 @@ + + + @@ -1734,6 +1869,9 @@ + + + @@ -1794,12 +1932,18 @@ + + + + + + @@ -1851,12 +1995,18 @@ + + + + + + @@ -1902,12 +2052,18 @@ + + + + + + @@ -1959,6 +2115,9 @@ + + + @@ -1992,6 +2151,9 @@ + + + @@ -2043,6 +2205,9 @@ + + + @@ -2070,6 +2235,9 @@ + + + @@ -2085,6 +2253,9 @@ + + + @@ -2109,6 +2280,9 @@ + + + @@ -2133,12 +2307,18 @@ + + + + + + @@ -2190,6 +2370,9 @@ + + + @@ -2223,6 +2406,9 @@ + + + @@ -2286,6 +2472,9 @@ + + + @@ -2328,48 +2517,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -2457,18 +2670,27 @@ + + + + + + + + + @@ -2526,6 +2748,9 @@ + + + @@ -2568,6 +2793,9 @@ + + + @@ -2700,6 +2928,9 @@ + + + @@ -2826,6 +3057,9 @@ + + + @@ -2868,6 +3102,9 @@ + + + @@ -2883,6 +3120,9 @@ + + + @@ -2925,12 +3165,18 @@ + + + + + + @@ -2946,6 +3192,9 @@ + + + @@ -2997,6 +3246,9 @@ + + + @@ -3021,12 +3273,18 @@ + + + + + + @@ -3042,12 +3300,18 @@ + + + + + + @@ -3063,12 +3327,18 @@ + + + + + + @@ -3093,12 +3363,18 @@ + + + + + + @@ -3123,6 +3399,9 @@ + + + @@ -3147,12 +3426,18 @@ + + + + + + @@ -3168,18 +3453,27 @@ + + + + + + + + + @@ -3225,12 +3519,18 @@ + + + + + + @@ -3264,6 +3564,9 @@ + + + @@ -3345,12 +3648,18 @@ + + + + + + @@ -3402,42 +3711,63 @@ + + + + + + {1}'?]]> + + {1}' 형식으로 제한하시겠습니까?]]> + + + + + + + + + + + + + @@ -3483,6 +3813,9 @@ + + + @@ -3498,6 +3831,9 @@ + + + @@ -3732,6 +4068,9 @@ + + + @@ -3774,24 +4113,36 @@ + + + + + + + + + + + + @@ -3816,6 +4167,9 @@ + + + @@ -3840,6 +4194,9 @@ + + + @@ -3882,6 +4239,9 @@ + + + @@ -3915,12 +4275,18 @@ + + + + + + @@ -4038,6 +4404,9 @@ + + + @@ -4152,6 +4521,9 @@ + + + @@ -4167,8 +4539,8 @@ - - + + @@ -4308,6 +4680,9 @@ + + + @@ -4395,24 +4770,36 @@ + + + + + + + + + + + + @@ -4473,6 +4860,9 @@ + + + @@ -4488,6 +4878,9 @@ + + + @@ -4503,6 +4896,9 @@ + + + @@ -4596,6 +4992,9 @@ + + + @@ -4737,6 +5136,9 @@ + + + @@ -4752,6 +5154,9 @@ + + + @@ -4785,6 +5190,9 @@ + + + @@ -4881,6 +5289,9 @@ + + + @@ -4926,6 +5337,9 @@ + + + @@ -4950,6 +5364,9 @@ + + + @@ -5019,6 +5436,9 @@ + + + @@ -5076,6 +5496,9 @@ + + + @@ -5214,6 +5637,9 @@ + + + @@ -5493,6 +5919,9 @@ + + + @@ -5622,6 +6051,9 @@ + + + @@ -5694,6 +6126,9 @@ + + + @@ -5874,6 +6309,9 @@ + + + @@ -5943,24 +6381,36 @@ + + + + + + + + + + + + @@ -5994,6 +6444,9 @@ + + + @@ -6018,6 +6471,9 @@ + + + @@ -6072,6 +6528,9 @@ + + + @@ -6114,6 +6573,9 @@ + + + @@ -6204,18 +6666,27 @@ + + + + + + + + + @@ -6231,24 +6702,36 @@ + + + + + + + + + + + + @@ -6273,12 +6756,18 @@ + + + + + + @@ -6294,12 +6783,18 @@ + + + + + + @@ -6315,6 +6810,9 @@ + + + @@ -6438,6 +6936,9 @@ + + + @@ -6519,6 +7020,9 @@ + + + @@ -6552,6 +7056,9 @@ + + + @@ -6603,6 +7110,9 @@ + + + @@ -6636,6 +7146,9 @@ + + + @@ -6696,6 +7209,9 @@ + + + @@ -6765,6 +7281,9 @@ + + + @@ -6780,18 +7299,27 @@ + + + + + + + + + @@ -6996,12 +7524,18 @@ + + + + + + @@ -7080,6 +7614,9 @@ + + + @@ -7095,6 +7632,9 @@ + + + @@ -7110,6 +7650,9 @@ + + + @@ -7134,6 +7677,9 @@ + + + @@ -7149,30 +7695,45 @@ + + + + + + + + + + + + + + + @@ -7188,6 +7749,9 @@ + + + @@ -7221,12 +7785,18 @@ + + + + + + @@ -7350,12 +7920,18 @@ + + + + + + @@ -7383,12 +7959,18 @@ + + + + + + @@ -7413,6 +7995,9 @@ + + + @@ -7428,12 +8013,18 @@ + + + + + + @@ -7512,6 +8103,9 @@ + + + @@ -7572,12 +8166,18 @@ + + + + + + @@ -7737,6 +8337,9 @@ + + + @@ -7761,6 +8364,9 @@ + + + @@ -7785,6 +8391,9 @@ + + + @@ -7836,18 +8445,27 @@ + + + + + + + + + @@ -7863,6 +8481,9 @@ + + + @@ -7887,6 +8508,9 @@ + + + @@ -7902,6 +8526,9 @@ + + + @@ -8085,12 +8712,18 @@ + + + + + + @@ -8106,6 +8739,9 @@ + + + @@ -8397,12 +9033,18 @@ + + + + + + @@ -8481,6 +9123,9 @@ + + + @@ -8514,6 +9159,9 @@ + + + @@ -8529,12 +9177,18 @@ + + + + + + @@ -8550,6 +9204,9 @@ + + + @@ -8565,18 +9222,27 @@ + + + + + + + + + @@ -8628,12 +9294,18 @@ + + + + + + @@ -8769,6 +9441,9 @@ + + + @@ -8838,6 +9513,9 @@ + + + @@ -8853,12 +9531,18 @@ + + + + + + @@ -8883,12 +9567,18 @@ + + + + + + @@ -8940,6 +9630,9 @@ + + + @@ -8964,24 +9657,36 @@ + + + + + + + + + + + + @@ -9006,6 +9711,9 @@ + + + @@ -9033,18 +9741,27 @@ + + + + + + + + + @@ -9060,12 +9777,18 @@ + + + + + + @@ -9090,6 +9813,9 @@ + + + @@ -9123,6 +9849,9 @@ + + + @@ -9138,12 +9867,18 @@ + + + + + + @@ -9198,14 +9933,17 @@ + + + - - + + @@ -9216,8 +9954,8 @@ - - + + @@ -9228,6 +9966,9 @@ + + + @@ -9243,12 +9984,18 @@ + + + + + + @@ -9309,6 +10056,9 @@ + + + @@ -9336,6 +10086,9 @@ + + + @@ -9363,6 +10116,9 @@ + + + @@ -9396,6 +10152,9 @@ + + + @@ -9411,30 +10170,45 @@ + + + + + + + + + + + + + + + @@ -9468,24 +10242,36 @@ + + + + + + + + + + + + @@ -9501,48 +10287,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -9558,18 +10368,27 @@ + + + + + + + + + @@ -9594,6 +10413,9 @@ + + + @@ -9621,12 +10443,18 @@ + + + + + + @@ -9660,12 +10488,18 @@ + + + + + + @@ -9690,12 +10524,18 @@ + + + + + + @@ -9861,6 +10701,9 @@ + + + @@ -9876,6 +10719,9 @@ + + + @@ -9909,6 +10755,9 @@ + + + @@ -9924,12 +10773,18 @@ + + + + + + @@ -9954,6 +10809,9 @@ + + + @@ -9978,6 +10836,9 @@ + + + @@ -10002,6 +10863,9 @@ + + + @@ -10071,6 +10935,9 @@ + + + @@ -10122,12 +10989,18 @@ + + + + + + @@ -10191,6 +11064,9 @@ + + + @@ -10305,12 +11181,18 @@ '}` or `>`?]]> + + '}' 또는 '>'를 사용하시겠습니까?]]> + + + + @@ -10326,12 +11208,18 @@ + + + + + + @@ -10347,6 +11235,9 @@ + + + @@ -10371,18 +11262,27 @@ + + + + + + + + + @@ -10470,6 +11370,9 @@ + + + @@ -10485,6 +11388,9 @@ + + + @@ -10509,6 +11415,9 @@ + + + @@ -10551,12 +11460,18 @@ + + + + + + @@ -10617,6 +11532,9 @@ + + + @@ -10632,12 +11550,18 @@ + + + + + + @@ -10671,6 +11595,9 @@ + + + @@ -10686,24 +11613,36 @@ + + + + + + + + + + + + @@ -10719,6 +11658,9 @@ + + + @@ -10752,6 +11694,9 @@ + + + @@ -10776,18 +11721,27 @@ + + + + + + + + + @@ -10821,6 +11775,9 @@ + + + @@ -10944,6 +11901,9 @@ + + + @@ -10959,6 +11919,9 @@ + + + @@ -10983,6 +11946,9 @@ + + + @@ -10998,6 +11964,9 @@ + + + @@ -11022,18 +11991,27 @@ + + + + + + + + + @@ -11049,6 +12027,9 @@ + + + @@ -11064,18 +12045,27 @@ + + + + + + + + + @@ -11091,6 +12081,9 @@ + + + @@ -11109,6 +12102,9 @@ + + + @@ -11181,6 +12177,9 @@ + + + @@ -11199,6 +12198,9 @@ + + + @@ -11223,6 +12225,9 @@ + + + @@ -11310,12 +12315,18 @@ + + + + + + @@ -11385,12 +12396,18 @@ + + + + + + @@ -11406,18 +12423,27 @@ + + + + + + + + + @@ -11442,6 +12468,9 @@ + + + @@ -11514,6 +12543,9 @@ + + + @@ -11637,12 +12669,18 @@ + + + + + + diff --git a/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl index 5c62ee493b0..2324951dd01 100644 --- a/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -44,12 +44,18 @@ + + + + + + @@ -92,6 +98,9 @@ + + + @@ -209,6 +218,9 @@ + + + @@ -224,6 +236,9 @@ + + + @@ -413,6 +428,9 @@ + + + @@ -428,6 +446,9 @@ + + + @@ -503,12 +524,18 @@ + + + + + + @@ -587,6 +614,9 @@ + + + @@ -638,12 +668,18 @@ + + + + + + @@ -767,8 +803,8 @@ - - + + @@ -824,6 +860,9 @@ + + + @@ -968,6 +1007,9 @@ + + + @@ -1001,18 +1043,27 @@ + + + + + + + + + @@ -1028,18 +1079,27 @@ + + + + + + + + + @@ -1064,6 +1124,9 @@ + + + @@ -1100,18 +1163,27 @@ + + + + + + + + + @@ -1139,6 +1211,9 @@ + + + @@ -1154,6 +1229,9 @@ + + + @@ -1205,12 +1283,18 @@ + + + + + + @@ -1280,6 +1364,9 @@ + + + @@ -1295,6 +1382,9 @@ + + + @@ -1310,6 +1400,9 @@ + + + @@ -1334,6 +1427,9 @@ + + + @@ -1376,12 +1472,18 @@ + + + + + + @@ -1406,24 +1508,36 @@ + + + + + + + + + + + + @@ -1475,6 +1589,9 @@ + + + @@ -1490,6 +1607,9 @@ + + + @@ -1550,6 +1670,9 @@ + + + @@ -1565,6 +1688,9 @@ + + + @@ -1580,12 +1706,18 @@ + + + + + + @@ -1709,6 +1841,9 @@ + + + @@ -1724,6 +1859,9 @@ + + + @@ -1784,12 +1922,18 @@ + + + + + + @@ -1841,12 +1985,18 @@ + + + + + + @@ -1892,12 +2042,18 @@ + + + + + + @@ -1949,6 +2105,9 @@ + + + @@ -1982,6 +2141,9 @@ + + + @@ -2033,6 +2195,9 @@ + + + @@ -2060,6 +2225,9 @@ + + + @@ -2075,6 +2243,9 @@ + + + @@ -2099,6 +2270,9 @@ + + + @@ -2123,12 +2297,18 @@ + + + + + + @@ -2180,6 +2360,9 @@ + + + @@ -2213,6 +2396,9 @@ + + + @@ -2276,6 +2462,9 @@ + + + @@ -2318,48 +2507,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -2447,18 +2660,27 @@ + + + + + + + + + @@ -2516,6 +2738,9 @@ + + + @@ -2558,6 +2783,9 @@ + + + @@ -2690,6 +2918,9 @@ + + + @@ -2816,6 +3047,9 @@ + + + @@ -2858,6 +3092,9 @@ + + + @@ -2873,6 +3110,9 @@ + + + @@ -2915,12 +3155,18 @@ + + + + + + @@ -2936,6 +3182,9 @@ + + + @@ -2987,6 +3236,9 @@ + + + @@ -3011,12 +3263,18 @@ + + + + + + @@ -3032,12 +3290,18 @@ + + + + + + @@ -3053,12 +3317,18 @@ + + + + + + @@ -3083,12 +3353,18 @@ + + + + + + @@ -3113,6 +3389,9 @@ + + + @@ -3137,12 +3416,18 @@ + + + + + + @@ -3158,18 +3443,27 @@ + + + + + + + + + @@ -3215,12 +3509,18 @@ + + + + + + @@ -3254,6 +3554,9 @@ + + + @@ -3335,12 +3638,18 @@ + + + + + + @@ -3392,42 +3701,63 @@ + + + + + + {1}'?]]> + + {1}”?]]> + + + + + + + + + + + + + @@ -3473,6 +3803,9 @@ + + + @@ -3488,6 +3821,9 @@ + + + @@ -3722,6 +4058,9 @@ + + + @@ -3764,24 +4103,36 @@ + + + + + + + + + + + + @@ -3806,6 +4157,9 @@ + + + @@ -3830,6 +4184,9 @@ + + + @@ -3872,6 +4229,9 @@ + + + @@ -3905,12 +4265,18 @@ + + + + + + @@ -4028,6 +4394,9 @@ + + + @@ -4142,6 +4511,9 @@ + + + @@ -4157,8 +4529,8 @@ - - + + @@ -4298,6 +4670,9 @@ + + + @@ -4385,24 +4760,36 @@ + + + + + + + + + + + + @@ -4463,6 +4850,9 @@ + + + @@ -4478,6 +4868,9 @@ + + + @@ -4493,6 +4886,9 @@ + + + @@ -4586,6 +4982,9 @@ + + + @@ -4727,6 +5126,9 @@ + + + @@ -4742,6 +5144,9 @@ + + + @@ -4775,6 +5180,9 @@ + + + @@ -4871,6 +5279,9 @@ + + + @@ -4916,6 +5327,9 @@ + + + @@ -4940,6 +5354,9 @@ + + + @@ -5009,6 +5426,9 @@ + + + @@ -5066,6 +5486,9 @@ + + + @@ -5204,6 +5627,9 @@ + + + @@ -5483,6 +5909,9 @@ + + + @@ -5612,6 +6041,9 @@ + + + @@ -5684,6 +6116,9 @@ + + + @@ -5864,6 +6299,9 @@ + + + @@ -5933,24 +6371,36 @@ + + + + + + + + + + + + @@ -5984,6 +6434,9 @@ + + + @@ -6008,6 +6461,9 @@ + + + @@ -6062,6 +6518,9 @@ + + + @@ -6104,6 +6563,9 @@ + + + @@ -6194,18 +6656,27 @@ + + + + + + + + + @@ -6221,24 +6692,36 @@ + + + + + + + + + + + + @@ -6263,12 +6746,18 @@ + + + + + + @@ -6284,12 +6773,18 @@ + + + + + + @@ -6305,6 +6800,9 @@ + + + @@ -6428,6 +6926,9 @@ + + + @@ -6509,6 +7010,9 @@ + + + @@ -6542,6 +7046,9 @@ + + + @@ -6593,6 +7100,9 @@ + + + @@ -6626,6 +7136,9 @@ + + + @@ -6686,6 +7199,9 @@ + + + @@ -6755,6 +7271,9 @@ + + + @@ -6770,18 +7289,27 @@ + + + + + + + + + @@ -6986,12 +7514,18 @@ + + + + + + @@ -7067,6 +7601,9 @@ + + + @@ -7082,6 +7619,9 @@ + + + @@ -7097,6 +7637,9 @@ + + + @@ -7121,6 +7664,9 @@ + + + @@ -7136,30 +7682,45 @@ + + + + + + + + + + + + + + + @@ -7175,6 +7736,9 @@ + + + @@ -7208,12 +7772,18 @@ + + + + + + @@ -7337,12 +7907,18 @@ + + + + + + @@ -7370,12 +7946,18 @@ + + + + + + @@ -7400,6 +7982,9 @@ + + + @@ -7415,12 +8000,18 @@ + + + + + + @@ -7499,6 +8090,9 @@ + + + @@ -7559,12 +8153,18 @@ + + + + + + @@ -7724,6 +8324,9 @@ + + + @@ -7748,6 +8351,9 @@ + + + @@ -7772,6 +8378,9 @@ + + + @@ -7823,18 +8432,27 @@ + + + + + + + + + @@ -7850,6 +8468,9 @@ + + + @@ -7874,6 +8495,9 @@ + + + @@ -7889,6 +8513,9 @@ + + + @@ -8072,12 +8699,18 @@ + + + + + + @@ -8093,6 +8726,9 @@ + + + @@ -8384,12 +9020,18 @@ + + + + + + @@ -8468,6 +9110,9 @@ + + + @@ -8501,6 +9146,9 @@ + + + @@ -8516,12 +9164,18 @@ + + + + + + @@ -8537,6 +9191,9 @@ + + + @@ -8552,18 +9209,27 @@ + + + + + + + + + @@ -8615,12 +9281,18 @@ + + + + + + @@ -8756,6 +9428,9 @@ + + + @@ -8825,6 +9500,9 @@ + + + @@ -8840,12 +9518,18 @@ + + + + + + @@ -8870,12 +9554,18 @@ + + + + + + @@ -8927,6 +9617,9 @@ + + + @@ -8951,24 +9644,36 @@ + + + + + + + + + + + + @@ -8993,6 +9698,9 @@ + + + @@ -9020,18 +9728,27 @@ + + + + + + + + + @@ -9047,12 +9764,18 @@ + + + + + + @@ -9077,6 +9800,9 @@ + + + @@ -9110,6 +9836,9 @@ + + + @@ -9125,12 +9854,18 @@ + + + + + + @@ -9185,14 +9920,17 @@ + + + - - + + @@ -9203,8 +9941,8 @@ - - + + @@ -9215,6 +9953,9 @@ + + + @@ -9230,12 +9971,18 @@ + + + + + + @@ -9296,6 +10043,9 @@ + + + @@ -9323,6 +10073,9 @@ + + + @@ -9350,6 +10103,9 @@ + + + @@ -9383,6 +10139,9 @@ + + + @@ -9398,30 +10157,45 @@ + + + + + + + + + + + + + + + @@ -9455,24 +10229,36 @@ + + + + + + + + + + + + @@ -9488,48 +10274,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -9545,18 +10355,27 @@ + + + + + + + + + @@ -9581,6 +10400,9 @@ + + + @@ -9608,12 +10430,18 @@ + + + + + + @@ -9647,12 +10475,18 @@ + + + + + + @@ -9677,12 +10511,18 @@ + + + + + + @@ -9848,6 +10688,9 @@ + + + @@ -9863,6 +10706,9 @@ + + + @@ -9896,6 +10742,9 @@ + + + @@ -9911,12 +10760,18 @@ + + + + + + @@ -9941,6 +10796,9 @@ + + + @@ -9965,6 +10823,9 @@ + + + @@ -9989,6 +10850,9 @@ + + + @@ -10058,6 +10922,9 @@ + + + @@ -10109,12 +10976,18 @@ + + + + + + @@ -10178,6 +11051,9 @@ + + + @@ -10292,12 +11168,18 @@ '}` or `>`?]]> + + '}” lub „>”?]]> + + + + @@ -10313,12 +11195,18 @@ + + + + + + @@ -10334,6 +11222,9 @@ + + + @@ -10358,18 +11249,27 @@ + + + + + + + + + @@ -10457,6 +11357,9 @@ + + + @@ -10472,6 +11375,9 @@ + + + @@ -10496,6 +11402,9 @@ + + + @@ -10538,12 +11447,18 @@ + + + + + + @@ -10604,6 +11519,9 @@ + + + @@ -10619,12 +11537,18 @@ + + + + + + @@ -10658,6 +11582,9 @@ + + + @@ -10673,24 +11600,36 @@ + + + + + + + + + + + + @@ -10706,6 +11645,9 @@ + + + @@ -10739,6 +11681,9 @@ + + + @@ -10763,18 +11708,27 @@ + + + + + + + + + @@ -10808,6 +11762,9 @@ + + + @@ -10931,6 +11888,9 @@ + + + @@ -10946,6 +11906,9 @@ + + + @@ -10970,6 +11933,9 @@ + + + @@ -10985,6 +11951,9 @@ + + + @@ -11009,18 +11978,27 @@ + + + + + + + + + @@ -11036,6 +12014,9 @@ + + + @@ -11051,18 +12032,27 @@ + + + + + + + + + @@ -11078,6 +12068,9 @@ + + + @@ -11096,6 +12089,9 @@ + + + @@ -11168,6 +12164,9 @@ + + + @@ -11186,6 +12185,9 @@ + + + @@ -11210,6 +12212,9 @@ + + + @@ -11297,12 +12302,18 @@ + + + + + + @@ -11372,12 +12383,18 @@ + + + + + + @@ -11393,18 +12410,27 @@ + + + + + + + + + @@ -11429,6 +12455,9 @@ + + + @@ -11501,6 +12530,9 @@ + + + @@ -11624,12 +12656,18 @@ + + + + + + From e120762390658e57314c71fa8a70a3ca0e7f533a Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 25 Feb 2020 11:29:45 -0800 Subject: [PATCH 02/17] Remove unneeded branch from getHelperName (#36998) --- src/compiler/checker.ts | 1 - src/compiler/types.ts | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a1a0b598231..d2a30c0c875 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -35668,7 +35668,6 @@ namespace ts { case ExternalEmitHelpers.ClassPrivateFieldGet: return "__classPrivateFieldGet"; case ExternalEmitHelpers.ClassPrivateFieldSet: return "__classPrivateFieldSet"; case ExternalEmitHelpers.CreateBinding: return "__createBinding"; - case ExternalEmitHelpers.SetModuleDefault: return "__setModuleDefault"; default: return Debug.fail("Unrecognized helper"); } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 53853950f4d..26d5693391c 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5837,10 +5837,9 @@ namespace ts { MakeTemplateObject = 1 << 17, // __makeTemplateObject (used for constructing template string array objects) ClassPrivateFieldGet = 1 << 18, // __classPrivateFieldGet (used by the class private field transformation) ClassPrivateFieldSet = 1 << 19, // __classPrivateFieldSet (used by the class private field transformation) - CreateBinding = 1 << 20, // __createBinding (use by the module transform for exports and namespace imports) - SetModuleDefault = 1 << 21, // __setModuleDefault (use by the module transform for default exports) + CreateBinding = 1 << 20, // __createBinding (use by the module transform for (re)exports and namespace imports) FirstEmitHelper = Extends, - LastEmitHelper = SetModuleDefault, + LastEmitHelper = CreateBinding, // Helpers included by ES2015 for..of ForOfIncludes = Values, From e54b7963013a1c583063f49ed9c5ad6306870e33 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 25 Feb 2020 11:29:59 -0800 Subject: [PATCH 03/17] Declare dependencies between helpers in the declaritive fashion introduced by #35967 (#37001) --- src/compiler/factory.ts | 2 +- src/compiler/transformers/es2018.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 2079dd02d98..2824307ccd4 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -278,6 +278,7 @@ namespace ts { name: "typescript:spread", importName: "__spread", scoped: false, + dependencies: [readHelper], text: ` var __spread = (this && this.__spread) || function () { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); @@ -286,7 +287,6 @@ namespace ts { }; export function createSpreadHelper(context: TransformationContext, argumentList: readonly Expression[], location?: TextRange) { - context.requestEmitHelper(readHelper); context.requestEmitHelper(spreadHelper); return setTextRange( createCall( diff --git a/src/compiler/transformers/es2018.ts b/src/compiler/transformers/es2018.ts index 6a7ec14e94e..9050ebc601b 100644 --- a/src/compiler/transformers/es2018.ts +++ b/src/compiler/transformers/es2018.ts @@ -1096,6 +1096,7 @@ namespace ts { name: "typescript:asyncGenerator", importName: "__asyncGenerator", scoped: false, + dependencies: [awaitHelper], text: ` var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); @@ -1111,7 +1112,6 @@ namespace ts { }; function createAsyncGeneratorHelper(context: TransformationContext, generatorFunc: FunctionExpression, hasLexicalThis: boolean) { - context.requestEmitHelper(awaitHelper); context.requestEmitHelper(asyncGeneratorHelper); // Mark this node as originally an async function @@ -1132,6 +1132,7 @@ namespace ts { name: "typescript:asyncDelegator", importName: "__asyncDelegator", scoped: false, + dependencies: [awaitHelper], text: ` var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { var i, p; @@ -1141,7 +1142,6 @@ namespace ts { }; function createAsyncDelegatorHelper(context: TransformationContext, expression: Expression, location?: TextRange) { - context.requestEmitHelper(awaitHelper); context.requestEmitHelper(asyncDelegator); return setTextRange( createCall( From c22cdb446ab0d452dec2e4a382483f5d5a86de6e Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Tue, 25 Feb 2020 11:32:32 -0800 Subject: [PATCH 04/17] Harden telemetryOnOpenFile (#36993) --- src/server/editorServices.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 45a13feda1e..eeb266e1a80 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -3117,8 +3117,9 @@ namespace ts.server { return; } - const info: OpenFileInfo = { checkJs: !!project.getSourceFile(scriptInfo.path)!.checkJsDirective }; - this.eventHandler({ eventName: OpenFileInfoTelemetryEvent, data: { info } }); + const sourceFile = project.getSourceFile(scriptInfo.path); + const checkJs = !!sourceFile && !!sourceFile.checkJsDirective; + this.eventHandler({ eventName: OpenFileInfoTelemetryEvent, data: { info: { checkJs } } }); } /** From 01f81dfc0027e8077dfcd0fee53b94479d522a44 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 25 Feb 2020 11:46:05 -0800 Subject: [PATCH 05/17] Add helpers to helper list, per comment on #36806 --- src/compiler/factoryPublic.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/factoryPublic.ts b/src/compiler/factoryPublic.ts index 0e789cc0b33..04ec83a6222 100644 --- a/src/compiler/factoryPublic.ts +++ b/src/compiler/factoryPublic.ts @@ -2943,6 +2943,8 @@ namespace ts { importDefaultHelper, classPrivateFieldGetHelper, classPrivateFieldSetHelper, + createBindingHelper, + setModuleDefaultHelper ], helper => helper.name)); } From e536c89872d9156ec1db1ab1f5a0336678e24ee5 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 25 Feb 2020 13:29:34 -0800 Subject: [PATCH 06/17] Add js-equivalent test for the binary expression stress and introduce trampoline into getJSSyntacticDiagnosticsForFile (#36724) * Add js-equivalent test for the binary expression stress and introduce trampiline into getJSSyntacticDiagnosticsForFile * Update src/compiler/parser.ts Comment text update Co-Authored-By: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> * Fix lint Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> --- src/compiler/parser.ts | 101 +- src/compiler/program.ts | 54 +- .../binderBinaryExpressionStressJs.ts | 4973 +++++++++++++++++ 3 files changed, 5073 insertions(+), 55 deletions(-) create mode 100644 tests/cases/compiler/binderBinaryExpressionStressJs.ts diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 3135b144368..5804c2c4253 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -522,6 +522,76 @@ namespace ts { } } + /** @internal */ + /** + * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes + * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; additionally, + * unlike `forEachChild`, embedded arrays are flattened and the 'cbNode' callback is invoked for each element. + * If a callback returns a truthy value, iteration stops and that value is returned. Otherwise, undefined is returned. + * + * @param node a given node to visit its children + * @param cbNode a callback to be invoked for all child nodes + * @param cbNodes a callback to be invoked for embedded array + * + * @remarks Unlike `forEachChild`, `forEachChildRecursively` handles recursively invoking the traversal on each child node found, + * and while doing so, handles traversing the structure without relying on the callstack to encode the tree structure. + */ + export function forEachChildRecursively(rootNode: Node, cbNode: (node: Node, parent: Node) => T | "skip" | undefined, cbNodes?: (nodes: NodeArray, parent: Node) => T | "skip" | undefined): T | undefined { + + const stack: Node[] = [rootNode]; + while (stack.length) { + const parent = stack.pop()!; + const res = visitAllPossibleChildren(parent, gatherPossibleChildren(parent)); + if (res) { + return res; + } + } + + return; + + function gatherPossibleChildren(node: Node) { + const children: (Node | NodeArray)[] = []; + forEachChild(node, addWorkItem, addWorkItem); // By using a stack above and `unshift` here, we emulate a depth-first preorder traversal + return children; + + function addWorkItem(n: Node | NodeArray) { + children.unshift(n); + } + } + + function visitAllPossibleChildren(parent: Node, children: readonly (Node | NodeArray)[]) { + for (const child of children) { + if (isArray(child)) { + if (cbNodes) { + const res = cbNodes(child, parent); + if (res) { + if (res === "skip") continue; + return res; + } + } + + for (let i = child.length - 1; i >= 0; i--) { + const realChild = child[i]; + const res = cbNode(realChild, parent); + if (res) { + if (res === "skip") continue; + return res; + } + stack.push(realChild); + } + } + else { + stack.push(child); + const res = cbNode(child, parent); + if (res) { + if (res === "skip") continue; + return res; + } + } + } + } + } + export function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes = false, scriptKind?: ScriptKind): SourceFile { performance.mark("beforeParse"); let result: SourceFile; @@ -903,31 +973,14 @@ namespace ts { // a syntax tree, and no semantic features, then the binding process is an unnecessary // overhead. This functions allows us to set all the parents, without all the expense of // binding. + forEachChildRecursively(rootNode, bindParentToChild); - const stack: Node[] = [rootNode]; - while (stack.length) { - const parent = stack.pop()!; - bindParentToChildren(parent, gatherChildren(parent)); - } - - return; - - function gatherChildren(node: Node) { - const children: Node[] = []; - forEachChild(node, n => { children.unshift(n); }); // By using a stack above and `unshift` here, we emulate a depth-first preorder traversal - return children; - } - - function bindParentToChildren(parent: Node, children: readonly Node[]) { - for (const child of children) { - if (child.parent === parent) continue; // already bound, assume subtree is bound - child.parent = parent; - stack.push(child); - if (hasJSDocNodes(child)) { - for (const jsDoc of child.jsDoc!) { - jsDoc.parent = child; - stack.push(jsDoc); - } + function bindParentToChild(child: Node, parent: Node) { + child.parent = parent; + if (hasJSDocNodes(child)) { + for (const doc of child.jsDoc!) { + bindParentToChild(doc, child); + forEachChildRecursively(doc, bindParentToChild); } } } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index d0d919d683f..623c872945f 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1779,12 +1779,12 @@ namespace ts { function getJSSyntacticDiagnosticsForFile(sourceFile: SourceFile): DiagnosticWithLocation[] { return runWithCancellationToken(() => { const diagnostics: DiagnosticWithLocation[] = []; - let parent: Node = sourceFile; - walk(sourceFile); + walk(sourceFile, sourceFile); + forEachChildRecursively(sourceFile, walk, walkArray); return diagnostics; - function walk(node: Node) { + function walk(node: Node, parent: Node) { // Return directly from the case if the given node doesnt want to visit each child // Otherwise break to visit each child @@ -1794,7 +1794,7 @@ namespace ts { case SyntaxKind.MethodDeclaration: if ((parent).questionToken === node) { diagnostics.push(createDiagnosticForNode(node, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); - return; + return "skip"; } // falls through case SyntaxKind.MethodSignature: @@ -1808,7 +1808,7 @@ namespace ts { // type annotation if ((parent).type === node) { diagnostics.push(createDiagnosticForNode(node, Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)); - return; + return "skip"; } } @@ -1816,65 +1816,60 @@ namespace ts { case SyntaxKind.ImportClause: if ((node as ImportClause).isTypeOnly) { diagnostics.push(createDiagnosticForNode(node.parent, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type")); - return; + return "skip"; } break; case SyntaxKind.ExportDeclaration: if ((node as ExportDeclaration).isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type")); - return; + return "skip"; } break; case SyntaxKind.ImportEqualsDeclaration: diagnostics.push(createDiagnosticForNode(node, Diagnostics.import_can_only_be_used_in_TypeScript_files)); - return; + return "skip"; case SyntaxKind.ExportAssignment: if ((node).isExportEquals) { diagnostics.push(createDiagnosticForNode(node, Diagnostics.export_can_only_be_used_in_TypeScript_files)); - return; + return "skip"; } break; case SyntaxKind.HeritageClause: const heritageClause = node; if (heritageClause.token === SyntaxKind.ImplementsKeyword) { diagnostics.push(createDiagnosticForNode(node, Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)); - return; + return "skip"; } break; case SyntaxKind.InterfaceDeclaration: const interfaceKeyword = tokenToString(SyntaxKind.InterfaceKeyword); Debug.assertIsDefined(interfaceKeyword); diagnostics.push(createDiagnosticForNode(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword)); - return; + return "skip"; case SyntaxKind.ModuleDeclaration: const moduleKeyword = node.flags & NodeFlags.Namespace ? tokenToString(SyntaxKind.NamespaceKeyword) : tokenToString(SyntaxKind.ModuleKeyword); Debug.assertIsDefined(moduleKeyword); diagnostics.push(createDiagnosticForNode(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword)); - return; + return "skip"; case SyntaxKind.TypeAliasDeclaration: diagnostics.push(createDiagnosticForNode(node, Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)); - return; + return "skip"; case SyntaxKind.EnumDeclaration: const enumKeyword = Debug.checkDefined(tokenToString(SyntaxKind.EnumKeyword)); diagnostics.push(createDiagnosticForNode(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword)); - return; + return "skip"; case SyntaxKind.NonNullExpression: diagnostics.push(createDiagnosticForNode(node, Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)); - return; + return "skip"; case SyntaxKind.AsExpression: diagnostics.push(createDiagnosticForNode((node as AsExpression).type, Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); - return; + return "skip"; case SyntaxKind.TypeAssertionExpression: Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX. } - - const prevParent = parent; - parent = node; - forEachChild(node, walk, walkArray); - parent = prevParent; } - function walkArray(nodes: NodeArray) { + function walkArray(nodes: NodeArray, parent: Node) { if (parent.decorators === nodes && !options.experimentalDecorators) { diagnostics.push(createDiagnosticForNode(parent, Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning)); } @@ -1892,14 +1887,15 @@ namespace ts { // Check type parameters if (nodes === (parent).typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)); - return; + return "skip"; } // falls through case SyntaxKind.VariableStatement: // Check modifiers if (nodes === parent.modifiers) { - return checkModifiers(parent.modifiers, parent.kind === SyntaxKind.VariableStatement); + checkModifiers(parent.modifiers, parent.kind === SyntaxKind.VariableStatement); + return "skip"; } break; case SyntaxKind.PropertyDeclaration: @@ -1910,14 +1906,14 @@ namespace ts { diagnostics.push(createDiagnosticForNode(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind))); } } - return; + return "skip"; } break; case SyntaxKind.Parameter: // Check modifiers of parameter declaration if (nodes === (parent).modifiers) { diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)); - return; + return "skip"; } break; case SyntaxKind.CallExpression: @@ -1929,14 +1925,10 @@ namespace ts { // Check type arguments if (nodes === (parent).typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)); - return; + return "skip"; } break; } - - for (const node of nodes) { - walk(node); - } } function checkModifiers(modifiers: NodeArray, isConstValid: boolean) { diff --git a/tests/cases/compiler/binderBinaryExpressionStressJs.ts b/tests/cases/compiler/binderBinaryExpressionStressJs.ts new file mode 100644 index 00000000000..f6af2b9fbc6 --- /dev/null +++ b/tests/cases/compiler/binderBinaryExpressionStressJs.ts @@ -0,0 +1,4973 @@ +// @target: esnext +// @noTypesAndSymbols: true +// @allowJs: true +// @noEmit: true +// @filename: file.js +// regression test for https://github.com/microsoft/TypeScript/issues/35633 +// If we need to emit comments or subsitutions for a node, we have to skip the trampoline +// that allows us to handle emitting arbitrarily complex binary expressions +// so we simplify the emit as much as possible to allow us to emit. In addition, +// we disable the type & symbol baselines just because they're _way too big_ +// because of how we print them. We should be able to print them now, but 50k lines +// were never realistically going to be reviewed, and it takes a few seconds to +// generate besides. + +// Two test cases, just in case; numeric: +0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 106 + 107 + 108 + 109 + 110 + 111 + 112 + 113 + 114 + 115 + 116 + 117 + 118 + 119 + 120 + 121 + 122 + 123 + 124 + 125 + 126 + 127 + 128 + 129 + 130 + 131 + 132 + 133 + 134 + 135 + 136 + 137 + 138 + 139 + 140 + 141 + 142 + 143 + 144 + 145 + 146 + 147 + 148 + 149 + 150 + 151 + 152 + 153 + 154 + 155 + 156 + 157 + 158 + 159 + 160 + 161 + 162 + 163 + 164 + 165 + 166 + 167 + 168 + 169 + 170 + 171 + 172 + 173 + 174 + 175 + 176 + 177 + 178 + 179 + 180 + 181 + 182 + 183 + 184 + 185 + 186 + 187 + 188 + 189 + 190 + 191 + 192 + 193 + 194 + 195 + 196 + 197 + 198 + 199 + 200 + 201 + 202 + 203 + 204 + 205 + 206 + 207 + 208 + 209 + 210 + 211 + 212 + 213 + 214 + 215 + 216 + 217 + 218 + 219 + 220 + 221 + 222 + 223 + 224 + 225 + 226 + 227 + 228 + 229 + 230 + 231 + 232 + 233 + 234 + 235 + 236 + 237 + 238 + 239 + 240 + 241 + 242 + 243 + 244 + 245 + 246 + 247 + 248 + 249 + 250 + 251 + 252 + 253 + 254 + 255 + 256 + 257 + 258 + 259 + 260 + 261 + 262 + 263 + 264 + 265 + 266 + 267 + 268 + 269 + 270 + 271 + 272 + 273 + 274 + 275 + 276 + 277 + 278 + 279 + 280 + 281 + 282 + 283 + 284 + 285 + 286 + 287 + 288 + 289 + 290 + 291 + 292 + 293 + 294 + 295 + 296 + 297 + 298 + 299 + 300 + 301 + 302 + 303 + 304 + 305 + 306 + 307 + 308 + 309 + 310 + 311 + 312 + 313 + 314 + 315 + 316 + 317 + 318 + 319 + 320 + 321 + 322 + 323 + 324 + 325 + 326 + 327 + 328 + 329 + 330 + 331 + 332 + 333 + 334 + 335 + 336 + 337 + 338 + 339 + 340 + 341 + 342 + 343 + 344 + 345 + 346 + 347 + 348 + 349 + 350 + 351 + 352 + 353 + 354 + 355 + 356 + 357 + 358 + 359 + 360 + 361 + 362 + 363 + 364 + 365 + 366 + 367 + 368 + 369 + 370 + 371 + 372 + 373 + 374 + 375 + 376 + 377 + 378 + 379 + 380 + 381 + 382 + 383 + 384 + 385 + 386 + 387 + 388 + 389 + 390 + 391 + 392 + 393 + 394 + 395 + 396 + 397 + 398 + 399 + 400 + 401 + 402 + 403 + 404 + 405 + 406 + 407 + 408 + 409 + 410 + 411 + 412 + 413 + 414 + 415 + 416 + 417 + 418 + 419 + 420 + 421 + 422 + 423 + 424 + 425 + 426 + 427 + 428 + 429 + 430 + 431 + 432 + 433 + 434 + 435 + 436 + 437 + 438 + 439 + 440 + 441 + 442 + 443 + 444 + 445 + 446 + 447 + 448 + 449 + 450 + 451 + 452 + 453 + 454 + 455 + 456 + 457 + 458 + 459 + 460 + 461 + 462 + 463 + 464 + 465 + 466 + 467 + 468 + 469 + 470 + 471 + 472 + 473 + 474 + 475 + 476 + 477 + 478 + 479 + 480 + 481 + 482 + 483 + 484 + 485 + 486 + 487 + 488 + 489 + 490 + 491 + 492 + 493 + 494 + 495 + 496 + 497 + 498 + 499 + 500 + 501 + 502 + 503 + 504 + 505 + 506 + 507 + 508 + 509 + 510 + 511 + 512 + 513 + 514 + 515 + 516 + 517 + 518 + 519 + 520 + 521 + 522 + 523 + 524 + 525 + 526 + 527 + 528 + 529 + 530 + 531 + 532 + 533 + 534 + 535 + 536 + 537 + 538 + 539 + 540 + 541 + 542 + 543 + 544 + 545 + 546 + 547 + 548 + 549 + 550 + 551 + 552 + 553 + 554 + 555 + 556 + 557 + 558 + 559 + 560 + 561 + 562 + 563 + 564 + 565 + 566 + 567 + 568 + 569 + 570 + 571 + 572 + 573 + 574 + 575 + 576 + 577 + 578 + 579 + 580 + 581 + 582 + 583 + 584 + 585 + 586 + 587 + 588 + 589 + 590 + 591 + 592 + 593 + 594 + 595 + 596 + 597 + 598 + 599 + 600 + 601 + 602 + 603 + 604 + 605 + 606 + 607 + 608 + 609 + 610 + 611 + 612 + 613 + 614 + 615 + 616 + 617 + 618 + 619 + 620 + 621 + 622 + 623 + 624 + 625 + 626 + 627 + 628 + 629 + 630 + 631 + 632 + 633 + 634 + 635 + 636 + 637 + 638 + 639 + 640 + 641 + 642 + 643 + 644 + 645 + 646 + 647 + 648 + 649 + 650 + 651 + 652 + 653 + 654 + 655 + 656 + 657 + 658 + 659 + 660 + 661 + 662 + 663 + 664 + 665 + 666 + 667 + 668 + 669 + 670 + 671 + 672 + 673 + 674 + 675 + 676 + 677 + 678 + 679 + 680 + 681 + 682 + 683 + 684 + 685 + 686 + 687 + 688 + 689 + 690 + 691 + 692 + 693 + 694 + 695 + 696 + 697 + 698 + 699 + 700 + 701 + 702 + 703 + 704 + 705 + 706 + 707 + 708 + 709 + 710 + 711 + 712 + 713 + 714 + 715 + 716 + 717 + 718 + 719 + 720 + 721 + 722 + 723 + 724 + 725 + 726 + 727 + 728 + 729 + 730 + 731 + 732 + 733 + 734 + 735 + 736 + 737 + 738 + 739 + 740 + 741 + 742 + 743 + 744 + 745 + 746 + 747 + 748 + 749 + 750 + 751 + 752 + 753 + 754 + 755 + 756 + 757 + 758 + 759 + 760 + 761 + 762 + 763 + 764 + 765 + 766 + 767 + 768 + 769 + 770 + 771 + 772 + 773 + 774 + 775 + 776 + 777 + 778 + 779 + 780 + 781 + 782 + 783 + 784 + 785 + 786 + 787 + 788 + 789 + 790 + 791 + 792 + 793 + 794 + 795 + 796 + 797 + 798 + 799 + 800 + 801 + 802 + 803 + 804 + 805 + 806 + 807 + 808 + 809 + 810 + 811 + 812 + 813 + 814 + 815 + 816 + 817 + 818 + 819 + 820 + 821 + 822 + 823 + 824 + 825 + 826 + 827 + 828 + 829 + 830 + 831 + 832 + 833 + 834 + 835 + 836 + 837 + 838 + 839 + 840 + 841 + 842 + 843 + 844 + 845 + 846 + 847 + 848 + 849 + 850 + 851 + 852 + 853 + 854 + 855 + 856 + 857 + 858 + 859 + 860 + 861 + 862 + 863 + 864 + 865 + 866 + 867 + 868 + 869 + 870 + 871 + 872 + 873 + 874 + 875 + 876 + 877 + 878 + 879 + 880 + 881 + 882 + 883 + 884 + 885 + 886 + 887 + 888 + 889 + 890 + 891 + 892 + 893 + 894 + 895 + 896 + 897 + 898 + 899 + 900 + 901 + 902 + 903 + 904 + 905 + 906 + 907 + 908 + 909 + 910 + 911 + 912 + 913 + 914 + 915 + 916 + 917 + 918 + 919 + 920 + 921 + 922 + 923 + 924 + 925 + 926 + 927 + 928 + 929 + 930 + 931 + 932 + 933 + 934 + 935 + 936 + 937 + 938 + 939 + 940 + 941 + 942 + 943 + 944 + 945 + 946 + 947 + 948 + 949 + 950 + 951 + 952 + 953 + 954 + 955 + 956 + 957 + 958 + 959 + 960 + 961 + 962 + 963 + 964 + 965 + 966 + 967 + 968 + 969 + 970 + 971 + 972 + 973 + 974 + 975 + 976 + 977 + 978 + 979 + 980 + 981 + 982 + 983 + 984 + 985 + 986 + 987 + 988 + 989 + 990 + 991 + 992 + 993 + 994 + 995 + 996 + 997 + 998 + 999 + 1000 + 1001 + 1002 + 1003 + 1004 + 1005 + 1006 + 1007 + 1008 + 1009 + 1010 + 1011 + 1012 + 1013 + 1014 + 1015 + 1016 + 1017 + 1018 + 1019 + 1020 + 1021 + 1022 + 1023 + 1024 + 1025 + 1026 + 1027 + 1028 + 1029 + 1030 + 1031 + 1032 + 1033 + 1034 + 1035 + 1036 + 1037 + 1038 + 1039 + 1040 + 1041 + 1042 + 1043 + 1044 + 1045 + 1046 + 1047 + 1048 + 1049 + 1050 + 1051 + 1052 + 1053 + 1054 + 1055 + 1056 + 1057 + 1058 + 1059 + 1060 + 1061 + 1062 + 1063 + 1064 + 1065 + 1066 + 1067 + 1068 + 1069 + 1070 + 1071 + 1072 + 1073 + 1074 + 1075 + 1076 + 1077 + 1078 + 1079 + 1080 + 1081 + 1082 + 1083 + 1084 + 1085 + 1086 + 1087 + 1088 + 1089 + 1090 + 1091 + 1092 + 1093 + 1094 + 1095 + 1096 + 1097 + 1098 + 1099 + 1100 + 1101 + 1102 + 1103 + 1104 + 1105 + 1106 + 1107 + 1108 + 1109 + 1110 + 1111 + 1112 + 1113 + 1114 + 1115 + 1116 + 1117 + 1118 + 1119 + 1120 + 1121 + 1122 + 1123 + 1124 + 1125 + 1126 + 1127 + 1128 + 1129 + 1130 + 1131 + 1132 + 1133 + 1134 + 1135 + 1136 + 1137 + 1138 + 1139 + 1140 + 1141 + 1142 + 1143 + 1144 + 1145 + 1146 + 1147 + 1148 + 1149 + 1150 + 1151 + 1152 + 1153 + 1154 + 1155 + 1156 + 1157 + 1158 + 1159 + 1160 + 1161 + 1162 + 1163 + 1164 + 1165 + 1166 + 1167 + 1168 + 1169 + 1170 + 1171 + 1172 + 1173 + 1174 + 1175 + 1176 + 1177 + 1178 + 1179 + 1180 + 1181 + 1182 + 1183 + 1184 + 1185 + 1186 + 1187 + 1188 + 1189 + 1190 + 1191 + 1192 + 1193 + 1194 + 1195 + 1196 + 1197 + 1198 + 1199 + 1200 + 1201 + 1202 + 1203 + 1204 + 1205 + 1206 + 1207 + 1208 + 1209 + 1210 + 1211 + 1212 + 1213 + 1214 + 1215 + 1216 + 1217 + 1218 + 1219 + 1220 + 1221 + 1222 + 1223 + 1224 + 1225 + 1226 + 1227 + 1228 + 1229 + 1230 + 1231 + 1232 + 1233 + 1234 + 1235 + 1236 + 1237 + 1238 + 1239 + 1240 + 1241 + 1242 + 1243 + 1244 + 1245 + 1246 + 1247 + 1248 + 1249 + 1250 + 1251 + 1252 + 1253 + 1254 + 1255 + 1256 + 1257 + 1258 + 1259 + 1260 + 1261 + 1262 + 1263 + 1264 + 1265 + 1266 + 1267 + 1268 + 1269 + 1270 + 1271 + 1272 + 1273 + 1274 + 1275 + 1276 + 1277 + 1278 + 1279 + 1280 + 1281 + 1282 + 1283 + 1284 + 1285 + 1286 + 1287 + 1288 + 1289 + 1290 + 1291 + 1292 + 1293 + 1294 + 1295 + 1296 + 1297 + 1298 + 1299 + 1300 + 1301 + 1302 + 1303 + 1304 + 1305 + 1306 + 1307 + 1308 + 1309 + 1310 + 1311 + 1312 + 1313 + 1314 + 1315 + 1316 + 1317 + 1318 + 1319 + 1320 + 1321 + 1322 + 1323 + 1324 + 1325 + 1326 + 1327 + 1328 + 1329 + 1330 + 1331 + 1332 + 1333 + 1334 + 1335 + 1336 + 1337 + 1338 + 1339 + 1340 + 1341 + 1342 + 1343 + 1344 + 1345 + 1346 + 1347 + 1348 + 1349 + 1350 + 1351 + 1352 + 1353 + 1354 + 1355 + 1356 + 1357 + 1358 + 1359 + 1360 + 1361 + 1362 + 1363 + 1364 + 1365 + 1366 + 1367 + 1368 + 1369 + 1370 + 1371 + 1372 + 1373 + 1374 + 1375 + 1376 + 1377 + 1378 + 1379 + 1380 + 1381 + 1382 + 1383 + 1384 + 1385 + 1386 + 1387 + 1388 + 1389 + 1390 + 1391 + 1392 + 1393 + 1394 + 1395 + 1396 + 1397 + 1398 + 1399 + 1400 + 1401 + 1402 + 1403 + 1404 + 1405 + 1406 + 1407 + 1408 + 1409 + 1410 + 1411 + 1412 + 1413 + 1414 + 1415 + 1416 + 1417 + 1418 + 1419 + 1420 + 1421 + 1422 + 1423 + 1424 + 1425 + 1426 + 1427 + 1428 + 1429 + 1430 + 1431 + 1432 + 1433 + 1434 + 1435 + 1436 + 1437 + 1438 + 1439 + 1440 + 1441 + 1442 + 1443 + 1444 + 1445 + 1446 + 1447 + 1448 + 1449 + 1450 + 1451 + 1452 + 1453 + 1454 + 1455 + 1456 + 1457 + 1458 + 1459 + 1460 + 1461 + 1462 + 1463 + 1464 + 1465 + 1466 + 1467 + 1468 + 1469 + 1470 + 1471 + 1472 + 1473 + 1474 + 1475 + 1476 + 1477 + 1478 + 1479 + 1480 + 1481 + 1482 + 1483 + 1484 + 1485 + 1486 + 1487 + 1488 + 1489 + 1490 + 1491 + 1492 + 1493 + 1494 + 1495 + 1496 + 1497 + 1498 + 1499; + +// And stringy, as from https://github.com/openlayers/ol2/blob/master/tests/speed/wmscaps.js +var caps = +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +'' + +''; From 7d8dc730b7c95a2d9fe1e6fc2cd97296fc635487 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 25 Feb 2020 13:44:22 -0800 Subject: [PATCH 07/17] Baseline arity checks for jsx sfc tags (#36643) Finish comment PR feedback --- src/compiler/checker.ts | 99 ++++++++++++++++++- src/compiler/diagnosticMessages.json | 4 + src/compiler/utilities.ts | 7 +- ...rWhenTagExpectsTooManyArguments.errors.txt | 35 +++++++ ...suesErrorWhenTagExpectsTooManyArguments.js | 44 +++++++++ ...rrorWhenTagExpectsTooManyArguments.symbols | 76 ++++++++++++++ ...sErrorWhenTagExpectsTooManyArguments.types | 80 +++++++++++++++ ...uesErrorWhenTagExpectsTooManyArguments.tsx | 25 +++++ 8 files changed, 363 insertions(+), 7 deletions(-) create mode 100644 tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.errors.txt create mode 100644 tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.js create mode 100644 tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.symbols create mode 100644 tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.types create mode 100644 tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d2a30c0c875..04dc876c45b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -940,6 +940,7 @@ namespace ts { if (jsxPragma) { const chosenpragma = isArray(jsxPragma) ? jsxPragma[0] : jsxPragma; file.localJsxFactory = parseIsolatedEntityName(chosenpragma.arguments.factory, languageVersion); + visitNode(file.localJsxFactory, markAsSynthetic); if (file.localJsxFactory) { return file.localJsxNamespace = getFirstIdentifier(file.localJsxFactory).escapedText; } @@ -950,6 +951,7 @@ namespace ts { _jsxNamespace = "React" as __String; if (compilerOptions.jsxFactory) { _jsxFactoryEntity = parseIsolatedEntityName(compilerOptions.jsxFactory, languageVersion); + visitNode(_jsxFactoryEntity, markAsSynthetic); if (_jsxFactoryEntity) { _jsxNamespace = getFirstIdentifier(_jsxFactoryEntity).escapedText; } @@ -958,7 +960,16 @@ namespace ts { _jsxNamespace = escapeLeadingUnderscores(compilerOptions.reactNamespace); } } + if (!_jsxFactoryEntity) { + _jsxFactoryEntity = createQualifiedName(createIdentifier(unescapeLeadingUnderscores(_jsxNamespace)), "createElement"); + } return _jsxNamespace; + + function markAsSynthetic(node: Node): VisitResult { + node.pos = -1; + node.end = -1; + return visitEachChild(node, markAsSynthetic, nullTransformationContext); + } } function getEmitResolver(sourceFile: SourceFile, cancellationToken: CancellationToken) { @@ -2802,8 +2813,8 @@ namespace ts { const namespaceMeaning = SymbolFlags.Namespace | (isInJSFile(name) ? meaning & SymbolFlags.Value : 0); let symbol: Symbol | undefined; if (name.kind === SyntaxKind.Identifier) { - const message = meaning === namespaceMeaning ? Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name)); - const symbolFromJSPrototype = isInJSFile(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : undefined; + const message = meaning === namespaceMeaning || nodeIsSynthesized(name) ? Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name)); + const symbolFromJSPrototype = isInJSFile(name) && !nodeIsSynthesized(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : undefined; symbol = resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, /*isUse*/ true); if (!symbol) { return symbolFromJSPrototype; @@ -2846,7 +2857,7 @@ namespace ts { throw Debug.assertNever(name, "Unknown entity name kind."); } Debug.assert((getCheckFlags(symbol) & CheckFlags.Instantiated) === 0, "Should never get an instantiated symbol here."); - if (isEntityName(name) && (symbol.flags & SymbolFlags.Alias || name.parent.kind === SyntaxKind.ExportAssignment)) { + if (!nodeIsSynthesized(name) && isEntityName(name) && (symbol.flags & SymbolFlags.Alias || name.parent.kind === SyntaxKind.ExportAssignment)) { markSymbolOfAliasDeclarationIfTypeOnly(getAliasDeclarationFromName(name), symbol, /*finalTarget*/ undefined, /*overwriteEmpty*/ true); } return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); @@ -24391,7 +24402,7 @@ namespace ts { // can be specified by users through attributes property. const paramType = getEffectiveFirstArgumentForJsxSignature(signature, node); const attributesType = checkExpressionWithContextualType(node.attributes, paramType, /*inferenceContext*/ undefined, checkMode); - return checkTypeRelatedToAndOptionallyElaborate( + return checkTagNameDoesNotExpectTooManyArguments() && checkTypeRelatedToAndOptionallyElaborate( attributesType, paramType, relation, @@ -24400,6 +24411,80 @@ namespace ts { /*headMessage*/ undefined, containingMessageChain, errorOutputContainer); + + function checkTagNameDoesNotExpectTooManyArguments(): boolean { + const tagType = isJsxOpeningElement(node) || isJsxSelfClosingElement(node) && !isJsxIntrinsicIdentifier(node.tagName) ? checkExpression(node.tagName) : undefined; + if (!tagType) { + return true; + } + const tagCallSignatures = getSignaturesOfType(tagType, SignatureKind.Call); + if (!length(tagCallSignatures)) { + return true; + } + const factory = getJsxFactoryEntity(node); + if (!factory) { + return true; + } + const factorySymbol = resolveEntityName(factory, SymbolFlags.Value, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, node); + if (!factorySymbol) { + return true; + } + + const factoryType = getTypeOfSymbol(factorySymbol); + const callSignatures = getSignaturesOfType(factoryType, SignatureKind.Call); + if (!length(callSignatures)) { + return true; + } + + let hasFirstParamSignatures = false; + let maxParamCount = 0; + // Check that _some_ first parameter expects a FC-like thing, and that some overload of the SFC expects an acceptable number of arguments + for (const sig of callSignatures) { + const firstparam = getTypeAtPosition(sig, 0); + const signaturesOfParam = getSignaturesOfType(firstparam, SignatureKind.Call); + if (!length(signaturesOfParam)) continue; + for (const paramSig of signaturesOfParam) { + hasFirstParamSignatures = true; + if (hasEffectiveRestParameter(paramSig)) { + return true; // some signature has a rest param, so function components can have an arbitrary number of arguments + } + const paramCount = getParameterCount(paramSig); + if (paramCount > maxParamCount) { + maxParamCount = paramCount; + } + } + } + if (!hasFirstParamSignatures) { + // Not a single signature had a first parameter which expected a signature - for back compat, and + // to guard against generic factories which won't have signatures directly, do not error + return true; + } + let absoluteMinArgCount = Infinity; + for (const tagSig of tagCallSignatures) { + const tagRequiredArgCount = getMinArgumentCount(tagSig); + if (tagRequiredArgCount < absoluteMinArgCount) { + absoluteMinArgCount = tagRequiredArgCount; + } + } + if (absoluteMinArgCount <= maxParamCount) { + return true; // some signature accepts the number of arguments the function component provides + } + + if (reportErrors) { + const diag = createDiagnosticForNode(node.tagName, Diagnostics.Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3, entityNameToString(node.tagName), absoluteMinArgCount, entityNameToString(factory), maxParamCount); + const tagNameDeclaration = getSymbolAtLocation(node.tagName)?.valueDeclaration; + if (tagNameDeclaration) { + addRelatedInfo(diag, createDiagnosticForNode(tagNameDeclaration, Diagnostics._0_is_declared_here, entityNameToString(node.tagName))); + } + if (errorOutputContainer && errorOutputContainer.skipLogging) { + (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag); + } + if (!errorOutputContainer.skipLogging) { + diagnostics.add(diag); + } + } + return false; + } } function getSignatureApplicabilityError( @@ -35282,6 +35367,10 @@ namespace ts { return literalTypeToNode(type, node, tracker); } + function getJsxFactoryEntity(location: Node) { + return location ? (getJsxNamespace(location), (getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity; + } + function createResolver(): EmitResolver { // this variable and functions that use it are deliberately moved here from the outer scope // to avoid scope pollution @@ -35353,7 +35442,7 @@ namespace ts { const symbol = node && getSymbolOfNode(node); return !!(symbol && getCheckFlags(symbol) & CheckFlags.Late); }, - getJsxFactoryEntity: location => location ? (getJsxNamespace(location), (getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity, + getJsxFactoryEntity, getAllAccessorDeclarations(accessor: AccessorDeclaration): AllAccessorDeclarations { accessor = getParseTreeNode(accessor, isGetOrSetAccessorDeclaration)!; // TODO: GH#18217 const otherKind = accessor.kind === SyntaxKind.SetAccessor ? SyntaxKind.GetAccessor : SyntaxKind.SetAccessor; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 988c87e9b4f..4ee407ce1c1 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4292,6 +4292,10 @@ "category": "Message", "code": 6228 }, + "Tag '{0}' expects at least '{1}' arguments, but the JSX factory '{2}' provides at most '{3}'.": { + "category": "Error", + "code": 6229 + }, "Projects to reference": { "category": "Message", diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 55ceab79410..7badd3af99e 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -864,14 +864,17 @@ namespace ts { } } - export function entityNameToString(name: EntityNameOrEntityNameExpression): string { + export function entityNameToString(name: EntityNameOrEntityNameExpression | JsxTagNameExpression | PrivateIdentifier): string { switch (name.kind) { + case SyntaxKind.ThisKeyword: + return "this"; + case SyntaxKind.PrivateIdentifier: case SyntaxKind.Identifier: return getFullWidth(name) === 0 ? idText(name) : getTextOfNode(name); case SyntaxKind.QualifiedName: return entityNameToString(name.left) + "." + entityNameToString(name.right); case SyntaxKind.PropertyAccessExpression: - if (isIdentifier(name.name)) { + if (isIdentifier(name.name) || isPrivateIdentifier(name.name)) { return entityNameToString(name.expression) + "." + entityNameToString(name.name); } else { diff --git a/tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.errors.txt b/tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.errors.txt new file mode 100644 index 00000000000..f94c39ce5f8 --- /dev/null +++ b/tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.errors.txt @@ -0,0 +1,35 @@ +tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx(19,12): error TS6229: Tag 'MyComp4' expects at least '4' arguments, but the JSX factory 'React.createElement' provides at most '2'. +tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx(20,12): error TS6229: Tag 'MyComp3' expects at least '3' arguments, but the JSX factory 'React.createElement' provides at most '2'. + + +==== tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx (2 errors) ==== + /// + + import * as React from "react"; + + interface MyProps { + x: number; + } + + function MyComp4(props: MyProps, context: any, bad: any, verybad: any) { + return
; + } + function MyComp3(props: MyProps, context: any, bad: any) { + return
; + } + function MyComp2(props: MyProps, context: any) { + return
+ } + + const a = ; // using `MyComp` as a component should error - it expects more arguments than react provides + ~~~~~~~ +!!! error TS6229: Tag 'MyComp4' expects at least '4' arguments, but the JSX factory 'React.createElement' provides at most '2'. +!!! related TS2728 tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx:9:10: 'MyComp4' is declared here. + const b = ; // using `MyComp` as a component should error - it expects more arguments than react provides + ~~~~~~~ +!!! error TS6229: Tag 'MyComp3' expects at least '3' arguments, but the JSX factory 'React.createElement' provides at most '2'. +!!! related TS2728 tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx:12:10: 'MyComp3' is declared here. + const c = ; // Should be OK, `context` is allowed, per react rules + + declare function MyTagWithOptionalNonJSXBits(props: MyProps, context: any, nonReactArg?: string): JSX.Element; + const d = ; // Technically OK, but probably questionable \ No newline at end of file diff --git a/tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.js b/tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.js new file mode 100644 index 00000000000..f00c2f3795b --- /dev/null +++ b/tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.js @@ -0,0 +1,44 @@ +//// [jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx] +/// + +import * as React from "react"; + +interface MyProps { + x: number; +} + +function MyComp4(props: MyProps, context: any, bad: any, verybad: any) { + return
; +} +function MyComp3(props: MyProps, context: any, bad: any) { + return
; +} +function MyComp2(props: MyProps, context: any) { + return
+} + +const a = ; // using `MyComp` as a component should error - it expects more arguments than react provides +const b = ; // using `MyComp` as a component should error - it expects more arguments than react provides +const c = ; // Should be OK, `context` is allowed, per react rules + +declare function MyTagWithOptionalNonJSXBits(props: MyProps, context: any, nonReactArg?: string): JSX.Element; +const d = ; // Technically OK, but probably questionable + +//// [jsxIssuesErrorWhenTagExpectsTooManyArguments.js] +"use strict"; +/// +exports.__esModule = true; +var React = require("react"); +function MyComp4(props, context, bad, verybad) { + return React.createElement("div", null); +} +function MyComp3(props, context, bad) { + return React.createElement("div", null); +} +function MyComp2(props, context) { + return React.createElement("div", null); +} +var a = React.createElement(MyComp4, { x: 2 }); // using `MyComp` as a component should error - it expects more arguments than react provides +var b = React.createElement(MyComp3, { x: 2 }); // using `MyComp` as a component should error - it expects more arguments than react provides +var c = React.createElement(MyComp2, { x: 2 }); // Should be OK, `context` is allowed, per react rules +var d = React.createElement(MyTagWithOptionalNonJSXBits, { x: 2 }); // Technically OK, but probably questionable diff --git a/tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.symbols b/tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.symbols new file mode 100644 index 00000000000..ce2ae27e6e2 --- /dev/null +++ b/tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.symbols @@ -0,0 +1,76 @@ +=== tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx === +/// + +import * as React from "react"; +>React : Symbol(React, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 2, 6)) + +interface MyProps { +>MyProps : Symbol(MyProps, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 2, 31)) + + x: number; +>x : Symbol(MyProps.x, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 4, 19)) +} + +function MyComp4(props: MyProps, context: any, bad: any, verybad: any) { +>MyComp4 : Symbol(MyComp4, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 6, 1)) +>props : Symbol(props, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 8, 17)) +>MyProps : Symbol(MyProps, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 2, 31)) +>context : Symbol(context, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 8, 32)) +>bad : Symbol(bad, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 8, 46)) +>verybad : Symbol(verybad, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 8, 56)) + + return
; +>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2420, 114)) +>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2420, 114)) +} +function MyComp3(props: MyProps, context: any, bad: any) { +>MyComp3 : Symbol(MyComp3, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 10, 1)) +>props : Symbol(props, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 11, 17)) +>MyProps : Symbol(MyProps, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 2, 31)) +>context : Symbol(context, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 11, 32)) +>bad : Symbol(bad, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 11, 46)) + + return
; +>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2420, 114)) +>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2420, 114)) +} +function MyComp2(props: MyProps, context: any) { +>MyComp2 : Symbol(MyComp2, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 13, 1)) +>props : Symbol(props, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 14, 17)) +>MyProps : Symbol(MyProps, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 2, 31)) +>context : Symbol(context, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 14, 32)) + + return
+>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2420, 114)) +>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2420, 114)) +} + +const a = ; // using `MyComp` as a component should error - it expects more arguments than react provides +>a : Symbol(a, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 18, 5)) +>MyComp4 : Symbol(MyComp4, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 6, 1)) +>x : Symbol(x, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 18, 18)) + +const b = ; // using `MyComp` as a component should error - it expects more arguments than react provides +>b : Symbol(b, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 19, 5)) +>MyComp3 : Symbol(MyComp3, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 10, 1)) +>x : Symbol(x, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 19, 18)) + +const c = ; // Should be OK, `context` is allowed, per react rules +>c : Symbol(c, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 20, 5)) +>MyComp2 : Symbol(MyComp2, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 13, 1)) +>x : Symbol(x, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 20, 19)) + +declare function MyTagWithOptionalNonJSXBits(props: MyProps, context: any, nonReactArg?: string): JSX.Element; +>MyTagWithOptionalNonJSXBits : Symbol(MyTagWithOptionalNonJSXBits, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 20, 28)) +>props : Symbol(props, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 22, 45)) +>MyProps : Symbol(MyProps, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 2, 31)) +>context : Symbol(context, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 22, 60)) +>nonReactArg : Symbol(nonReactArg, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 22, 74)) +>JSX : Symbol(JSX, Decl(react16.d.ts, 2367, 12)) +>Element : Symbol(JSX.Element, Decl(react16.d.ts, 2368, 23)) + +const d = ; // Technically OK, but probably questionable +>d : Symbol(d, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 23, 5)) +>MyTagWithOptionalNonJSXBits : Symbol(MyTagWithOptionalNonJSXBits, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 20, 28)) +>x : Symbol(x, Decl(jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx, 23, 38)) + diff --git a/tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.types b/tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.types new file mode 100644 index 00000000000..a1268955061 --- /dev/null +++ b/tests/baselines/reference/jsxIssuesErrorWhenTagExpectsTooManyArguments.types @@ -0,0 +1,80 @@ +=== tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx === +/// + +import * as React from "react"; +>React : typeof React + +interface MyProps { + x: number; +>x : number +} + +function MyComp4(props: MyProps, context: any, bad: any, verybad: any) { +>MyComp4 : (props: MyProps, context: any, bad: any, verybad: any) => JSX.Element +>props : MyProps +>context : any +>bad : any +>verybad : any + + return
; +>
: JSX.Element +>div : any +>div : any +} +function MyComp3(props: MyProps, context: any, bad: any) { +>MyComp3 : (props: MyProps, context: any, bad: any) => JSX.Element +>props : MyProps +>context : any +>bad : any + + return
; +>
: JSX.Element +>div : any +>div : any +} +function MyComp2(props: MyProps, context: any) { +>MyComp2 : (props: MyProps, context: any) => JSX.Element +>props : MyProps +>context : any + + return
+>
: JSX.Element +>div : any +>div : any +} + +const a = ; // using `MyComp` as a component should error - it expects more arguments than react provides +>a : JSX.Element +> : JSX.Element +>MyComp4 : (props: MyProps, context: any, bad: any, verybad: any) => JSX.Element +>x : number +>2 : 2 + +const b = ; // using `MyComp` as a component should error - it expects more arguments than react provides +>b : JSX.Element +> : JSX.Element +>MyComp3 : (props: MyProps, context: any, bad: any) => JSX.Element +>x : number +>2 : 2 + +const c = ; // Should be OK, `context` is allowed, per react rules +>c : JSX.Element +> : JSX.Element +>MyComp2 : (props: MyProps, context: any) => JSX.Element +>x : number +>2 : 2 + +declare function MyTagWithOptionalNonJSXBits(props: MyProps, context: any, nonReactArg?: string): JSX.Element; +>MyTagWithOptionalNonJSXBits : (props: MyProps, context: any, nonReactArg?: string) => JSX.Element +>props : MyProps +>context : any +>nonReactArg : string +>JSX : any + +const d = ; // Technically OK, but probably questionable +>d : JSX.Element +> : JSX.Element +>MyTagWithOptionalNonJSXBits : (props: MyProps, context: any, nonReactArg?: string) => JSX.Element +>x : number +>2 : 2 + diff --git a/tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx b/tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx new file mode 100644 index 00000000000..dd39d304f5e --- /dev/null +++ b/tests/cases/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.tsx @@ -0,0 +1,25 @@ +// @jsx: react +/// + +import * as React from "react"; + +interface MyProps { + x: number; +} + +function MyComp4(props: MyProps, context: any, bad: any, verybad: any) { + return
; +} +function MyComp3(props: MyProps, context: any, bad: any) { + return
; +} +function MyComp2(props: MyProps, context: any) { + return
+} + +const a = ; // using `MyComp` as a component should error - it expects more arguments than react provides +const b = ; // using `MyComp` as a component should error - it expects more arguments than react provides +const c = ; // Should be OK, `context` is allowed, per react rules + +declare function MyTagWithOptionalNonJSXBits(props: MyProps, context: any, nonReactArg?: string): JSX.Element; +const d = ; // Technically OK, but probably questionable \ No newline at end of file From 3e4ce4777d382f2f2b49bd2c7a279b068278552a Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 25 Feb 2020 13:45:27 -0800 Subject: [PATCH 08/17] Support declaration emit for late bound element accesses assigned to functions in both TS and JS (#36593) --- src/compiler/checker.ts | 33 ++++++-- src/compiler/transformers/declarations.ts | 13 ++- .../transformers/declarations/diagnostics.ts | 12 ++- src/compiler/types.ts | 3 +- src/compiler/utilities.ts | 4 + ...oundElementAccessAssignmentDeclarations.js | 40 +++++++++ ...lementAccessAssignmentDeclarations.symbols | 58 +++++++++++++ ...dElementAccessAssignmentDeclarations.types | 80 ++++++++++++++++++ ...ElementAccessAssignmentDeclarationsInJs.js | 29 +++++++ ...ntAccessAssignmentDeclarationsInJs.symbols | 62 ++++++++++++++ ...mentAccessAssignmentDeclarationsInJs.types | 84 +++++++++++++++++++ ...oundElementAccessAssignmentDeclarations.ts | 18 ++++ ...ElementAccessAssignmentDeclarationsInJs.ts | 26 ++++++ 13 files changed, 449 insertions(+), 13 deletions(-) create mode 100644 tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.js create mode 100644 tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.symbols create mode 100644 tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.types create mode 100644 tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.js create mode 100644 tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.symbols create mode 100644 tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.types create mode 100644 tests/cases/compiler/lateBoundElementAccessAssignmentDeclarations.ts create mode 100644 tests/cases/compiler/lateBoundElementAccessAssignmentDeclarationsInJs.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 04dc876c45b..0dd2bc01957 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3069,9 +3069,20 @@ namespace ts { function resolveExternalModuleSymbol(moduleSymbol: Symbol | undefined, dontResolveAlias?: boolean): Symbol | undefined; function resolveExternalModuleSymbol(moduleSymbol: Symbol, dontResolveAlias?: boolean): Symbol { if (moduleSymbol) { + const links = getSymbolLinks(moduleSymbol); + if (!dontResolveAlias) { + links.resolvedExternalModuleSymbol = "circular"; + } const exportEquals = resolveSymbol(moduleSymbol.exports!.get(InternalSymbolName.ExportEquals), dontResolveAlias); const exported = getCommonJsExportEquals(getMergedSymbol(exportEquals), getMergedSymbol(moduleSymbol)); - return getMergedSymbol(exported) || moduleSymbol; + const result = getMergedSymbol(exported) || moduleSymbol; + if (!dontResolveAlias) { + // we "cache" this result, but because both the input _and_ the output are mergeable, literally every call could need + // a different result, assuming the inputs and outputs get merged with. So instead we just use this as a flag that + // export assignment resolution has occured on this symbol at least once. (because it might happen many times!) + links.resolvedExternalModuleSymbol = result; + } + return result; } return undefined!; } @@ -5543,7 +5554,7 @@ namespace ts { function serializeSymbolWorker(symbol: Symbol, isPrivate: boolean, propertyAsAlias: boolean) { const symbolName = unescapeLeadingUnderscores(symbol.escapedName); const isDefault = symbol.escapedName === InternalSymbolName.Default; - if (isStringANonContextualKeyword(symbolName) && !isDefault) { + if ((isStringANonContextualKeyword(symbolName) || !isIdentifierText(symbolName, languageVersion)) && !isDefault && symbol.escapedName !== InternalSymbolName.ExportEquals) { // Oh no. We cannot use this symbol's name as it's name... It's likely some jsdoc had an invalid name like `export` or `default` :( context.encounteredError = true; // TODO: Issue error via symbol tracker? @@ -5694,7 +5705,8 @@ namespace ts { } function getNamespaceMembersForSerialization(symbol: Symbol) { - return !symbol.exports ? [] : filter(arrayFrom((symbol.exports).values()), p => !((p.flags & SymbolFlags.Prototype) || (p.escapedName === "prototype"))); + const exports = getExportsOfSymbol(symbol); + return !exports ? [] : filter(arrayFrom((exports).values()), p => !((p.flags & SymbolFlags.Prototype) || (p.escapedName === "prototype"))); } function isTypeOnlyNamespace(symbol: Symbol) { @@ -8896,6 +8908,17 @@ namespace ts { function getResolvedMembersOrExportsOfSymbol(symbol: Symbol, resolutionKind: MembersOrExportsResolutionKind): UnderscoreEscapedMap { const links = getSymbolLinks(symbol); if (!links[resolutionKind]) { + // We _must_ resolve any possible commonjs export assignments _before_ merging in late bound members, as cjs export assignments may cause + // things to be merged (?!?) into this symbol; moreover, we _can't_ resolve those export assignments if we're already resolving the containing + // module (as then we'll issue a circularity error) + const p = symbol.valueDeclaration?.parent; + if (p && isSourceFile(p) && p.symbol && !getSymbolLinks(p.symbol).resolvedExternalModuleSymbol) { + const exported = resolveExternalModuleSymbol(p.symbol); + const targetLinks = exported && getSymbolLinks(exported); + if (targetLinks && targetLinks[resolutionKind]) { + return links[resolutionKind] = targetLinks[resolutionKind]!; + } + } const isStatic = resolutionKind === MembersOrExportsResolutionKind.resolvedExports; const earlySymbols = !isStatic ? symbol.members : symbol.flags & SymbolFlags.Module ? getExportsOfModuleWorker(symbol) : @@ -35274,8 +35297,8 @@ namespace ts { } } - function createTypeOfDeclaration(declarationIn: AccessorDeclaration | VariableLikeDeclaration | PropertyAccessExpression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker, addUndefined?: boolean) { - const declaration = getParseTreeNode(declarationIn, isVariableLikeOrAccessor); + function createTypeOfDeclaration(declarationIn: AccessorDeclaration | VariableLikeDeclaration | PropertyAccessExpression | ElementAccessExpression | BinaryExpression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker, addUndefined?: boolean) { + const declaration = getParseTreeNode(declarationIn, isPossiblyPropertyLikeDeclaration); if (!declaration) { return createToken(SyntaxKind.AnyKeyword) as KeywordTypeNode; } diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index 00417535145..605e441da67 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -1157,13 +1157,20 @@ namespace ts { fakespace.locals = createSymbolTable(props); fakespace.symbol = props[0].parent!; const declarations = mapDefined(props, p => { - if (!isPropertyAccessExpression(p.valueDeclaration)) { - return undefined; // TODO GH#33569: Handle element access expressions that created late bound names (rather than silently omitting them) + if (!isPropertyAccessExpression(p.valueDeclaration) && !isElementAccessExpression(p.valueDeclaration) && !isBinaryExpression(p.valueDeclaration)) { + return undefined; + } + if (hasDynamicName(p.valueDeclaration) && !resolver.isLateBound(getParseTreeNode(p.valueDeclaration) as Declaration)) { + return undefined; + } + const name = unescapeLeadingUnderscores(p.escapedName); + if (!isIdentifierText(name, ScriptTarget.ES3)) { + return undefined; // TODO: Rather than quietly eliding (as is current behavior), maybe we should issue errors? } getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration); const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, symbolTracker); getSymbolAccessibilityDiagnostic = oldDiag; - const varDecl = createVariableDeclaration(unescapeLeadingUnderscores(p.escapedName), type, /*initializer*/ undefined); + const varDecl = createVariableDeclaration(name, type, /*initializer*/ undefined); return createVariableStatement(/*modifiers*/ undefined, createVariableDeclarationList([varDecl])); }); const namespaceDecl = createModuleDeclaration(/*decorators*/ undefined, ensureModifiers(input), input.name!, createModuleBlock(declarations), NodeFlags.Namespace); diff --git a/src/compiler/transformers/declarations/diagnostics.ts b/src/compiler/transformers/declarations/diagnostics.ts index ac44f7efd15..1b7827f552f 100644 --- a/src/compiler/transformers/declarations/diagnostics.ts +++ b/src/compiler/transformers/declarations/diagnostics.ts @@ -27,7 +27,9 @@ namespace ts { | TypeAliasDeclaration | ConstructorDeclaration | IndexSignatureDeclaration - | PropertyAccessExpression; + | PropertyAccessExpression + | ElementAccessExpression + | BinaryExpression; export function canProduceDiagnostics(node: Node): node is DeclarationDiagnosticProducing { return isVariableDeclaration(node) || @@ -48,7 +50,9 @@ namespace ts { isTypeAliasDeclaration(node) || isConstructorDeclaration(node) || isIndexSignatureDeclaration(node) || - isPropertyAccessExpression(node); + isPropertyAccessExpression(node) || + isElementAccessExpression(node) || + isBinaryExpression(node); } export function createGetSymbolAccessibilityDiagnosticForNodeName(node: DeclarationDiagnosticProducing) { @@ -125,7 +129,7 @@ namespace ts { } export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationDiagnosticProducing): (symbolAccessibilityResult: SymbolAccessibilityResult) => SymbolAccessibilityDiagnostic | undefined { - if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) { + if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node) || isBinaryExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) { return getVariableDeclarationTypeVisibilityError; } else if (isSetAccessor(node) || isGetAccessor(node)) { @@ -166,7 +170,7 @@ namespace ts { } // This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit // The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all. - else if (node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertyAccessExpression || node.kind === SyntaxKind.PropertySignature || + else if (node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertyAccessExpression || node.kind === SyntaxKind.ElementAccessExpression || node.kind === SyntaxKind.BinaryExpression || node.kind === SyntaxKind.PropertySignature || (node.kind === SyntaxKind.Parameter && hasModifier(node.parent, ModifierFlags.Private))) { // TODO(jfreeman): Deal with computed properties in error reporting. if (hasModifier(node, ModifierFlags.Static)) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 26d5693391c..5158684e0ad 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3930,7 +3930,7 @@ namespace ts { isOptionalUninitializedParameterProperty(node: ParameterDeclaration): boolean; isExpandoFunctionDeclaration(node: FunctionDeclaration): boolean; getPropertiesOfContainerFunction(node: Declaration): Symbol[]; - createTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration | PropertyAccessExpression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker, addUndefined?: boolean): TypeNode | undefined; + createTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration | PropertyAccessExpression | ElementAccessExpression | BinaryExpression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker, addUndefined?: boolean): TypeNode | undefined; createReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker): TypeNode | undefined; createTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker): TypeNode | undefined; createLiteralConstValue(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration, tracker: SymbolTracker): Expression; @@ -4104,6 +4104,7 @@ namespace ts { deferralParent?: Type; // Source union/intersection of a deferred type cjsExportMerged?: Symbol; // Version of the symbol with all non export= exports merged with the export= target typeOnlyDeclaration?: TypeOnlyCompatibleAliasDeclaration | false; // First resolved alias declaration that makes the symbol only usable in type constructs + resolvedExternalModuleSymbol?: Symbol | "circular"; // Cached result of `resolveExternalModuleSymbol` } /* @internal */ diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 7badd3af99e..26873a95d3d 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1299,6 +1299,10 @@ namespace ts { return isVariableLike(node) || isAccessor(node); } + export function isPossiblyPropertyLikeDeclaration(node: Node): node is AccessorDeclaration | VariableLikeDeclaration | PropertyAccessExpression | ElementAccessExpression { + return isVariableLikeOrAccessor(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node) || isBinaryExpression(node); + } + export function isVariableDeclarationInVariableStatement(node: VariableDeclaration) { return node.parent.kind === SyntaxKind.VariableDeclarationList && node.parent.parent.kind === SyntaxKind.VariableStatement; diff --git a/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.js b/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.js new file mode 100644 index 00000000000..b32a31e9a35 --- /dev/null +++ b/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.js @@ -0,0 +1,40 @@ +//// [lateBoundElementAccessAssignmentDeclarations.ts] +export function foo() {} +foo.bar = 12; +const _private = Symbol(); +foo[_private] = "ok"; +const strMem = "strMemName"; +foo[strMem] = "ok"; +const dashStrMem = "dashed-str-mem"; +foo[dashStrMem] = "ok"; +const numMem = 42; +foo[numMem] = "ok"; + +const x: string = foo[_private]; +const y: string = foo[strMem]; +const z: string = foo[numMem]; +const a: string = foo[dashStrMem]; + +//// [lateBoundElementAccessAssignmentDeclarations.js] +export function foo() { } +foo.bar = 12; +const _private = Symbol(); +foo[_private] = "ok"; +const strMem = "strMemName"; +foo[strMem] = "ok"; +const dashStrMem = "dashed-str-mem"; +foo[dashStrMem] = "ok"; +const numMem = 42; +foo[numMem] = "ok"; +const x = foo[_private]; +const y = foo[strMem]; +const z = foo[numMem]; +const a = foo[dashStrMem]; + + +//// [lateBoundElementAccessAssignmentDeclarations.d.ts] +export declare function foo(): void; +export declare namespace foo { + var bar: number; + var strMemName: string; +} diff --git a/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.symbols b/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.symbols new file mode 100644 index 00000000000..d407959b0c3 --- /dev/null +++ b/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.symbols @@ -0,0 +1,58 @@ +=== tests/cases/compiler/lateBoundElementAccessAssignmentDeclarations.ts === +export function foo() {} +>foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) + +foo.bar = 12; +>foo.bar : Symbol(foo.bar, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24)) +>foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) +>bar : Symbol(foo.bar, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24)) + +const _private = Symbol(); +>_private : Symbol(_private, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +foo[_private] = "ok"; +>foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) +>_private : Symbol(_private, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 5)) + +const strMem = "strMemName"; +>strMem : Symbol(strMem, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 5)) + +foo[strMem] = "ok"; +>foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) +>strMem : Symbol(strMem, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 5)) + +const dashStrMem = "dashed-str-mem"; +>dashStrMem : Symbol(dashStrMem, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 5)) + +foo[dashStrMem] = "ok"; +>foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) +>dashStrMem : Symbol(dashStrMem, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 5)) + +const numMem = 42; +>numMem : Symbol(numMem, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 8, 5)) + +foo[numMem] = "ok"; +>foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) +>numMem : Symbol(numMem, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 8, 5)) + +const x: string = foo[_private]; +>x : Symbol(x, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 11, 5)) +>foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) +>_private : Symbol(_private, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 5)) + +const y: string = foo[strMem]; +>y : Symbol(y, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 12, 5)) +>foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) +>strMem : Symbol(strMem, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 5)) + +const z: string = foo[numMem]; +>z : Symbol(z, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 13, 5)) +>foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) +>numMem : Symbol(numMem, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 8, 5)) + +const a: string = foo[dashStrMem]; +>a : Symbol(a, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 14, 5)) +>foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) +>dashStrMem : Symbol(dashStrMem, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 5)) + diff --git a/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.types b/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.types new file mode 100644 index 00000000000..2175a04ecfc --- /dev/null +++ b/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.types @@ -0,0 +1,80 @@ +=== tests/cases/compiler/lateBoundElementAccessAssignmentDeclarations.ts === +export function foo() {} +>foo : typeof foo + +foo.bar = 12; +>foo.bar = 12 : 12 +>foo.bar : number +>foo : typeof foo +>bar : number +>12 : 12 + +const _private = Symbol(); +>_private : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +foo[_private] = "ok"; +>foo[_private] = "ok" : "ok" +>foo[_private] : string +>foo : typeof foo +>_private : unique symbol +>"ok" : "ok" + +const strMem = "strMemName"; +>strMem : "strMemName" +>"strMemName" : "strMemName" + +foo[strMem] = "ok"; +>foo[strMem] = "ok" : "ok" +>foo[strMem] : string +>foo : typeof foo +>strMem : "strMemName" +>"ok" : "ok" + +const dashStrMem = "dashed-str-mem"; +>dashStrMem : "dashed-str-mem" +>"dashed-str-mem" : "dashed-str-mem" + +foo[dashStrMem] = "ok"; +>foo[dashStrMem] = "ok" : "ok" +>foo[dashStrMem] : string +>foo : typeof foo +>dashStrMem : "dashed-str-mem" +>"ok" : "ok" + +const numMem = 42; +>numMem : 42 +>42 : 42 + +foo[numMem] = "ok"; +>foo[numMem] = "ok" : "ok" +>foo[numMem] : string +>foo : typeof foo +>numMem : 42 +>"ok" : "ok" + +const x: string = foo[_private]; +>x : string +>foo[_private] : string +>foo : typeof foo +>_private : unique symbol + +const y: string = foo[strMem]; +>y : string +>foo[strMem] : string +>foo : typeof foo +>strMem : "strMemName" + +const z: string = foo[numMem]; +>z : string +>foo[numMem] : string +>foo : typeof foo +>numMem : 42 + +const a: string = foo[dashStrMem]; +>a : string +>foo[dashStrMem] : string +>foo : typeof foo +>dashStrMem : "dashed-str-mem" + diff --git a/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.js b/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.js new file mode 100644 index 00000000000..a9b6a0a86cd --- /dev/null +++ b/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.js @@ -0,0 +1,29 @@ +//// [file.js] +export function foo() {} +foo.bar = 12; +const _private = Symbol(); +foo[_private] = "ok"; +const strMem = "strMemName"; +foo[strMem] = "ok"; +const dashStrMem = "dashed-str-mem"; +foo[dashStrMem] = "ok"; +const numMem = 42; +foo[numMem] = "ok"; + +/** @type {string} */ +const x = foo[_private]; +/** @type {string} */ +const y = foo[strMem]; +/** @type {string} */ +const z = foo[numMem]; +/** @type {string} */ +const a = foo[dashStrMem]; + + + +//// [file.d.ts] +export function foo(): void; +export namespace foo { + export const bar: number; + export const strMemName: string; +} diff --git a/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.symbols b/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.symbols new file mode 100644 index 00000000000..669ed588b19 --- /dev/null +++ b/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.symbols @@ -0,0 +1,62 @@ +=== tests/cases/compiler/file.js === +export function foo() {} +>foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) + +foo.bar = 12; +>foo.bar : Symbol(foo.bar, Decl(file.js, 0, 24)) +>foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) +>bar : Symbol(foo.bar, Decl(file.js, 0, 24)) + +const _private = Symbol(); +>_private : Symbol(_private, Decl(file.js, 2, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +foo[_private] = "ok"; +>foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) +>_private : Symbol(_private, Decl(file.js, 2, 5)) + +const strMem = "strMemName"; +>strMem : Symbol(strMem, Decl(file.js, 4, 5)) + +foo[strMem] = "ok"; +>foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) +>strMem : Symbol(strMem, Decl(file.js, 4, 5)) + +const dashStrMem = "dashed-str-mem"; +>dashStrMem : Symbol(dashStrMem, Decl(file.js, 6, 5)) + +foo[dashStrMem] = "ok"; +>foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) +>dashStrMem : Symbol(dashStrMem, Decl(file.js, 6, 5)) + +const numMem = 42; +>numMem : Symbol(numMem, Decl(file.js, 8, 5)) + +foo[numMem] = "ok"; +>foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) +>numMem : Symbol(numMem, Decl(file.js, 8, 5)) + +/** @type {string} */ +const x = foo[_private]; +>x : Symbol(x, Decl(file.js, 12, 5)) +>foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) +>_private : Symbol(_private, Decl(file.js, 2, 5)) + +/** @type {string} */ +const y = foo[strMem]; +>y : Symbol(y, Decl(file.js, 14, 5)) +>foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) +>strMem : Symbol(strMem, Decl(file.js, 4, 5)) + +/** @type {string} */ +const z = foo[numMem]; +>z : Symbol(z, Decl(file.js, 16, 5)) +>foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) +>numMem : Symbol(numMem, Decl(file.js, 8, 5)) + +/** @type {string} */ +const a = foo[dashStrMem]; +>a : Symbol(a, Decl(file.js, 18, 5)) +>foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) +>dashStrMem : Symbol(dashStrMem, Decl(file.js, 6, 5)) + diff --git a/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.types b/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.types new file mode 100644 index 00000000000..d2c80bf4a58 --- /dev/null +++ b/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.types @@ -0,0 +1,84 @@ +=== tests/cases/compiler/file.js === +export function foo() {} +>foo : typeof foo + +foo.bar = 12; +>foo.bar = 12 : 12 +>foo.bar : number +>foo : typeof foo +>bar : number +>12 : 12 + +const _private = Symbol(); +>_private : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +foo[_private] = "ok"; +>foo[_private] = "ok" : "ok" +>foo[_private] : string +>foo : typeof foo +>_private : unique symbol +>"ok" : "ok" + +const strMem = "strMemName"; +>strMem : "strMemName" +>"strMemName" : "strMemName" + +foo[strMem] = "ok"; +>foo[strMem] = "ok" : "ok" +>foo[strMem] : string +>foo : typeof foo +>strMem : "strMemName" +>"ok" : "ok" + +const dashStrMem = "dashed-str-mem"; +>dashStrMem : "dashed-str-mem" +>"dashed-str-mem" : "dashed-str-mem" + +foo[dashStrMem] = "ok"; +>foo[dashStrMem] = "ok" : "ok" +>foo[dashStrMem] : string +>foo : typeof foo +>dashStrMem : "dashed-str-mem" +>"ok" : "ok" + +const numMem = 42; +>numMem : 42 +>42 : 42 + +foo[numMem] = "ok"; +>foo[numMem] = "ok" : "ok" +>foo[numMem] : string +>foo : typeof foo +>numMem : 42 +>"ok" : "ok" + +/** @type {string} */ +const x = foo[_private]; +>x : string +>foo[_private] : string +>foo : typeof foo +>_private : unique symbol + +/** @type {string} */ +const y = foo[strMem]; +>y : string +>foo[strMem] : string +>foo : typeof foo +>strMem : "strMemName" + +/** @type {string} */ +const z = foo[numMem]; +>z : string +>foo[numMem] : string +>foo : typeof foo +>numMem : 42 + +/** @type {string} */ +const a = foo[dashStrMem]; +>a : string +>foo[dashStrMem] : string +>foo : typeof foo +>dashStrMem : "dashed-str-mem" + diff --git a/tests/cases/compiler/lateBoundElementAccessAssignmentDeclarations.ts b/tests/cases/compiler/lateBoundElementAccessAssignmentDeclarations.ts new file mode 100644 index 00000000000..fc90e9486bb --- /dev/null +++ b/tests/cases/compiler/lateBoundElementAccessAssignmentDeclarations.ts @@ -0,0 +1,18 @@ +// @strict: true +// @declaration: true +// @target: es6 +export function foo() {} +foo.bar = 12; +const _private = Symbol(); +foo[_private] = "ok"; +const strMem = "strMemName"; +foo[strMem] = "ok"; +const dashStrMem = "dashed-str-mem"; +foo[dashStrMem] = "ok"; +const numMem = 42; +foo[numMem] = "ok"; + +const x: string = foo[_private]; +const y: string = foo[strMem]; +const z: string = foo[numMem]; +const a: string = foo[dashStrMem]; \ No newline at end of file diff --git a/tests/cases/compiler/lateBoundElementAccessAssignmentDeclarationsInJs.ts b/tests/cases/compiler/lateBoundElementAccessAssignmentDeclarationsInJs.ts new file mode 100644 index 00000000000..878d05ffa0a --- /dev/null +++ b/tests/cases/compiler/lateBoundElementAccessAssignmentDeclarationsInJs.ts @@ -0,0 +1,26 @@ +// @strict: true +// @declaration: true +// @target: es6 +// @checkJs: true +// @allowJs: true +// @emitDeclarationOnly: true +// @filename: file.js +export function foo() {} +foo.bar = 12; +const _private = Symbol(); +foo[_private] = "ok"; +const strMem = "strMemName"; +foo[strMem] = "ok"; +const dashStrMem = "dashed-str-mem"; +foo[dashStrMem] = "ok"; +const numMem = 42; +foo[numMem] = "ok"; + +/** @type {string} */ +const x = foo[_private]; +/** @type {string} */ +const y = foo[strMem]; +/** @type {string} */ +const z = foo[numMem]; +/** @type {string} */ +const a = foo[dashStrMem]; \ No newline at end of file From 43863cafe2e636a3b4a24fdfccf5a56cd10b34d7 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Tue, 25 Feb 2020 13:46:24 -0800 Subject: [PATCH 09/17] Check for undefined `source.symbol` (#37021) Fixes #37014 --- src/compiler/checker.ts | 1 + ...teFieldAssignabilityFromUnknown.errors.txt | 16 ++++++++++++++ .../privateFieldAssignabilityFromUnknown.js | 21 +++++++++++++++++++ ...ivateFieldAssignabilityFromUnknown.symbols | 12 +++++++++++ ...privateFieldAssignabilityFromUnknown.types | 13 ++++++++++++ .../privateFieldAssignabilityFromUnknown.ts | 5 +++++ 6 files changed, 68 insertions(+) create mode 100644 tests/baselines/reference/privateFieldAssignabilityFromUnknown.errors.txt create mode 100644 tests/baselines/reference/privateFieldAssignabilityFromUnknown.js create mode 100644 tests/baselines/reference/privateFieldAssignabilityFromUnknown.symbols create mode 100644 tests/baselines/reference/privateFieldAssignabilityFromUnknown.types create mode 100644 tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0dd2bc01957..c9eb2d49b9b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -16273,6 +16273,7 @@ namespace ts { if (unmatchedProperty.valueDeclaration && isNamedDeclaration(unmatchedProperty.valueDeclaration) && isPrivateIdentifier(unmatchedProperty.valueDeclaration.name) + && source.symbol && source.symbol.flags & SymbolFlags.Class) { const privateIdentifierDescription = unmatchedProperty.valueDeclaration.name.escapedText; const symbolTableKey = getSymbolNameForPrivateIdentifier(source.symbol, privateIdentifierDescription); diff --git a/tests/baselines/reference/privateFieldAssignabilityFromUnknown.errors.txt b/tests/baselines/reference/privateFieldAssignabilityFromUnknown.errors.txt new file mode 100644 index 00000000000..22f50eec6ff --- /dev/null +++ b/tests/baselines/reference/privateFieldAssignabilityFromUnknown.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts(2,3): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher. +tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts(5,7): error TS2741: Property '#field' is missing in type '{}' but required in type 'Class'. + + +==== tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts (2 errors) ==== + export class Class { + #field: any + ~~~~~~ +!!! error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher. + } + + const task: Class = {} as unknown; + ~~~~ +!!! error TS2741: Property '#field' is missing in type '{}' but required in type 'Class'. +!!! related TS2728 tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts:2:3: '#field' is declared here. + \ No newline at end of file diff --git a/tests/baselines/reference/privateFieldAssignabilityFromUnknown.js b/tests/baselines/reference/privateFieldAssignabilityFromUnknown.js new file mode 100644 index 00000000000..78e0988d8cf --- /dev/null +++ b/tests/baselines/reference/privateFieldAssignabilityFromUnknown.js @@ -0,0 +1,21 @@ +//// [privateFieldAssignabilityFromUnknown.ts] +export class Class { + #field: any +} + +const task: Class = {} as unknown; + + +//// [privateFieldAssignabilityFromUnknown.js] +"use strict"; +var _field; +exports.__esModule = true; +var Class = /** @class */ (function () { + function Class() { + _field.set(this, void 0); + } + return Class; +}()); +exports.Class = Class; +_field = new WeakMap(); +var task = {}; diff --git a/tests/baselines/reference/privateFieldAssignabilityFromUnknown.symbols b/tests/baselines/reference/privateFieldAssignabilityFromUnknown.symbols new file mode 100644 index 00000000000..0e1be5720e2 --- /dev/null +++ b/tests/baselines/reference/privateFieldAssignabilityFromUnknown.symbols @@ -0,0 +1,12 @@ +=== tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts === +export class Class { +>Class : Symbol(Class, Decl(privateFieldAssignabilityFromUnknown.ts, 0, 0)) + + #field: any +>#field : Symbol(Class.#field, Decl(privateFieldAssignabilityFromUnknown.ts, 0, 20)) +} + +const task: Class = {} as unknown; +>task : Symbol(task, Decl(privateFieldAssignabilityFromUnknown.ts, 4, 5)) +>Class : Symbol(Class, Decl(privateFieldAssignabilityFromUnknown.ts, 0, 0)) + diff --git a/tests/baselines/reference/privateFieldAssignabilityFromUnknown.types b/tests/baselines/reference/privateFieldAssignabilityFromUnknown.types new file mode 100644 index 00000000000..90aed258dbc --- /dev/null +++ b/tests/baselines/reference/privateFieldAssignabilityFromUnknown.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts === +export class Class { +>Class : Class + + #field: any +>#field : any +} + +const task: Class = {} as unknown; +>task : Class +>{} as unknown : unknown +>{} : {} + diff --git a/tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts b/tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts new file mode 100644 index 00000000000..09f8cf460ed --- /dev/null +++ b/tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts @@ -0,0 +1,5 @@ +export class Class { + #field: any +} + +const task: Class = {} as unknown; From 8a797cad2bb941372eb864145751d891d3edaecc Mon Sep 17 00:00:00 2001 From: Orta Date: Tue, 25 Feb 2020 17:09:16 -0500 Subject: [PATCH 10/17] Adds floating block comments to the outlining spans response (#36880) * Adds floating block comments to the outlining spans response * Only use one route for grabbing outline nodes, which now includes special casing the EOF token --- src/harness/fourslashImpl.ts | 25 ++++++++++++++++--- src/services/outliningElementsCollector.ts | 5 ++-- tests/cases/fourslash/fourslash.ts | 2 +- ...lineSpansBlockCommentsWithoutStatements.ts | 9 +++++++ ...ansTrailingBlockCommentsAfterStatements.ts | 10 ++++++++ .../server/getOutliningSpansForRegions.ts | 2 +- 6 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 tests/cases/fourslash/outlineSpansBlockCommentsWithoutStatements.ts create mode 100644 tests/cases/fourslash/outlineSpansTrailingBlockCommentsAfterStatements.ts diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index d85ff7ecd77..eed3ba9d020 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -2500,18 +2500,35 @@ namespace FourSlash { public printOutliningSpans() { const spans = this.languageService.getOutliningSpans(this.activeFile.fileName); - Harness.IO.log(`Outlining spans (${spans.length} items)`); + Harness.IO.log(`Outlining spans (${spans.length} items)\nResults:`); Harness.IO.log(stringify(spans)); + this.printOutliningSpansInline(spans); + } + + private printOutliningSpansInline(spans: ts.OutliningSpan[]) { + const allSpanInsets = [] as { text: string, pos: number }[]; + let annotated = this.activeFile.content; + ts.forEach(spans, span => { + allSpanInsets.push({ text: "[|", pos: span.textSpan.start }); + allSpanInsets.push({ text: "|]", pos: span.textSpan.start + span.textSpan.length }); + }); + + const reverseSpans = allSpanInsets.sort((l, r) => r.pos - l.pos); + ts.forEach(reverseSpans, span => { + annotated = annotated.slice(0, span.pos) + span.text + annotated.slice(span.pos); + }); + Harness.IO.log(`\nMockup:\n${annotated}`); } public verifyOutliningSpans(spans: Range[], kind?: "comment" | "region" | "code" | "imports") { const actual = this.languageService.getOutliningSpans(this.activeFile.fileName); - if (actual.length !== spans.length) { - this.raiseError(`verifyOutliningSpans failed - expected total spans to be ${spans.length}, but was ${actual.length}`); + const filterActual = ts.filter(actual, f => kind === undefined ? true : f.kind === kind); + if (filterActual.length !== spans.length) { + this.raiseError(`verifyOutliningSpans failed - expected total spans to be ${spans.length}, but was ${actual.length}\n\nFound Spans:\n\n${this.printOutliningSpansInline(actual)}`); } - ts.zipWith(spans, actual, (expectedSpan, actualSpan, i) => { + ts.zipWith(spans, filterActual, (expectedSpan, actualSpan, i) => { if (expectedSpan.pos !== actualSpan.textSpan.start || expectedSpan.end !== ts.textSpanEnd(actualSpan.textSpan)) { return this.raiseError(`verifyOutliningSpans failed - span ${(i + 1)} expected: (${expectedSpan.pos},${expectedSpan.end}), actual: (${actualSpan.textSpan.start},${ts.textSpanEnd(actualSpan.textSpan)})`); } diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index b6212e2a2d2..ab8cfb3f6c3 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -10,7 +10,8 @@ namespace ts.OutliningElementsCollector { function addNodeOutliningSpans(sourceFile: SourceFile, cancellationToken: CancellationToken, out: Push): void { let depthRemaining = 40; let current = 0; - const statements = sourceFile.statements; + // Includes the EOF Token so that comments which aren't attached to statements are included + const statements = [...sourceFile.statements, sourceFile.endOfFileToken]; const n = statements.length; while (current < n) { while (current < n && !isAnyImportSyntax(statements[current])) { @@ -33,7 +34,7 @@ namespace ts.OutliningElementsCollector { if (depthRemaining === 0) return; cancellationToken.throwIfCancellationRequested(); - if (isDeclaration(n)) { + if (isDeclaration(n) || n.kind === SyntaxKind.EndOfFileToken) { addOutliningForLeadingCommentsForNode(n, sourceFile, cancellationToken, out); } diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index d44148972fb..beb9d0c4d84 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -317,7 +317,7 @@ declare namespace FourSlashInterface { baselineQuickInfo(): void; baselineSmartSelection(): void; nameOrDottedNameSpanTextIs(text: string): void; - outliningSpansInCurrentFile(spans: Range[]): void; + outliningSpansInCurrentFile(spans: Range[], kind?: "comment" | "region" | "code" | "imports"): void; outliningHintSpansInCurrentFile(spans: Range[]): void; todoCommentsInCurrentFile(descriptors: string[]): void; matchingBracePositionInCurrentFile(bracePosition: number, expectedMatchPosition: number): void; diff --git a/tests/cases/fourslash/outlineSpansBlockCommentsWithoutStatements.ts b/tests/cases/fourslash/outlineSpansBlockCommentsWithoutStatements.ts new file mode 100644 index 00000000000..1d0fd91e783 --- /dev/null +++ b/tests/cases/fourslash/outlineSpansBlockCommentsWithoutStatements.ts @@ -0,0 +1,9 @@ +/// + +// #22732 + +////[|/* +///// * Some text +//// */|] + +verify.outliningHintSpansInCurrentFile(test.ranges()); diff --git a/tests/cases/fourslash/outlineSpansTrailingBlockCommentsAfterStatements.ts b/tests/cases/fourslash/outlineSpansTrailingBlockCommentsAfterStatements.ts new file mode 100644 index 00000000000..2397be94b56 --- /dev/null +++ b/tests/cases/fourslash/outlineSpansTrailingBlockCommentsAfterStatements.ts @@ -0,0 +1,10 @@ +/// + +// #22732 + +////console.log(0); +////[|/* +///// * Some text +//// */|] + +verify.outliningHintSpansInCurrentFile(test.ranges()); diff --git a/tests/cases/fourslash/server/getOutliningSpansForRegions.ts b/tests/cases/fourslash/server/getOutliningSpansForRegions.ts index 81d2409cf9d..dbfe68204dc 100644 --- a/tests/cases/fourslash/server/getOutliningSpansForRegions.ts +++ b/tests/cases/fourslash/server/getOutliningSpansForRegions.ts @@ -48,4 +48,4 @@ ////// #endregion ////*/ -verify.outliningSpansInCurrentFile(test.ranges(), "region"); +verify.outliningSpansInCurrentFile(test.ranges(), "region"); \ No newline at end of file From d92aca2715a62f5120edd5195ed77b2427f31edd Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 25 Feb 2020 14:23:55 -0800 Subject: [PATCH 11/17] Reduce lerna loglevel (#37024) * Reduce lerna loglevel * Also add silent --- tests/cases/docker/office-ui-fabric/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cases/docker/office-ui-fabric/Dockerfile b/tests/cases/docker/office-ui-fabric/Dockerfile index d48fba37b65..2fd71986108 100644 --- a/tests/cases/docker/office-ui-fabric/Dockerfile +++ b/tests/cases/docker/office-ui-fabric/Dockerfile @@ -19,4 +19,4 @@ RUN yarn add typescript@../../typescript.tgz --exact --ignore-scripts WORKDIR /office-ui-fabric-react RUN yarn ENTRYPOINT [ "lerna" ] -CMD [ "run", "build", "--stream", "--concurrency", "1", "--", "--production", "--lint" ] \ No newline at end of file +CMD [ "run", "build", "--stream", "--concurrency", "1", "--loglevel", "error", "--", "--production", "--lint", "--silent" ] \ No newline at end of file From e99173a6f9decb48b7973312b7788d0ffec4f38e Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 25 Feb 2020 15:52:24 -0800 Subject: [PATCH 12/17] Ignore data- props when excess property checking (#36952) --- src/compiler/checker.ts | 2 +- .../tsxUnionMemberChecksFilterDataProps.js | 21 ++++++++++++ ...sxUnionMemberChecksFilterDataProps.symbols | 30 ++++++++++++++++ .../tsxUnionMemberChecksFilterDataProps.types | 34 +++++++++++++++++++ .../tsxUnionMemberChecksFilterDataProps.tsx | 10 ++++++ 5 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/tsxUnionMemberChecksFilterDataProps.js create mode 100644 tests/baselines/reference/tsxUnionMemberChecksFilterDataProps.symbols create mode 100644 tests/baselines/reference/tsxUnionMemberChecksFilterDataProps.types create mode 100644 tests/cases/compiler/tsxUnionMemberChecksFilterDataProps.tsx diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c9eb2d49b9b..98e1a8255eb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15378,7 +15378,7 @@ namespace ts { checkTypes = reducedTarget.flags & TypeFlags.Union ? (reducedTarget).types : [reducedTarget]; } for (const prop of getPropertiesOfType(source)) { - if (shouldCheckAsExcessProperty(prop, source.symbol)) { + if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) { if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) { if (reportErrors) { // Report error in terms of object types in the target as those are the only ones diff --git a/tests/baselines/reference/tsxUnionMemberChecksFilterDataProps.js b/tests/baselines/reference/tsxUnionMemberChecksFilterDataProps.js new file mode 100644 index 00000000000..3bc4d40c316 --- /dev/null +++ b/tests/baselines/reference/tsxUnionMemberChecksFilterDataProps.js @@ -0,0 +1,21 @@ +//// [tsxUnionMemberChecksFilterDataProps.tsx] +/// +import React, { ReactElement } from "react"; + +declare function NotHappy(props: ({ fixed?: boolean } | { value?: number })): ReactElement; +declare function Happy(props: { fixed?: boolean, value?: number }): ReactElement; + +const RootNotHappy = () => (); +const RootHappy = () => (); + + +//// [tsxUnionMemberChecksFilterDataProps.js] +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +exports.__esModule = true; +/// +var react_1 = __importDefault(require("react")); +var RootNotHappy = function () { return (react_1["default"].createElement(NotHappy, { "data-testid": "my-test-id" })); }; +var RootHappy = function () { return (react_1["default"].createElement(Happy, { "data-testid": "my-test-id" })); }; diff --git a/tests/baselines/reference/tsxUnionMemberChecksFilterDataProps.symbols b/tests/baselines/reference/tsxUnionMemberChecksFilterDataProps.symbols new file mode 100644 index 00000000000..77f47363b4c --- /dev/null +++ b/tests/baselines/reference/tsxUnionMemberChecksFilterDataProps.symbols @@ -0,0 +1,30 @@ +=== tests/cases/compiler/tsxUnionMemberChecksFilterDataProps.tsx === +/// +import React, { ReactElement } from "react"; +>React : Symbol(React, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 1, 6)) +>ReactElement : Symbol(ReactElement, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 1, 15)) + +declare function NotHappy(props: ({ fixed?: boolean } | { value?: number })): ReactElement; +>NotHappy : Symbol(NotHappy, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 1, 44)) +>props : Symbol(props, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 3, 26)) +>fixed : Symbol(fixed, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 3, 35)) +>value : Symbol(value, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 3, 57)) +>ReactElement : Symbol(ReactElement, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 1, 15)) + +declare function Happy(props: { fixed?: boolean, value?: number }): ReactElement; +>Happy : Symbol(Happy, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 3, 96)) +>props : Symbol(props, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 4, 23)) +>fixed : Symbol(fixed, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 4, 31)) +>value : Symbol(value, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 4, 48)) +>ReactElement : Symbol(ReactElement, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 1, 15)) + +const RootNotHappy = () => (); +>RootNotHappy : Symbol(RootNotHappy, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 6, 5)) +>NotHappy : Symbol(NotHappy, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 1, 44)) +>data-testid : Symbol(data-testid, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 6, 37)) + +const RootHappy = () => (); +>RootHappy : Symbol(RootHappy, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 7, 5)) +>Happy : Symbol(Happy, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 3, 96)) +>data-testid : Symbol(data-testid, Decl(tsxUnionMemberChecksFilterDataProps.tsx, 7, 31)) + diff --git a/tests/baselines/reference/tsxUnionMemberChecksFilterDataProps.types b/tests/baselines/reference/tsxUnionMemberChecksFilterDataProps.types new file mode 100644 index 00000000000..d0be74dae84 --- /dev/null +++ b/tests/baselines/reference/tsxUnionMemberChecksFilterDataProps.types @@ -0,0 +1,34 @@ +=== tests/cases/compiler/tsxUnionMemberChecksFilterDataProps.tsx === +/// +import React, { ReactElement } from "react"; +>React : typeof React +>ReactElement : any + +declare function NotHappy(props: ({ fixed?: boolean } | { value?: number })): ReactElement; +>NotHappy : (props: { fixed?: boolean; } | { value?: number; }) => React.ReactElement +>props : { fixed?: boolean; } | { value?: number; } +>fixed : boolean +>value : number + +declare function Happy(props: { fixed?: boolean, value?: number }): ReactElement; +>Happy : (props: { fixed?: boolean; value?: number; }) => React.ReactElement +>props : { fixed?: boolean; value?: number; } +>fixed : boolean +>value : number + +const RootNotHappy = () => (); +>RootNotHappy : () => JSX.Element +>() => () : () => JSX.Element +>() : JSX.Element +> : JSX.Element +>NotHappy : (props: { fixed?: boolean; } | { value?: number; }) => React.ReactElement +>data-testid : string + +const RootHappy = () => (); +>RootHappy : () => JSX.Element +>() => () : () => JSX.Element +>() : JSX.Element +> : JSX.Element +>Happy : (props: { fixed?: boolean; value?: number; }) => React.ReactElement +>data-testid : string + diff --git a/tests/cases/compiler/tsxUnionMemberChecksFilterDataProps.tsx b/tests/cases/compiler/tsxUnionMemberChecksFilterDataProps.tsx new file mode 100644 index 00000000000..8c49e4ff8bb --- /dev/null +++ b/tests/cases/compiler/tsxUnionMemberChecksFilterDataProps.tsx @@ -0,0 +1,10 @@ +// @jsx: react +// @esModuleInterop: true +/// +import React, { ReactElement } from "react"; + +declare function NotHappy(props: ({ fixed?: boolean } | { value?: number })): ReactElement; +declare function Happy(props: { fixed?: boolean, value?: number }): ReactElement; + +const RootNotHappy = () => (); +const RootHappy = () => (); From e89df5ce6fa1a9ecb2d1d87a610b7df3b8390fb0 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 25 Feb 2020 16:11:21 -0800 Subject: [PATCH 13/17] Handle getScriptVersion correctly to ensure program structure is checked correctly (#36808) * Fix tests when there are project references but has disableSourceOfProjectReferenceRedirect * Handle getScriptVersion correctly to ensure program structure is checked correctly Fixes #36748 * Harness's language service host doesnt have getProjectVersion. This means earlier we were creating fresh program everytime we did LS operation Now we reuse same program, so quick info depends on order of quickinfo demands * Because same program is used, it unvails a bug that if `export=` is evaluated before finding references, it cant find all definitions from the merge * Update src/server/project.ts Co-Authored-By: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> * Make clearSourceMapperCache required Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> --- src/compiler/program.ts | 4 +- src/harness/client.ts | 4 ++ src/harness/harnessLanguageService.ts | 3 + src/server/editorServices.ts | 12 ++-- src/server/project.ts | 14 ++++- src/server/scriptInfo.ts | 2 + src/services/services.ts | 8 +-- src/services/types.ts | 2 + .../unittests/services/languageService.ts | 56 +++++++++++++++++++ .../unittests/tsserver/projectReferences.ts | 56 +++++++++++-------- .../fourslash/bestCommonTypeObjectLiterals.ts | 37 ++++++++++++ .../bestCommonTypeObjectLiterals1.ts | 3 + .../fourslash/findAllRefs_importType_js.ts | 9 ++- 13 files changed, 171 insertions(+), 39 deletions(-) create mode 100644 tests/cases/fourslash/bestCommonTypeObjectLiterals.ts diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 623c872945f..4675ae8493d 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -553,7 +553,7 @@ namespace ts { program: Program | undefined, rootFileNames: string[], newOptions: CompilerOptions, - getSourceVersion: (path: Path) => string | undefined, + getSourceVersion: (path: Path, fileName: string) => string | undefined, fileExists: (fileName: string) => boolean, hasInvalidatedResolution: HasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames: boolean, @@ -606,7 +606,7 @@ namespace ts { } function sourceFileVersionUptoDate(sourceFile: SourceFile) { - return sourceFile.version === getSourceVersion(sourceFile.resolvedPath); + return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName); } function projectReferenceUptoDate(oldRef: ProjectReference, newRef: ProjectReference, index: number) { diff --git a/src/harness/client.ts b/src/harness/client.ts index 3542d7c1d00..61a6be65260 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -808,6 +808,10 @@ namespace ts.server { return notImplemented(); } + clearSourceMapperCache(): never { + return notImplemented(); + } + dispose(): void { throw new Error("dispose is not available through the server layer."); } diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 759384aff38..23093406e2d 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -598,6 +598,9 @@ namespace Harness.LanguageService { getSourceMapper(): never { return ts.notImplemented(); } + clearSourceMapperCache(): never { + return ts.notImplemented(); + } dispose(): void { this.shim.dispose({}); } } diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index eeb266e1a80..3412c1c1598 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -873,9 +873,11 @@ namespace ts.server { this.delayEnsureProjectForOpenFiles(); } - private delayUpdateProjectGraphs(projects: readonly Project[]) { + private delayUpdateProjectGraphs(projects: readonly Project[], clearSourceMapperCache: boolean) { if (projects.length) { for (const project of projects) { + // Even if program doesnt change, clear the source mapper cache + if (clearSourceMapperCache) project.clearSourceMapperCache(); this.delayUpdateProjectGraph(project); } this.delayEnsureProjectForOpenFiles(); @@ -1033,7 +1035,7 @@ namespace ts.server { // file has been changed which might affect the set of referenced files in projects that include // this file and set of inferred projects info.delayReloadNonMixedContentFile(); - this.delayUpdateProjectGraphs(info.containingProjects); + this.delayUpdateProjectGraphs(info.containingProjects, /*clearSourceMapperCache*/ false); this.handleSourceMapProjects(info); } } @@ -1066,7 +1068,7 @@ namespace ts.server { private delayUpdateProjectsOfScriptInfoPath(path: Path) { const info = this.getScriptInfoForPath(path); if (info) { - this.delayUpdateProjectGraphs(info.containingProjects); + this.delayUpdateProjectGraphs(info.containingProjects, /*clearSourceMapperCache*/ true); } } @@ -1082,7 +1084,7 @@ namespace ts.server { info.detachAllProjects(); // update projects to make sure that set of referenced files is correct - this.delayUpdateProjectGraphs(containingProjects); + this.delayUpdateProjectGraphs(containingProjects, /*clearSourceMapperCache*/ false); this.handleSourceMapProjects(info); info.closeSourceMapFileWatcher(); // need to recalculate source map from declaration file @@ -2537,7 +2539,7 @@ namespace ts.server { const declarationInfo = this.getScriptInfoForPath(declarationInfoPath); if (declarationInfo && declarationInfo.sourceMapFilePath && !isString(declarationInfo.sourceMapFilePath)) { // Update declaration and source projects - this.delayUpdateProjectGraphs(declarationInfo.containingProjects); + this.delayUpdateProjectGraphs(declarationInfo.containingProjects, /*clearSourceMapperCache*/ true); this.delayUpdateSourceInfoProjects(declarationInfo.sourceMapFilePath.sourceInfos); declarationInfo.closeSourceMapFileWatcher(); } diff --git a/src/server/project.ts b/src/server/project.ts index 6b1d3759440..05f73e4f07c 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -384,7 +384,9 @@ namespace ts.server { } getScriptVersion(filename: string) { - const info = this.getOrCreateScriptInfoAndAttachToProject(filename); + // Don't attach to the project if version is asked + + const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(filename, this.currentDirectory, this.directoryStructureHost); return (info && info.getLatestVersion())!; // TODO: GH#18217 } @@ -558,6 +560,11 @@ namespace ts.server { return this.getLanguageService().getSourceMapper(); } + /** @internal */ + clearSourceMapperCache() { + this.languageService.clearSourceMapperCache(); + } + /*@internal*/ getDocumentPositionMapper(generatedFileName: string, sourceFileName?: string): DocumentPositionMapper | undefined { return this.projectService.getDocumentPositionMapper(this, generatedFileName, sourceFileName); @@ -1224,7 +1231,10 @@ namespace ts.server { watcher: this.projectService.watchFactory.watchFile( this.projectService.host, generatedFile, - () => this.projectService.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(this), + () => { + this.clearSourceMapperCache(); + this.projectService.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(this); + }, PollingInterval.High, this.projectService.getWatchOptions(this), WatchType.MissingGeneratedFile, diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index 79a46c90775..0a7a339e5f4 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -557,6 +557,8 @@ namespace ts.server { } getLatestVersion() { + // Ensure we have updated snapshot to give back latest version + this.textStorage.getSnapshot(); return this.textStorage.getVersion(); } diff --git a/src/services/services.ts b/src/services/services.ts index 9e9f67dd49c..f6e2698045d 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -980,11 +980,6 @@ namespace ts { return names; } - public getVersion(path: Path): string { - const file = this.getHostFileInformation(path); - return (file && file.version)!; // TODO: GH#18217 - } - public getScriptSnapshot(path: Path): IScriptSnapshot { const file = this.getHostFileInformation(path); return (file && file.scriptSnapshot)!; // TODO: GH#18217 @@ -1228,7 +1223,7 @@ namespace ts { const projectReferences = hostCache.getProjectReferences(); // If the program is already up-to-date, we can reuse it - if (isProgramUptoDate(program, rootFileNames, hostCache.compilationSettings(), path => hostCache!.getVersion(path), fileExists, hasInvalidatedResolution, !!host.hasChangedAutomaticTypeDirectiveNames, projectReferences)) { + if (isProgramUptoDate(program, rootFileNames, hostCache.compilationSettings(), (_path, fileName) => host.getScriptVersion(fileName), fileExists, hasInvalidatedResolution, !!host.hasChangedAutomaticTypeDirectiveNames, projectReferences)) { return; } @@ -2227,6 +2222,7 @@ namespace ts { getEditsForRefactor, toLineColumnOffset: sourceMapper.toLineColumnOffset, getSourceMapper: () => sourceMapper, + clearSourceMapperCache: () => sourceMapper.clearCache(), prepareCallHierarchy, provideCallHierarchyIncomingCalls, provideCallHierarchyOutgoingCalls diff --git a/src/services/types.ts b/src/services/types.ts index 44f73626a8f..1df82f8a7e9 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -382,6 +382,8 @@ namespace ts { toLineColumnOffset?(fileName: string, position: number): LineAndCharacter; /** @internal */ getSourceMapper(): SourceMapper; + /** @internal */ + clearSourceMapperCache(): void; getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: readonly number[], formatOptions: FormatCodeSettings, preferences: UserPreferences): readonly CodeFixAction[]; getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: {}, formatOptions: FormatCodeSettings, preferences: UserPreferences): CombinedCodeActions; diff --git a/src/testRunner/unittests/services/languageService.ts b/src/testRunner/unittests/services/languageService.ts index 48e35916de4..01b1a73e9d8 100644 --- a/src/testRunner/unittests/services/languageService.ts +++ b/src/testRunner/unittests/services/languageService.ts @@ -80,5 +80,61 @@ export function Component(x: Config): any;` } ); }); + + describe("detects program upto date correctly", () => { + function verifyProgramUptoDate(useProjectVersion: boolean) { + let projectVersion = "1"; + const files = createMap<{ version: string, text: string; }>(); + files.set("/project/root.ts", { version: "1", text: `import { foo } from "./other"` }); + files.set("/project/other.ts", { version: "1", text: `export function foo() { }` }); + files.set("/lib/lib.d.ts", { version: "1", text: projectSystem.libFile.content }); + const host: LanguageServiceHost = { + useCaseSensitiveFileNames: returnTrue, + getCompilationSettings: getDefaultCompilerOptions, + fileExists: path => files.has(path), + getProjectVersion: !useProjectVersion ? undefined : () => projectVersion, + getScriptFileNames: () => ["/project/root.ts"], + getScriptVersion: path => files.get(path)?.version || "", + getScriptSnapshot: path => { + const text = files.get(path)?.text; + return text ? ScriptSnapshot.fromString(text) : undefined; + }, + getCurrentDirectory: () => "/project", + getDefaultLibFileName: () => "/lib/lib.d.ts" + }; + const ls = ts.createLanguageService(host); + const program1 = ls.getProgram()!; + const program2 = ls.getProgram()!; + assert.strictEqual(program1, program2); + verifyProgramFiles(program1); + + // Change other + projectVersion = "2"; + files.set("/project/other.ts", { version: "2", text: `export function foo() { } export function bar() { }` }); + const program3 = ls.getProgram()!; + assert.notStrictEqual(program2, program3); + verifyProgramFiles(program3); + + // change root + projectVersion = "3"; + files.set("/project/root.ts", { version: "2", text: `import { foo, bar } from "./other"` }); + const program4 = ls.getProgram()!; + assert.notStrictEqual(program3, program4); + verifyProgramFiles(program4); + + function verifyProgramFiles(program: Program) { + assert.deepEqual( + program.getSourceFiles().map(f => f.fileName), + ["/lib/lib.d.ts", "/project/other.ts", "/project/root.ts"] + ); + } + } + it("when host implements getProjectVersion", () => { + verifyProgramUptoDate(/*useProjectVersion*/ true); + }); + it("when host does not implement getProjectVersion", () => { + verifyProgramUptoDate(/*useProjectVersion*/ false); + }); + }); }); } diff --git a/src/testRunner/unittests/tsserver/projectReferences.ts b/src/testRunner/unittests/tsserver/projectReferences.ts index fa5196bb4bd..8baa3a1f0cf 100644 --- a/src/testRunner/unittests/tsserver/projectReferences.ts +++ b/src/testRunner/unittests/tsserver/projectReferences.ts @@ -470,7 +470,7 @@ fn5(); interface VerifierAndWithRefs { withRefs: boolean; disableSourceOfProjectReferenceRedirect?: true; - verifier: (withRefs: boolean) => readonly DocumentPositionMapperVerifier[]; + verifier: (withRefs: boolean, disableSourceOfProjectReferenceRedirect?: true) => readonly DocumentPositionMapperVerifier[]; } function openFiles(verifiers: readonly DocumentPositionMapperVerifier[]) { @@ -502,7 +502,7 @@ fn5(); onHostCreate(host); } const session = createSession(host); - const verifiers = verifier(withRefs && !disableSourceOfProjectReferenceRedirect); + const verifiers = verifier(withRefs && !disableSourceOfProjectReferenceRedirect, disableSourceOfProjectReferenceRedirect); openFilesForSession([...openFiles(verifiers), randomFile], session); return { host, session, verifiers }; } @@ -724,13 +724,14 @@ fn5(); scenarioName, verifier, withRefs, + disableSourceOfProjectReferenceRedirect, change, afterChangeActionKey }: VerifyScenarioWithChanges, timeoutBeforeAction: boolean, ) { it(scenarioName, () => { - const { host, session, verifiers } = openTsFile({ verifier, withRefs }); + const { host, session, verifiers } = openTsFile({ verifier, withRefs, disableSourceOfProjectReferenceRedirect }); // Create DocumentPositionMapper firstAction(session, verifiers); @@ -790,6 +791,7 @@ fn5(); scenarioName, verifier, withRefs, + disableSourceOfProjectReferenceRedirect, fileLocation, fileNotPresentKey, fileCreatedKey, @@ -801,6 +803,7 @@ fn5(); const { host, session, verifiers } = openTsFile({ verifier, withRefs, + disableSourceOfProjectReferenceRedirect, onHostCreate: host => host.deleteFile(fileLocation) }); checkProject(session, verifiers, noDts); @@ -813,6 +816,7 @@ fn5(); const { host, session, verifiers } = openTsFile({ verifier, withRefs, + disableSourceOfProjectReferenceRedirect, onHostCreate: host => { fileContents = host.readFile(fileLocation); host.deleteFile(fileLocation); @@ -825,7 +829,7 @@ fn5(); }); it("when file is deleted after actions on the projects", () => { - const { host, session, verifiers } = openTsFile({ verifier, withRefs }); + const { host, session, verifiers } = openTsFile({ verifier, disableSourceOfProjectReferenceRedirect, withRefs }); firstAction(session, verifiers); // The dependency file is deleted when orphan files are collected @@ -967,31 +971,35 @@ ${dependencyTs.content}`); interface VerifyScenario { mainScenario: string; - verifier: (withRefs: boolean) => readonly DocumentPositionMapperVerifier[]; + verifier: (withRefs: boolean, disableSourceOfProjectReferenceRedirect?: true) => readonly DocumentPositionMapperVerifier[]; } function verifyScenario(scenario: VerifyScenario) { - describe("when main tsconfig doesnt have project reference", () => { - verifyScenarioWorker(scenario, /*withRefs*/ false); - }); - describe("when main tsconfig has project reference", () => { - verifyScenarioWorker(scenario, /*withRefs*/ true); - }); - describe("when main tsconfig has but has disableSourceOfProjectReferenceRedirect", () => { - verifyScenarioWorker(scenario, /*withRefs*/ true); + describe(scenario.mainScenario, () => { + describe("when main tsconfig doesnt have project reference", () => { + verifyScenarioWorker(scenario, /*withRefs*/ false); + }); + describe("when main tsconfig has project reference", () => { + verifyScenarioWorker(scenario, /*withRefs*/ true); + }); + describe("when main tsconfig has disableSourceOfProjectReferenceRedirect along with project reference", () => { + verifyScenarioWorker(scenario, /*withRefs*/ true, /*disableSourceOfProjectReferenceRedirect*/ true); + }); }); } describe("from project that uses dependency", () => { verifyScenario({ mainScenario: "can go to definition correctly", - verifier: withRefs => [ + verifier: (withRefs, disableSourceOfProjectReferenceRedirect) => [ { ...goToDefFromMainTsProjectInfoVerifier(withRefs), main: () => ({ action: goToDefFromMainTs, closedInfos: withRefs ? [dependencyTs.path, dependencyConfig.path, libFile.path] : - [dependencyTs.path, libFile.path, dtsPath, dtsMapLocation], + disableSourceOfProjectReferenceRedirect ? + [dependencyTs.path, libFile.path, dtsPath, dtsMapLocation, dependencyConfig.path] : + [dependencyTs.path, libFile.path, dtsPath, dtsMapLocation], otherWatchedFiles: [mainConfig.path], expectsDts: !withRefs, // Dts script info present only if no project reference expectsMap: !withRefs // Map script info present only if no project reference @@ -1097,7 +1105,7 @@ ${dependencyTs.content}`); describe("when opening depedency and usage project", () => { verifyScenario({ mainScenario: "goto Definition in usage and rename locations from defining project", - verifier: withRefs => [ + verifier: (withRefs, disableSourceOfProjectReferenceRedirect) => [ { ...goToDefFromMainTsProjectInfoVerifier(withRefs), main: () => ({ @@ -1105,9 +1113,11 @@ ${dependencyTs.content}`); // DependencyTs is open, so omit it from closed infos closedInfos: withRefs ? [dependencyConfig.path, libFile.path] : - [libFile.path, dtsPath, dtsMapLocation], - otherWatchedFiles: withRefs ? - [mainConfig.path] : // Its in closed info + disableSourceOfProjectReferenceRedirect ? + [libFile.path, dtsPath, dtsMapLocation, dependencyConfig.path] : + [libFile.path, dtsPath, dtsMapLocation], + otherWatchedFiles: withRefs || disableSourceOfProjectReferenceRedirect ? + [mainConfig.path] : // dependencyConfig is in closed info [mainConfig.path, dependencyConfig.path], expectsDts: !withRefs, // Dts script info present only if no project reference expectsMap: !withRefs // Map script info present only if no project reference @@ -1179,9 +1189,11 @@ ${dependencyTs.content}`); // DependencyTs is open, so omit it from closed infos closedInfos: withRefs ? [dependencyConfig.path, libFile.path, dtsLocation, dtsMapLocation] : - [libFile.path, dtsPath, dtsMapLocation], - otherWatchedFiles: withRefs ? - [mainConfig.path] : // Its in closed info + disableSourceOfProjectReferenceRedirect ? + [libFile.path, dtsPath, dtsMapLocation, dependencyConfig.path] : + [libFile.path, dtsPath, dtsMapLocation], + otherWatchedFiles: withRefs || disableSourceOfProjectReferenceRedirect ? + [mainConfig.path] : // dependencyConfig is in closed info [mainConfig.path, dependencyConfig.path], expectsDts: true, expectsMap: true, diff --git a/tests/cases/fourslash/bestCommonTypeObjectLiterals.ts b/tests/cases/fourslash/bestCommonTypeObjectLiterals.ts new file mode 100644 index 00000000000..1eac7edd26a --- /dev/null +++ b/tests/cases/fourslash/bestCommonTypeObjectLiterals.ts @@ -0,0 +1,37 @@ +/// + +////var a = { name: 'bob', age: 18 }; +////var b = { name: 'jim', age: 20 }; +////var /*1*/c = [a, b]; + +////var a1 = { name: 'bob', age: 18 }; +////var b1 = { name: 'jim', age: 20, dob: new Date() }; +////var /*2*/c1 = [a1, b1]; + +////var a2 = { name: 'bob', age: 18, address: 'springfield' }; +////var b2 = { name: 'jim', age: 20, dob: new Date() }; +////var /*3*/c2 = [a2, b2]; + +////interface I { +//// name: string; +//// age: number; +////} + +////var i: I; +////var /*4*/c3 = [i, a]; + +verify.quickInfos({ + 1: "var c: {\n name: string;\n age: number;\n}[]", + 2: "var c1: {\n name: string;\n age: number;\n}[]", + 3: + `var c2: ({ + name: string; + age: number; + address: string; +} | { + name: string; + age: number; + dob: Date; +})[]`, + 4: "var c3: {\n name: string;\n age: number;\n}[]" +}); diff --git a/tests/cases/fourslash/bestCommonTypeObjectLiterals1.ts b/tests/cases/fourslash/bestCommonTypeObjectLiterals1.ts index be076b9fe02..cdad2f3729e 100644 --- a/tests/cases/fourslash/bestCommonTypeObjectLiterals1.ts +++ b/tests/cases/fourslash/bestCommonTypeObjectLiterals1.ts @@ -20,6 +20,9 @@ ////var i: I; ////var /*4*/c3 = [i, a]; +verify.quickInfos({ + 4: "var c3: I[]" +}); verify.quickInfos({ 1: "var c: {\n name: string;\n age: number;\n}[]", 2: "var c1: {\n name: string;\n age: number;\n}[]", diff --git a/tests/cases/fourslash/findAllRefs_importType_js.ts b/tests/cases/fourslash/findAllRefs_importType_js.ts index 0f952ae28e3..ee57b862066 100644 --- a/tests/cases/fourslash/findAllRefs_importType_js.ts +++ b/tests/cases/fourslash/findAllRefs_importType_js.ts @@ -18,6 +18,11 @@ verify.noErrors(); // TODO: GH#24025 const [rModuleDef, rModule, r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3, r4Def, r4, r5] = test.ranges(); +verify.referenceGroups([r3, r4], [ + { definition: 'module "/a"', ranges: [r4, rModule] }, + { definition: "(local class) C", ranges: [r0] }, + { definition: "(alias) (local class) export=\nimport export=", ranges: [r3] }, +]); verify.referenceGroups(rModule, [{ definition: 'module "/a"', ranges: [r3, r4, rModule] }]); verify.referenceGroups(r0, [ { definition: "(local class) C", ranges: [r0] }, @@ -33,6 +38,6 @@ verify.referenceGroups(r2, [ ]); verify.referenceGroups([r3, r4], [ { definition: 'module "/a"', ranges: [r4, rModule] }, - { definition: "(local class) C", ranges: [r0] }, - { definition: "(alias) (local class) export=\nimport export=", ranges: [r3] }, + //{ definition: "(local class) C", ranges: [r0] }, + //{ definition: "(alias) (local class) export=\nimport export=", ranges: [r3] }, ]); From 9ed73ebbbfcc90a9e7969a1da9fa54dd3d3c5c9b Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 25 Feb 2020 16:14:00 -0800 Subject: [PATCH 14/17] Properly handle control flows from returns in try/catch within IIFE (#36901) * Properly handle control flows from returns in try/catch within IIFE * Accept new baselines * Add tests * Accept new baselines * When end of finally is unreachable, end of try statement is too * Add additional test case --- src/compiler/binder.ts | 85 ++--- src/compiler/checker.ts | 51 +-- src/compiler/types.ts | 13 +- src/debug/dbg.ts | 31 +- .../reference/api/tsserverlibrary.d.ts | 12 +- tests/baselines/reference/api/typescript.d.ts | 12 +- .../tryCatchFinallyControlFlow.errors.txt | 148 +++++++- .../reference/tryCatchFinallyControlFlow.js | 259 ++++++++++++++ .../tryCatchFinallyControlFlow.symbols | 237 ++++++++++++- .../tryCatchFinallyControlFlow.types | 327 ++++++++++++++++++ .../compiler/tryCatchFinallyControlFlow.ts | 133 +++++++ 11 files changed, 1202 insertions(+), 106 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 650485a9f0a..54e7c3cdbd4 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -952,6 +952,10 @@ namespace ts { return initFlowNode({ flags: FlowFlags.LoopLabel, antecedents: undefined }); } + function createReduceLabel(target: FlowLabel, antecedents: FlowNode[], antecedent: FlowNode): FlowReduceLabel { + return initFlowNode({ flags: FlowFlags.ReduceLabel, target, antecedents, antecedent }); + } + function setFlowNodeReferenced(flow: FlowNode) { // On first reference we set the Referenced flag, thereafter we set the Shared flag flow.flags |= flow.flags & FlowFlags.Referenced ? FlowFlags.Shared : FlowFlags.Referenced; @@ -1209,35 +1213,36 @@ namespace ts { } function bindTryStatement(node: TryStatement): void { - const preFinallyLabel = createBranchLabel(); // We conservatively assume that *any* code in the try block can cause an exception, but we only need // to track code that causes mutations (because only mutations widen the possible control flow type of - // a variable). The currentExceptionTarget is the target label for control flows that result from - // exceptions. We add all mutation flow nodes as antecedents of this label such that we can analyze them - // as possible antecedents of the start of catch or finally blocks. Furthermore, we add the current - // control flow to represent exceptions that occur before any mutations. + // a variable). The exceptionLabel is the target label for control flows that result from exceptions. + // We add all mutation flow nodes as antecedents of this label such that we can analyze them as possible + // antecedents of the start of catch or finally blocks. Furthermore, we add the current control flow to + // represent exceptions that occur before any mutations. const saveReturnTarget = currentReturnTarget; const saveExceptionTarget = currentExceptionTarget; - currentReturnTarget = createBranchLabel(); - currentExceptionTarget = node.catchClause ? createBranchLabel() : currentReturnTarget; - addAntecedent(currentExceptionTarget, currentFlow); + const normalExitLabel = createBranchLabel(); + const returnLabel = createBranchLabel(); + let exceptionLabel = createBranchLabel(); + if (node.finallyBlock) { + currentReturnTarget = returnLabel; + } + addAntecedent(exceptionLabel, currentFlow); + currentExceptionTarget = exceptionLabel; bind(node.tryBlock); - addAntecedent(preFinallyLabel, currentFlow); - const flowAfterTry = currentFlow; - let flowAfterCatch = unreachableFlow; + addAntecedent(normalExitLabel, currentFlow); if (node.catchClause) { // Start of catch clause is the target of exceptions from try block. - currentFlow = finishFlowLabel(currentExceptionTarget); + currentFlow = finishFlowLabel(exceptionLabel); // The currentExceptionTarget now represents control flows from exceptions in the catch clause. // Effectively, in a try-catch-finally, if an exception occurs in the try block, the catch block // acts like a second try block. - currentExceptionTarget = currentReturnTarget; - addAntecedent(currentExceptionTarget, currentFlow); + exceptionLabel = createBranchLabel(); + addAntecedent(exceptionLabel, currentFlow); + currentExceptionTarget = exceptionLabel; bind(node.catchClause); - addAntecedent(preFinallyLabel, currentFlow); - flowAfterCatch = currentFlow; + addAntecedent(normalExitLabel, currentFlow); } - const exceptionTarget = finishFlowLabel(currentExceptionTarget); currentReturnTarget = saveReturnTarget; currentExceptionTarget = saveExceptionTarget; if (node.finallyBlock) { @@ -1250,35 +1255,33 @@ namespace ts { // When analyzing a control flow graph that starts inside a finally block we want to consider all // five possibilities above. However, when analyzing a control flow graph that starts outside (past) // the finally block, we only want to consider the first two (if we're past a finally block then it - // must have completed normally). To make this possible, we inject two extra nodes into the control - // flow graph: An after-finally with an antecedent of the control flow at the end of the finally - // block, and a pre-finally with an antecedent that represents all exceptional control flows. The - // 'lock' property of the pre-finally references the after-finally, and the after-finally has a - // boolean 'locked' property that we set to true when analyzing a control flow that contained the - // the after-finally node. When the lock associated with a pre-finally is locked, the antecedent of - // the pre-finally (i.e. the exceptional control flows) are skipped. - const preFinallyFlow: PreFinallyFlow = initFlowNode({ flags: FlowFlags.PreFinally, antecedent: exceptionTarget, lock: {} }); - addAntecedent(preFinallyLabel, preFinallyFlow); - currentFlow = finishFlowLabel(preFinallyLabel); + // must have completed normally). Likewise, when analyzing a control flow graph from return statements + // in try or catch blocks in an IIFE, we only want to consider the third. To make this possible, we + // inject a ReduceLabel node into the control flow graph. This node contains an alternate reduced + // set of antecedents for the pre-finally label. As control flow analysis passes by a ReduceLabel + // node, the pre-finally label is temporarily switched to the reduced antecedent set. + const finallyLabel = createBranchLabel(); + finallyLabel.antecedents = concatenate(concatenate(normalExitLabel.antecedents, exceptionLabel.antecedents), returnLabel.antecedents); + currentFlow = finallyLabel; bind(node.finallyBlock); - // If the end of the finally block is reachable, but the end of the try and catch blocks are not, - // convert the current flow to unreachable. For example, 'try { return 1; } finally { ... }' should - // result in an unreachable current control flow. - if (!(currentFlow.flags & FlowFlags.Unreachable)) { - if ((flowAfterTry.flags & FlowFlags.Unreachable) && (flowAfterCatch.flags & FlowFlags.Unreachable)) { - currentFlow = flowAfterTry === reportedUnreachableFlow || flowAfterCatch === reportedUnreachableFlow - ? reportedUnreachableFlow - : unreachableFlow; - } + if (currentFlow.flags & FlowFlags.Unreachable) { + // If the end of the finally block is unreachable, the end of the entire try statement is unreachable. + currentFlow = unreachableFlow; } - if (!(currentFlow.flags & FlowFlags.Unreachable)) { - const afterFinallyFlow: AfterFinallyFlow = initFlowNode({ flags: FlowFlags.AfterFinally, antecedent: currentFlow }); - preFinallyFlow.lock = afterFinallyFlow; - currentFlow = afterFinallyFlow; + else { + // If we have an IIFE return target and return statements in the try or catch blocks, add a control + // flow that goes back through the finally block and back through only the return statements. + if (currentReturnTarget && returnLabel.antecedents) { + addAntecedent(currentReturnTarget, createReduceLabel(finallyLabel, returnLabel.antecedents, currentFlow)); + } + // If the end of the finally block is reachable, but the end of the try and catch blocks are not, + // convert the current flow to unreachable. For example, 'try { return 1; } finally { ... }' should + // result in an unreachable current control flow. + currentFlow = normalExitLabel.antecedents ? createReduceLabel(finallyLabel, normalExitLabel.antecedents, currentFlow) : unreachableFlow; } } else { - currentFlow = finishFlowLabel(preFinallyLabel); + currentFlow = finishFlowLabel(normalExitLabel); } } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 98e1a8255eb..3192ad7ea05 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -19437,16 +19437,12 @@ namespace ts { } function isReachableFlowNode(flow: FlowNode) { - const result = isReachableFlowNodeWorker(flow, /*skipCacheCheck*/ false); + const result = isReachableFlowNodeWorker(flow, /*noCacheCheck*/ false); lastFlowNode = flow; lastFlowNodeReachable = result; return result; } - function isUnlockedReachableFlowNode(flow: FlowNode) { - return !(flow.flags & FlowFlags.PreFinally && (flow).lock.locked) && isReachableFlowNodeWorker(flow, /*skipCacheCheck*/ false); - } - function isFalseExpression(expr: Expression): boolean { const node = skipParentheses(expr); return node.kind === SyntaxKind.FalseKeyword || node.kind === SyntaxKind.BinaryExpression && ( @@ -19464,11 +19460,11 @@ namespace ts { if (!noCacheCheck) { const id = getFlowNodeId(flow); const reachable = flowNodeReachable[id]; - return reachable !== undefined ? reachable : (flowNodeReachable[id] = isReachableFlowNodeWorker(flow, /*skipCacheCheck*/ true)); + return reachable !== undefined ? reachable : (flowNodeReachable[id] = isReachableFlowNodeWorker(flow, /*noCacheCheck*/ true)); } noCacheCheck = false; } - if (flags & (FlowFlags.Assignment | FlowFlags.Condition | FlowFlags.ArrayMutation | FlowFlags.PreFinally)) { + if (flags & (FlowFlags.Assignment | FlowFlags.Condition | FlowFlags.ArrayMutation)) { flow = (flow).antecedent; } else if (flags & FlowFlags.Call) { @@ -19489,7 +19485,7 @@ namespace ts { } else if (flags & FlowFlags.BranchLabel) { // A branching point is reachable if any branch is reachable. - return some((flow).antecedents, isUnlockedReachableFlowNode); + return some((flow).antecedents, f => isReachableFlowNodeWorker(f, /*noCacheCheck*/ false)); } else if (flags & FlowFlags.LoopLabel) { // A loop is reachable if the control flow path that leads to the top is reachable. @@ -19503,12 +19499,14 @@ namespace ts { } flow = (flow).antecedent; } - else if (flags & FlowFlags.AfterFinally) { - // Cache is unreliable once we start locking nodes + else if (flags & FlowFlags.ReduceLabel) { + // Cache is unreliable once we start adjusting labels lastFlowNode = undefined; - (flow).locked = true; - const result = isReachableFlowNodeWorker((flow).antecedent, /*skipCacheCheck*/ false); - (flow).locked = false; + const target = (flow).target; + const saveAntecedents = target.antecedents; + target.antecedents = (flow).antecedents; + const result = isReachableFlowNodeWorker((flow).antecedent, /*noCacheCheck*/ false); + target.antecedents = saveAntecedents; return result; } else { @@ -19572,19 +19570,7 @@ namespace ts { } } let type: FlowType | undefined; - if (flags & FlowFlags.AfterFinally) { - // block flow edge: finally -> pre-try (for larger explanation check comment in binder.ts - bindTryStatement - (flow).locked = true; - type = getTypeAtFlowNode((flow).antecedent); - (flow).locked = false; - } - else if (flags & FlowFlags.PreFinally) { - // locked pre-finally flows are filtered out in getTypeAtFlowBranchLabel - // so here just redirect to antecedent - flow = (flow).antecedent; - continue; - } - else if (flags & FlowFlags.Assignment) { + if (flags & FlowFlags.Assignment) { type = getTypeAtFlowAssignment(flow); if (!type) { flow = (flow).antecedent; @@ -19620,6 +19606,13 @@ namespace ts { continue; } } + else if (flags & FlowFlags.ReduceLabel) { + const target = (flow).target; + const saveAntecedents = target.antecedents; + target.antecedents = (flow).antecedents; + type = getTypeAtFlowNode((flow).antecedent); + target.antecedents = saveAntecedents; + } else if (flags & FlowFlags.Start) { // Check if we should continue with the control flow of the containing function. const container = (flow).node; @@ -19831,12 +19824,6 @@ namespace ts { let seenIncomplete = false; let bypassFlow: FlowSwitchClause | undefined; for (const antecedent of flow.antecedents!) { - if (antecedent.flags & FlowFlags.PreFinally && (antecedent).lock.locked) { - // if flow correspond to branch from pre-try to finally and this branch is locked - this means that - // we initially have started following the flow outside the finally block. - // in this case we should ignore this branch. - continue; - } if (!bypassFlow && antecedent.flags & FlowFlags.SwitchClause && (antecedent).clauseStart === (antecedent).clauseEnd) { // The antecedent is the bypass branch of a potentially exhaustive switch statement. bypassFlow = antecedent; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5158684e0ad..d5ee8d7581e 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2770,10 +2770,9 @@ namespace ts { SwitchClause = 1 << 7, // Switch statement clause ArrayMutation = 1 << 8, // Potential array mutation Call = 1 << 9, // Potential assertion call - Referenced = 1 << 10, // Referenced as antecedent once - Shared = 1 << 11, // Referenced as antecedent more than once - PreFinally = 1 << 12, // Injected edge that links pre-finally label and pre-try flow - AfterFinally = 1 << 13, // Injected edge that links post-finally flow with the rest of the graph + ReduceLabel = 1 << 10, // Temporarily reduce antecedents of label + Referenced = 1 << 11, // Referenced as antecedent once + Shared = 1 << 12, // Referenced as antecedent more than once Label = BranchLabel | LoopLabel, Condition = TrueCondition | FalseCondition, @@ -2853,6 +2852,12 @@ namespace ts { antecedent: FlowNode; } + export interface FlowReduceLabel extends FlowNodeBase { + target: FlowLabel; + antecedents: FlowNode[]; + antecedent: FlowNode; + } + export type FlowType = Type | IncompleteType; // Incomplete types occur during control flow analysis of loops. An IncompleteType diff --git a/src/debug/dbg.ts b/src/debug/dbg.ts index 4314be10a49..fc8a5cdafc8 100644 --- a/src/debug/dbg.ts +++ b/src/debug/dbg.ts @@ -46,10 +46,9 @@ namespace Debug { readonly SwitchClause: number, readonly ArrayMutation: number, readonly Call: number, + readonly ReduceLabel: number, readonly Referenced: number, readonly Shared: number, - readonly PreFinally: number, - readonly AfterFinally: number, readonly Label: number, readonly Condition: number, }; @@ -69,6 +68,7 @@ namespace Debug { | FlowCondition | FlowSwitchClause | FlowArrayMutation + | FlowReduceLabel ; interface FlowNodeBase { @@ -119,6 +119,12 @@ namespace Debug { antecedent: FlowNode; } + export interface FlowReduceLabel extends FlowNodeBase { + target: FlowLabel; + antecedents: FlowNode[]; + antecedent: FlowNode; + } + type FlowFlags = number; let FlowFlags: TypeScriptModule["FlowFlags"]; let getSourceFileOfNode: TypeScriptModule["getSourceFileOfNode"]; @@ -199,8 +205,7 @@ namespace Debug { FlowFlags.SwitchClause | FlowFlags.ArrayMutation | FlowFlags.Call | - FlowFlags.PreFinally | - FlowFlags.AfterFinally; + FlowFlags.ReduceLabel; const hasNodeFlags = FlowFlags.Start | @@ -264,17 +269,14 @@ namespace Debug { if (!graphNode) { links[id] = graphNode = { id, flowNode, edges: [], text: renderFlowNode(flowNode), lane: -1, endLane: -1, level: -1 }; nodes.push(graphNode); - if (!(flowNode.flags & FlowFlags.PreFinally)) { - if (hasAntecedents(flowNode)) { - - for (const antecedent of flowNode.antecedents) { - buildGraphEdge(graphNode, antecedent); - } - } - else if (hasAntecedent(flowNode)) { - buildGraphEdge(graphNode, flowNode.antecedent); + if (hasAntecedents(flowNode)) { + for (const antecedent of flowNode.antecedents) { + buildGraphEdge(graphNode, antecedent); } } + else if (hasAntecedent(flowNode)) { + buildGraphEdge(graphNode, flowNode.antecedent); + } } return graphNode; } @@ -341,8 +343,7 @@ namespace Debug { if (flags & FlowFlags.SwitchClause) return "SwitchClause"; if (flags & FlowFlags.ArrayMutation) return "ArrayMutation"; if (flags & FlowFlags.Call) return "Call"; - if (flags & FlowFlags.PreFinally) return "PreFinally"; - if (flags & FlowFlags.AfterFinally) return "AfterFinally"; + if (flags & FlowFlags.ReduceLabel) return "ReduceLabel"; if (flags & FlowFlags.Unreachable) return "Unreachable"; throw new Error(); } diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 68951b4717f..45f4d38414e 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -1726,10 +1726,9 @@ declare namespace ts { SwitchClause = 128, ArrayMutation = 256, Call = 512, - Referenced = 1024, - Shared = 2048, - PreFinally = 4096, - AfterFinally = 8192, + ReduceLabel = 1024, + Referenced = 2048, + Shared = 4096, Label = 12, Condition = 96 } @@ -1776,6 +1775,11 @@ declare namespace ts { node: CallExpression | BinaryExpression; antecedent: FlowNode; } + export interface FlowReduceLabel extends FlowNodeBase { + target: FlowLabel; + antecedents: FlowNode[]; + antecedent: FlowNode; + } export type FlowType = Type | IncompleteType; export interface IncompleteType { flags: TypeFlags; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 9bf35111888..83e2a6ac5d4 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1726,10 +1726,9 @@ declare namespace ts { SwitchClause = 128, ArrayMutation = 256, Call = 512, - Referenced = 1024, - Shared = 2048, - PreFinally = 4096, - AfterFinally = 8192, + ReduceLabel = 1024, + Referenced = 2048, + Shared = 4096, Label = 12, Condition = 96 } @@ -1776,6 +1775,11 @@ declare namespace ts { node: CallExpression | BinaryExpression; antecedent: FlowNode; } + export interface FlowReduceLabel extends FlowNodeBase { + target: FlowLabel; + antecedents: FlowNode[]; + antecedent: FlowNode; + } export type FlowType = Type | IncompleteType; export interface IncompleteType { flags: TypeFlags; diff --git a/tests/baselines/reference/tryCatchFinallyControlFlow.errors.txt b/tests/baselines/reference/tryCatchFinallyControlFlow.errors.txt index 11ec1515aca..b9be0305827 100644 --- a/tests/baselines/reference/tryCatchFinallyControlFlow.errors.txt +++ b/tests/baselines/reference/tryCatchFinallyControlFlow.errors.txt @@ -1,7 +1,11 @@ tests/cases/compiler/tryCatchFinallyControlFlow.ts(105,5): error TS7027: Unreachable code detected. +tests/cases/compiler/tryCatchFinallyControlFlow.ts(118,9): error TS7027: Unreachable code detected. +tests/cases/compiler/tryCatchFinallyControlFlow.ts(218,13): error TS7027: Unreachable code detected. +tests/cases/compiler/tryCatchFinallyControlFlow.ts(220,9): error TS7027: Unreachable code detected. +tests/cases/compiler/tryCatchFinallyControlFlow.ts(255,9): error TS7027: Unreachable code detected. -==== tests/cases/compiler/tryCatchFinallyControlFlow.ts (1 errors) ==== +==== tests/cases/compiler/tryCatchFinallyControlFlow.ts (5 errors) ==== // Repro from #34797 function f1() { @@ -111,6 +115,131 @@ tests/cases/compiler/tryCatchFinallyControlFlow.ts(105,5): error TS7027: Unreach !!! error TS7027: Unreachable code detected. } + function f8() { + let x: 0 | 1 = 0; + (() => { + try { + x = 1; + return; + } + finally { + x; // 0 | 1 + } + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + })(); + x; // 1 + } + + function f9() { + let x: 0 | 1 | 2 = 0; + (() => { + try { + if (!!true) { + x = 1; + return; + } + } + finally { + x; // 0 | 1 + } + x; // 0 + x = 2; + })(); + x; // 1 | 2 + } + + function f10() { + let x: 0 | 1 | 2 | 3 = 0; + (() => { + try { + x = 1; + return; + } + catch (e) { + x = 2; + } + finally { + x; // 0 | 1 | 2 + } + x; // 2 + x = 3; + })(); + x; // 1 | 3 + } + + function f11() { + let x: 0 | 1 | 2 | 3 | 4 | 5 = 0; + (() => { + try { + if (!!true) { + x = 1; + return; + } + if (!!true) { + x = 2; + throw 0; + } + } + catch (e) { + x; // 0 | 1 | 2 + x = 3; + } + finally { + x; // 0 | 1 | 2 | 3 + if (!!true) { + x = 4; + } + } + x; // 0 | 3 | 4 + x = 5; + })(); + x; // 1 | 4 | 5 + } + + function f12() { + let x: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 = 0; + (() => { + try { + if (!!true) { + x = 1; + return; + } + if (!!true) { + x = 2; + throw 0; + } + } + catch (e) { + x; // 0 | 1 | 2 + x = 3; + } + finally { + x; // 0 | 1 | 2 | 3 + if (!!true) { + x = 4; + return; + } + if (!!true) { + x = 5; + return; + } + x = 6; + return; + x; // unreachable + ~~ +!!! error TS7027: Unreachable code detected. + } + x; // unreachable + ~~~~~~~~~~~~~~~~~ + x = 7; // no effect + ~~~~~~~~~~~~~~ +!!! error TS7027: Unreachable code detected. + })(); + x; // 4 | 5 | 6 + } + // Repro from #35644 const main = () => { @@ -129,4 +258,21 @@ tests/cases/compiler/tryCatchFinallyControlFlow.ts(105,5): error TS7027: Unreach return; } } + + // Repro from #36828 + + function t1() { + const x = (() => { + try { + return 'x'; + } + catch (e) { + return null; + } + x; // Unreachable + ~~ +!!! error TS7027: Unreachable code detected. + })(); + x; // Reachable + } \ No newline at end of file diff --git a/tests/baselines/reference/tryCatchFinallyControlFlow.js b/tests/baselines/reference/tryCatchFinallyControlFlow.js index 79d9a3d5972..2ccecd0cf20 100644 --- a/tests/baselines/reference/tryCatchFinallyControlFlow.js +++ b/tests/baselines/reference/tryCatchFinallyControlFlow.js @@ -106,6 +106,124 @@ function f7() { x; // Unreachable } +function f8() { + let x: 0 | 1 = 0; + (() => { + try { + x = 1; + return; + } + finally { + x; // 0 | 1 + } + x; // Unreachable + })(); + x; // 1 +} + +function f9() { + let x: 0 | 1 | 2 = 0; + (() => { + try { + if (!!true) { + x = 1; + return; + } + } + finally { + x; // 0 | 1 + } + x; // 0 + x = 2; + })(); + x; // 1 | 2 +} + +function f10() { + let x: 0 | 1 | 2 | 3 = 0; + (() => { + try { + x = 1; + return; + } + catch (e) { + x = 2; + } + finally { + x; // 0 | 1 | 2 + } + x; // 2 + x = 3; + })(); + x; // 1 | 3 +} + +function f11() { + let x: 0 | 1 | 2 | 3 | 4 | 5 = 0; + (() => { + try { + if (!!true) { + x = 1; + return; + } + if (!!true) { + x = 2; + throw 0; + } + } + catch (e) { + x; // 0 | 1 | 2 + x = 3; + } + finally { + x; // 0 | 1 | 2 | 3 + if (!!true) { + x = 4; + } + } + x; // 0 | 3 | 4 + x = 5; + })(); + x; // 1 | 4 | 5 +} + +function f12() { + let x: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 = 0; + (() => { + try { + if (!!true) { + x = 1; + return; + } + if (!!true) { + x = 2; + throw 0; + } + } + catch (e) { + x; // 0 | 1 | 2 + x = 3; + } + finally { + x; // 0 | 1 | 2 | 3 + if (!!true) { + x = 4; + return; + } + if (!!true) { + x = 5; + return; + } + x = 6; + return; + x; // unreachable + } + x; // unreachable + x = 7; // no effect + })(); + x; // 4 | 5 | 6 +} + // Repro from #35644 const main = () => { @@ -124,6 +242,21 @@ const main = () => { return; } } + +// Repro from #36828 + +function t1() { + const x = (() => { + try { + return 'x'; + } + catch (e) { + return null; + } + x; // Unreachable + })(); + x; // Reachable +} //// [tryCatchFinallyControlFlow.js] @@ -227,6 +360,119 @@ function f7() { } x; // Unreachable } +function f8() { + var x = 0; + (function () { + try { + x = 1; + return; + } + finally { + x; // 0 | 1 + } + x; // Unreachable + })(); + x; // 1 +} +function f9() { + var x = 0; + (function () { + try { + if (!!true) { + x = 1; + return; + } + } + finally { + x; // 0 | 1 + } + x; // 0 + x = 2; + })(); + x; // 1 | 2 +} +function f10() { + var x = 0; + (function () { + try { + x = 1; + return; + } + catch (e) { + x = 2; + } + finally { + x; // 0 | 1 | 2 + } + x; // 2 + x = 3; + })(); + x; // 1 | 3 +} +function f11() { + var x = 0; + (function () { + try { + if (!!true) { + x = 1; + return; + } + if (!!true) { + x = 2; + throw 0; + } + } + catch (e) { + x; // 0 | 1 | 2 + x = 3; + } + finally { + x; // 0 | 1 | 2 | 3 + if (!!true) { + x = 4; + } + } + x; // 0 | 3 | 4 + x = 5; + })(); + x; // 1 | 4 | 5 +} +function f12() { + var x = 0; + (function () { + try { + if (!!true) { + x = 1; + return; + } + if (!!true) { + x = 2; + throw 0; + } + } + catch (e) { + x; // 0 | 1 | 2 + x = 3; + } + finally { + x; // 0 | 1 | 2 | 3 + if (!!true) { + x = 4; + return; + } + if (!!true) { + x = 5; + return; + } + x = 6; + return; + x; // unreachable + } + x; // unreachable + x = 7; // no effect + })(); + x; // 4 | 5 | 6 +} // Repro from #35644 var main = function () { var hoge = undefined; @@ -244,3 +490,16 @@ var main = function () { return; } }; +// Repro from #36828 +function t1() { + var x = (function () { + try { + return 'x'; + } + catch (e) { + return null; + } + x; // Unreachable + })(); + x; // Reachable +} diff --git a/tests/baselines/reference/tryCatchFinallyControlFlow.symbols b/tests/baselines/reference/tryCatchFinallyControlFlow.symbols index 054151d6328..30e6ea3da35 100644 --- a/tests/baselines/reference/tryCatchFinallyControlFlow.symbols +++ b/tests/baselines/reference/tryCatchFinallyControlFlow.symbols @@ -187,18 +187,221 @@ function f7() { >x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 92, 7)) } +function f8() { +>f8 : Symbol(f8, Decl(tryCatchFinallyControlFlow.ts, 105, 1)) + + let x: 0 | 1 = 0; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 108, 7)) + + (() => { + try { + x = 1; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 108, 7)) + + return; + } + finally { + x; // 0 | 1 +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 108, 7)) + } + x; // Unreachable +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 108, 7)) + + })(); + x; // 1 +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 108, 7)) +} + +function f9() { +>f9 : Symbol(f9, Decl(tryCatchFinallyControlFlow.ts, 120, 1)) + + let x: 0 | 1 | 2 = 0; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 123, 7)) + + (() => { + try { + if (!!true) { + x = 1; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 123, 7)) + + return; + } + } + finally { + x; // 0 | 1 +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 123, 7)) + } + x; // 0 +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 123, 7)) + + x = 2; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 123, 7)) + + })(); + x; // 1 | 2 +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 123, 7)) +} + +function f10() { +>f10 : Symbol(f10, Decl(tryCatchFinallyControlFlow.ts, 138, 1)) + + let x: 0 | 1 | 2 | 3 = 0; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 141, 7)) + + (() => { + try { + x = 1; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 141, 7)) + + return; + } + catch (e) { +>e : Symbol(e, Decl(tryCatchFinallyControlFlow.ts, 147, 15)) + + x = 2; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 141, 7)) + } + finally { + x; // 0 | 1 | 2 +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 141, 7)) + } + x; // 2 +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 141, 7)) + + x = 3; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 141, 7)) + + })(); + x; // 1 | 3 +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 141, 7)) +} + +function f11() { +>f11 : Symbol(f11, Decl(tryCatchFinallyControlFlow.ts, 157, 1)) + + let x: 0 | 1 | 2 | 3 | 4 | 5 = 0; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7)) + + (() => { + try { + if (!!true) { + x = 1; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7)) + + return; + } + if (!!true) { + x = 2; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7)) + + throw 0; + } + } + catch (e) { +>e : Symbol(e, Decl(tryCatchFinallyControlFlow.ts, 172, 15)) + + x; // 0 | 1 | 2 +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7)) + + x = 3; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7)) + } + finally { + x; // 0 | 1 | 2 | 3 +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7)) + + if (!!true) { + x = 4; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7)) + } + } + x; // 0 | 3 | 4 +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7)) + + x = 5; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7)) + + })(); + x; // 1 | 4 | 5 +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 160, 7)) +} + +function f12() { +>f12 : Symbol(f12, Decl(tryCatchFinallyControlFlow.ts, 186, 1)) + + let x: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 = 0; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7)) + + (() => { + try { + if (!!true) { + x = 1; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7)) + + return; + } + if (!!true) { + x = 2; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7)) + + throw 0; + } + } + catch (e) { +>e : Symbol(e, Decl(tryCatchFinallyControlFlow.ts, 201, 15)) + + x; // 0 | 1 | 2 +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7)) + + x = 3; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7)) + } + finally { + x; // 0 | 1 | 2 | 3 +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7)) + + if (!!true) { + x = 4; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7)) + + return; + } + if (!!true) { + x = 5; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7)) + + return; + } + x = 6; +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7)) + + return; + x; // unreachable +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7)) + } + x; // unreachable +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7)) + + x = 7; // no effect +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7)) + + })(); + x; // 4 | 5 | 6 +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 189, 7)) +} + // Repro from #35644 const main = () => { ->main : Symbol(main, Decl(tryCatchFinallyControlFlow.ts, 109, 5)) +>main : Symbol(main, Decl(tryCatchFinallyControlFlow.ts, 227, 5)) let hoge: string | undefined = undefined; ->hoge : Symbol(hoge, Decl(tryCatchFinallyControlFlow.ts, 110, 7)) +>hoge : Symbol(hoge, Decl(tryCatchFinallyControlFlow.ts, 228, 7)) >undefined : Symbol(undefined) try { hoge = 'hoge!'; ->hoge : Symbol(hoge, Decl(tryCatchFinallyControlFlow.ts, 110, 7)) +>hoge : Symbol(hoge, Decl(tryCatchFinallyControlFlow.ts, 228, 7)) return; } @@ -207,14 +410,38 @@ const main = () => { } finally { if (hoge) { ->hoge : Symbol(hoge, Decl(tryCatchFinallyControlFlow.ts, 110, 7)) +>hoge : Symbol(hoge, Decl(tryCatchFinallyControlFlow.ts, 228, 7)) hoge.length; >hoge.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) ->hoge : Symbol(hoge, Decl(tryCatchFinallyControlFlow.ts, 110, 7)) +>hoge : Symbol(hoge, Decl(tryCatchFinallyControlFlow.ts, 228, 7)) >length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) } return; } } +// Repro from #36828 + +function t1() { +>t1 : Symbol(t1, Decl(tryCatchFinallyControlFlow.ts, 242, 1)) + + const x = (() => { +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 247, 9)) + + try { + return 'x'; + } + catch (e) { +>e : Symbol(e, Decl(tryCatchFinallyControlFlow.ts, 251, 15)) + + return null; + } + x; // Unreachable +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 247, 9)) + + })(); + x; // Reachable +>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 247, 9)) +} + diff --git a/tests/baselines/reference/tryCatchFinallyControlFlow.types b/tests/baselines/reference/tryCatchFinallyControlFlow.types index d29a00750d7..70c11b87dca 100644 --- a/tests/baselines/reference/tryCatchFinallyControlFlow.types +++ b/tests/baselines/reference/tryCatchFinallyControlFlow.types @@ -228,6 +228,304 @@ function f7() { >x : 0 | 1 | 2 | 3 } +function f8() { +>f8 : () => void + + let x: 0 | 1 = 0; +>x : 0 | 1 +>0 : 0 + + (() => { +>(() => { try { x = 1; return; } finally { x; // 0 | 1 } x; // Unreachable })() : void +>(() => { try { x = 1; return; } finally { x; // 0 | 1 } x; // Unreachable }) : () => void +>() => { try { x = 1; return; } finally { x; // 0 | 1 } x; // Unreachable } : () => void + + try { + x = 1; +>x = 1 : 1 +>x : 0 | 1 +>1 : 1 + + return; + } + finally { + x; // 0 | 1 +>x : 0 | 1 + } + x; // Unreachable +>x : 0 | 1 + + })(); + x; // 1 +>x : 1 +} + +function f9() { +>f9 : () => void + + let x: 0 | 1 | 2 = 0; +>x : 0 | 1 | 2 +>0 : 0 + + (() => { +>(() => { try { if (!!true) { x = 1; return; } } finally { x; // 0 | 1 } x; // 0 x = 2; })() : void +>(() => { try { if (!!true) { x = 1; return; } } finally { x; // 0 | 1 } x; // 0 x = 2; }) : () => void +>() => { try { if (!!true) { x = 1; return; } } finally { x; // 0 | 1 } x; // 0 x = 2; } : () => void + + try { + if (!!true) { +>!!true : true +>!true : false +>true : true + + x = 1; +>x = 1 : 1 +>x : 0 | 1 | 2 +>1 : 1 + + return; + } + } + finally { + x; // 0 | 1 +>x : 0 | 1 + } + x; // 0 +>x : 0 + + x = 2; +>x = 2 : 2 +>x : 0 | 1 | 2 +>2 : 2 + + })(); + x; // 1 | 2 +>x : 1 | 2 +} + +function f10() { +>f10 : () => void + + let x: 0 | 1 | 2 | 3 = 0; +>x : 0 | 1 | 2 | 3 +>0 : 0 + + (() => { +>(() => { try { x = 1; return; } catch (e) { x = 2; } finally { x; // 0 | 1 | 2 } x; // 2 x = 3; })() : void +>(() => { try { x = 1; return; } catch (e) { x = 2; } finally { x; // 0 | 1 | 2 } x; // 2 x = 3; }) : () => void +>() => { try { x = 1; return; } catch (e) { x = 2; } finally { x; // 0 | 1 | 2 } x; // 2 x = 3; } : () => void + + try { + x = 1; +>x = 1 : 1 +>x : 0 | 1 | 2 | 3 +>1 : 1 + + return; + } + catch (e) { +>e : any + + x = 2; +>x = 2 : 2 +>x : 0 | 1 | 2 | 3 +>2 : 2 + } + finally { + x; // 0 | 1 | 2 +>x : 0 | 1 | 2 + } + x; // 2 +>x : 2 + + x = 3; +>x = 3 : 3 +>x : 0 | 1 | 2 | 3 +>3 : 3 + + })(); + x; // 1 | 3 +>x : 1 | 3 +} + +function f11() { +>f11 : () => void + + let x: 0 | 1 | 2 | 3 | 4 | 5 = 0; +>x : 0 | 1 | 2 | 3 | 4 | 5 +>0 : 0 + + (() => { +>(() => { try { if (!!true) { x = 1; return; } if (!!true) { x = 2; throw 0; } } catch (e) { x; // 0 | 1 | 2 x = 3; } finally { x; // 0 | 1 | 2 | 3 if (!!true) { x = 4; } } x; // 0 | 3 | 4 x = 5; })() : void +>(() => { try { if (!!true) { x = 1; return; } if (!!true) { x = 2; throw 0; } } catch (e) { x; // 0 | 1 | 2 x = 3; } finally { x; // 0 | 1 | 2 | 3 if (!!true) { x = 4; } } x; // 0 | 3 | 4 x = 5; }) : () => void +>() => { try { if (!!true) { x = 1; return; } if (!!true) { x = 2; throw 0; } } catch (e) { x; // 0 | 1 | 2 x = 3; } finally { x; // 0 | 1 | 2 | 3 if (!!true) { x = 4; } } x; // 0 | 3 | 4 x = 5; } : () => void + + try { + if (!!true) { +>!!true : true +>!true : false +>true : true + + x = 1; +>x = 1 : 1 +>x : 0 | 1 | 2 | 3 | 4 | 5 +>1 : 1 + + return; + } + if (!!true) { +>!!true : true +>!true : false +>true : true + + x = 2; +>x = 2 : 2 +>x : 0 | 1 | 2 | 3 | 4 | 5 +>2 : 2 + + throw 0; +>0 : 0 + } + } + catch (e) { +>e : any + + x; // 0 | 1 | 2 +>x : 0 | 1 | 2 + + x = 3; +>x = 3 : 3 +>x : 0 | 1 | 2 | 3 | 4 | 5 +>3 : 3 + } + finally { + x; // 0 | 1 | 2 | 3 +>x : 0 | 1 | 2 | 3 + + if (!!true) { +>!!true : true +>!true : false +>true : true + + x = 4; +>x = 4 : 4 +>x : 0 | 1 | 2 | 3 | 4 | 5 +>4 : 4 + } + } + x; // 0 | 3 | 4 +>x : 0 | 3 | 4 + + x = 5; +>x = 5 : 5 +>x : 0 | 1 | 2 | 3 | 4 | 5 +>5 : 5 + + })(); + x; // 1 | 4 | 5 +>x : 1 | 4 | 5 +} + +function f12() { +>f12 : () => void + + let x: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 = 0; +>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 +>0 : 0 + + (() => { +>(() => { try { if (!!true) { x = 1; return; } if (!!true) { x = 2; throw 0; } } catch (e) { x; // 0 | 1 | 2 x = 3; } finally { x; // 0 | 1 | 2 | 3 if (!!true) { x = 4; return; } if (!!true) { x = 5; return; } x = 6; return; x; // unreachable } x; // unreachable x = 7; // no effect })() : void +>(() => { try { if (!!true) { x = 1; return; } if (!!true) { x = 2; throw 0; } } catch (e) { x; // 0 | 1 | 2 x = 3; } finally { x; // 0 | 1 | 2 | 3 if (!!true) { x = 4; return; } if (!!true) { x = 5; return; } x = 6; return; x; // unreachable } x; // unreachable x = 7; // no effect }) : () => void +>() => { try { if (!!true) { x = 1; return; } if (!!true) { x = 2; throw 0; } } catch (e) { x; // 0 | 1 | 2 x = 3; } finally { x; // 0 | 1 | 2 | 3 if (!!true) { x = 4; return; } if (!!true) { x = 5; return; } x = 6; return; x; // unreachable } x; // unreachable x = 7; // no effect } : () => void + + try { + if (!!true) { +>!!true : true +>!true : false +>true : true + + x = 1; +>x = 1 : 1 +>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 +>1 : 1 + + return; + } + if (!!true) { +>!!true : true +>!true : false +>true : true + + x = 2; +>x = 2 : 2 +>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 +>2 : 2 + + throw 0; +>0 : 0 + } + } + catch (e) { +>e : any + + x; // 0 | 1 | 2 +>x : 0 | 1 | 2 + + x = 3; +>x = 3 : 3 +>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 +>3 : 3 + } + finally { + x; // 0 | 1 | 2 | 3 +>x : 0 | 1 | 2 | 3 + + if (!!true) { +>!!true : true +>!true : false +>true : true + + x = 4; +>x = 4 : 4 +>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 +>4 : 4 + + return; + } + if (!!true) { +>!!true : true +>!true : false +>true : true + + x = 5; +>x = 5 : 5 +>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 +>5 : 5 + + return; + } + x = 6; +>x = 6 : 6 +>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 +>6 : 6 + + return; + x; // unreachable +>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 + } + x; // unreachable +>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 + + x = 7; // no effect +>x = 7 : 7 +>x : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 +>7 : 7 + + })(); + x; // 4 | 5 | 6 +>x : 4 | 5 | 6 +} + // Repro from #35644 const main = () => { @@ -262,3 +560,32 @@ const main = () => { } } +// Repro from #36828 + +function t1() { +>t1 : () => void + + const x = (() => { +>x : "x" | null +>(() => { try { return 'x'; } catch (e) { return null; } x; // Unreachable })() : "x" | null +>(() => { try { return 'x'; } catch (e) { return null; } x; // Unreachable }) : () => "x" | null +>() => { try { return 'x'; } catch (e) { return null; } x; // Unreachable } : () => "x" | null + + try { + return 'x'; +>'x' : "x" + } + catch (e) { +>e : any + + return null; +>null : null + } + x; // Unreachable +>x : "x" | null + + })(); + x; // Reachable +>x : "x" | null +} + diff --git a/tests/cases/compiler/tryCatchFinallyControlFlow.ts b/tests/cases/compiler/tryCatchFinallyControlFlow.ts index 694d9f0c4d5..83909b5ddb0 100644 --- a/tests/cases/compiler/tryCatchFinallyControlFlow.ts +++ b/tests/cases/compiler/tryCatchFinallyControlFlow.ts @@ -108,6 +108,124 @@ function f7() { x; // Unreachable } +function f8() { + let x: 0 | 1 = 0; + (() => { + try { + x = 1; + return; + } + finally { + x; // 0 | 1 + } + x; // Unreachable + })(); + x; // 1 +} + +function f9() { + let x: 0 | 1 | 2 = 0; + (() => { + try { + if (!!true) { + x = 1; + return; + } + } + finally { + x; // 0 | 1 + } + x; // 0 + x = 2; + })(); + x; // 1 | 2 +} + +function f10() { + let x: 0 | 1 | 2 | 3 = 0; + (() => { + try { + x = 1; + return; + } + catch (e) { + x = 2; + } + finally { + x; // 0 | 1 | 2 + } + x; // 2 + x = 3; + })(); + x; // 1 | 3 +} + +function f11() { + let x: 0 | 1 | 2 | 3 | 4 | 5 = 0; + (() => { + try { + if (!!true) { + x = 1; + return; + } + if (!!true) { + x = 2; + throw 0; + } + } + catch (e) { + x; // 0 | 1 | 2 + x = 3; + } + finally { + x; // 0 | 1 | 2 | 3 + if (!!true) { + x = 4; + } + } + x; // 0 | 3 | 4 + x = 5; + })(); + x; // 1 | 4 | 5 +} + +function f12() { + let x: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 = 0; + (() => { + try { + if (!!true) { + x = 1; + return; + } + if (!!true) { + x = 2; + throw 0; + } + } + catch (e) { + x; // 0 | 1 | 2 + x = 3; + } + finally { + x; // 0 | 1 | 2 | 3 + if (!!true) { + x = 4; + return; + } + if (!!true) { + x = 5; + return; + } + x = 6; + return; + x; // unreachable + } + x; // unreachable + x = 7; // no effect + })(); + x; // 4 | 5 | 6 +} + // Repro from #35644 const main = () => { @@ -126,3 +244,18 @@ const main = () => { return; } } + +// Repro from #36828 + +function t1() { + const x = (() => { + try { + return 'x'; + } + catch (e) { + return null; + } + x; // Unreachable + })(); + x; // Reachable +} From 4d5464e1f9ab415cc0fdce59f3d88a4be203c2f2 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 25 Feb 2020 16:40:38 -0800 Subject: [PATCH 15/17] Revert "Support declaration emit for late bound element accesses assigned to functions in both TS and JS (#36593)" (#37034) This reverts commit 3e4ce4777d382f2f2b49bd2c7a279b068278552a. --- src/compiler/checker.ts | 33 ++------ src/compiler/transformers/declarations.ts | 13 +-- .../transformers/declarations/diagnostics.ts | 12 +-- src/compiler/types.ts | 3 +- src/compiler/utilities.ts | 4 - ...oundElementAccessAssignmentDeclarations.js | 40 --------- ...lementAccessAssignmentDeclarations.symbols | 58 ------------- ...dElementAccessAssignmentDeclarations.types | 80 ------------------ ...ElementAccessAssignmentDeclarationsInJs.js | 29 ------- ...ntAccessAssignmentDeclarationsInJs.symbols | 62 -------------- ...mentAccessAssignmentDeclarationsInJs.types | 84 ------------------- ...oundElementAccessAssignmentDeclarations.ts | 18 ---- ...ElementAccessAssignmentDeclarationsInJs.ts | 26 ------ 13 files changed, 13 insertions(+), 449 deletions(-) delete mode 100644 tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.js delete mode 100644 tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.symbols delete mode 100644 tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.types delete mode 100644 tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.js delete mode 100644 tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.symbols delete mode 100644 tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.types delete mode 100644 tests/cases/compiler/lateBoundElementAccessAssignmentDeclarations.ts delete mode 100644 tests/cases/compiler/lateBoundElementAccessAssignmentDeclarationsInJs.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3192ad7ea05..24bf24b60a2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3069,20 +3069,9 @@ namespace ts { function resolveExternalModuleSymbol(moduleSymbol: Symbol | undefined, dontResolveAlias?: boolean): Symbol | undefined; function resolveExternalModuleSymbol(moduleSymbol: Symbol, dontResolveAlias?: boolean): Symbol { if (moduleSymbol) { - const links = getSymbolLinks(moduleSymbol); - if (!dontResolveAlias) { - links.resolvedExternalModuleSymbol = "circular"; - } const exportEquals = resolveSymbol(moduleSymbol.exports!.get(InternalSymbolName.ExportEquals), dontResolveAlias); const exported = getCommonJsExportEquals(getMergedSymbol(exportEquals), getMergedSymbol(moduleSymbol)); - const result = getMergedSymbol(exported) || moduleSymbol; - if (!dontResolveAlias) { - // we "cache" this result, but because both the input _and_ the output are mergeable, literally every call could need - // a different result, assuming the inputs and outputs get merged with. So instead we just use this as a flag that - // export assignment resolution has occured on this symbol at least once. (because it might happen many times!) - links.resolvedExternalModuleSymbol = result; - } - return result; + return getMergedSymbol(exported) || moduleSymbol; } return undefined!; } @@ -5554,7 +5543,7 @@ namespace ts { function serializeSymbolWorker(symbol: Symbol, isPrivate: boolean, propertyAsAlias: boolean) { const symbolName = unescapeLeadingUnderscores(symbol.escapedName); const isDefault = symbol.escapedName === InternalSymbolName.Default; - if ((isStringANonContextualKeyword(symbolName) || !isIdentifierText(symbolName, languageVersion)) && !isDefault && symbol.escapedName !== InternalSymbolName.ExportEquals) { + if (isStringANonContextualKeyword(symbolName) && !isDefault) { // Oh no. We cannot use this symbol's name as it's name... It's likely some jsdoc had an invalid name like `export` or `default` :( context.encounteredError = true; // TODO: Issue error via symbol tracker? @@ -5705,8 +5694,7 @@ namespace ts { } function getNamespaceMembersForSerialization(symbol: Symbol) { - const exports = getExportsOfSymbol(symbol); - return !exports ? [] : filter(arrayFrom((exports).values()), p => !((p.flags & SymbolFlags.Prototype) || (p.escapedName === "prototype"))); + return !symbol.exports ? [] : filter(arrayFrom((symbol.exports).values()), p => !((p.flags & SymbolFlags.Prototype) || (p.escapedName === "prototype"))); } function isTypeOnlyNamespace(symbol: Symbol) { @@ -8908,17 +8896,6 @@ namespace ts { function getResolvedMembersOrExportsOfSymbol(symbol: Symbol, resolutionKind: MembersOrExportsResolutionKind): UnderscoreEscapedMap { const links = getSymbolLinks(symbol); if (!links[resolutionKind]) { - // We _must_ resolve any possible commonjs export assignments _before_ merging in late bound members, as cjs export assignments may cause - // things to be merged (?!?) into this symbol; moreover, we _can't_ resolve those export assignments if we're already resolving the containing - // module (as then we'll issue a circularity error) - const p = symbol.valueDeclaration?.parent; - if (p && isSourceFile(p) && p.symbol && !getSymbolLinks(p.symbol).resolvedExternalModuleSymbol) { - const exported = resolveExternalModuleSymbol(p.symbol); - const targetLinks = exported && getSymbolLinks(exported); - if (targetLinks && targetLinks[resolutionKind]) { - return links[resolutionKind] = targetLinks[resolutionKind]!; - } - } const isStatic = resolutionKind === MembersOrExportsResolutionKind.resolvedExports; const earlySymbols = !isStatic ? symbol.members : symbol.flags & SymbolFlags.Module ? getExportsOfModuleWorker(symbol) : @@ -35285,8 +35262,8 @@ namespace ts { } } - function createTypeOfDeclaration(declarationIn: AccessorDeclaration | VariableLikeDeclaration | PropertyAccessExpression | ElementAccessExpression | BinaryExpression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker, addUndefined?: boolean) { - const declaration = getParseTreeNode(declarationIn, isPossiblyPropertyLikeDeclaration); + function createTypeOfDeclaration(declarationIn: AccessorDeclaration | VariableLikeDeclaration | PropertyAccessExpression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker, addUndefined?: boolean) { + const declaration = getParseTreeNode(declarationIn, isVariableLikeOrAccessor); if (!declaration) { return createToken(SyntaxKind.AnyKeyword) as KeywordTypeNode; } diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index 605e441da67..00417535145 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -1157,20 +1157,13 @@ namespace ts { fakespace.locals = createSymbolTable(props); fakespace.symbol = props[0].parent!; const declarations = mapDefined(props, p => { - if (!isPropertyAccessExpression(p.valueDeclaration) && !isElementAccessExpression(p.valueDeclaration) && !isBinaryExpression(p.valueDeclaration)) { - return undefined; - } - if (hasDynamicName(p.valueDeclaration) && !resolver.isLateBound(getParseTreeNode(p.valueDeclaration) as Declaration)) { - return undefined; - } - const name = unescapeLeadingUnderscores(p.escapedName); - if (!isIdentifierText(name, ScriptTarget.ES3)) { - return undefined; // TODO: Rather than quietly eliding (as is current behavior), maybe we should issue errors? + if (!isPropertyAccessExpression(p.valueDeclaration)) { + return undefined; // TODO GH#33569: Handle element access expressions that created late bound names (rather than silently omitting them) } getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration); const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, symbolTracker); getSymbolAccessibilityDiagnostic = oldDiag; - const varDecl = createVariableDeclaration(name, type, /*initializer*/ undefined); + const varDecl = createVariableDeclaration(unescapeLeadingUnderscores(p.escapedName), type, /*initializer*/ undefined); return createVariableStatement(/*modifiers*/ undefined, createVariableDeclarationList([varDecl])); }); const namespaceDecl = createModuleDeclaration(/*decorators*/ undefined, ensureModifiers(input), input.name!, createModuleBlock(declarations), NodeFlags.Namespace); diff --git a/src/compiler/transformers/declarations/diagnostics.ts b/src/compiler/transformers/declarations/diagnostics.ts index 1b7827f552f..ac44f7efd15 100644 --- a/src/compiler/transformers/declarations/diagnostics.ts +++ b/src/compiler/transformers/declarations/diagnostics.ts @@ -27,9 +27,7 @@ namespace ts { | TypeAliasDeclaration | ConstructorDeclaration | IndexSignatureDeclaration - | PropertyAccessExpression - | ElementAccessExpression - | BinaryExpression; + | PropertyAccessExpression; export function canProduceDiagnostics(node: Node): node is DeclarationDiagnosticProducing { return isVariableDeclaration(node) || @@ -50,9 +48,7 @@ namespace ts { isTypeAliasDeclaration(node) || isConstructorDeclaration(node) || isIndexSignatureDeclaration(node) || - isPropertyAccessExpression(node) || - isElementAccessExpression(node) || - isBinaryExpression(node); + isPropertyAccessExpression(node); } export function createGetSymbolAccessibilityDiagnosticForNodeName(node: DeclarationDiagnosticProducing) { @@ -129,7 +125,7 @@ namespace ts { } export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationDiagnosticProducing): (symbolAccessibilityResult: SymbolAccessibilityResult) => SymbolAccessibilityDiagnostic | undefined { - if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node) || isBinaryExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) { + if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) { return getVariableDeclarationTypeVisibilityError; } else if (isSetAccessor(node) || isGetAccessor(node)) { @@ -170,7 +166,7 @@ namespace ts { } // This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit // The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all. - else if (node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertyAccessExpression || node.kind === SyntaxKind.ElementAccessExpression || node.kind === SyntaxKind.BinaryExpression || node.kind === SyntaxKind.PropertySignature || + else if (node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertyAccessExpression || node.kind === SyntaxKind.PropertySignature || (node.kind === SyntaxKind.Parameter && hasModifier(node.parent, ModifierFlags.Private))) { // TODO(jfreeman): Deal with computed properties in error reporting. if (hasModifier(node, ModifierFlags.Static)) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index d5ee8d7581e..74cd04d7674 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3935,7 +3935,7 @@ namespace ts { isOptionalUninitializedParameterProperty(node: ParameterDeclaration): boolean; isExpandoFunctionDeclaration(node: FunctionDeclaration): boolean; getPropertiesOfContainerFunction(node: Declaration): Symbol[]; - createTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration | PropertyAccessExpression | ElementAccessExpression | BinaryExpression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker, addUndefined?: boolean): TypeNode | undefined; + createTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration | PropertyAccessExpression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker, addUndefined?: boolean): TypeNode | undefined; createReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker): TypeNode | undefined; createTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker): TypeNode | undefined; createLiteralConstValue(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration, tracker: SymbolTracker): Expression; @@ -4109,7 +4109,6 @@ namespace ts { deferralParent?: Type; // Source union/intersection of a deferred type cjsExportMerged?: Symbol; // Version of the symbol with all non export= exports merged with the export= target typeOnlyDeclaration?: TypeOnlyCompatibleAliasDeclaration | false; // First resolved alias declaration that makes the symbol only usable in type constructs - resolvedExternalModuleSymbol?: Symbol | "circular"; // Cached result of `resolveExternalModuleSymbol` } /* @internal */ diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 26873a95d3d..7badd3af99e 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1299,10 +1299,6 @@ namespace ts { return isVariableLike(node) || isAccessor(node); } - export function isPossiblyPropertyLikeDeclaration(node: Node): node is AccessorDeclaration | VariableLikeDeclaration | PropertyAccessExpression | ElementAccessExpression { - return isVariableLikeOrAccessor(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node) || isBinaryExpression(node); - } - export function isVariableDeclarationInVariableStatement(node: VariableDeclaration) { return node.parent.kind === SyntaxKind.VariableDeclarationList && node.parent.parent.kind === SyntaxKind.VariableStatement; diff --git a/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.js b/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.js deleted file mode 100644 index b32a31e9a35..00000000000 --- a/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.js +++ /dev/null @@ -1,40 +0,0 @@ -//// [lateBoundElementAccessAssignmentDeclarations.ts] -export function foo() {} -foo.bar = 12; -const _private = Symbol(); -foo[_private] = "ok"; -const strMem = "strMemName"; -foo[strMem] = "ok"; -const dashStrMem = "dashed-str-mem"; -foo[dashStrMem] = "ok"; -const numMem = 42; -foo[numMem] = "ok"; - -const x: string = foo[_private]; -const y: string = foo[strMem]; -const z: string = foo[numMem]; -const a: string = foo[dashStrMem]; - -//// [lateBoundElementAccessAssignmentDeclarations.js] -export function foo() { } -foo.bar = 12; -const _private = Symbol(); -foo[_private] = "ok"; -const strMem = "strMemName"; -foo[strMem] = "ok"; -const dashStrMem = "dashed-str-mem"; -foo[dashStrMem] = "ok"; -const numMem = 42; -foo[numMem] = "ok"; -const x = foo[_private]; -const y = foo[strMem]; -const z = foo[numMem]; -const a = foo[dashStrMem]; - - -//// [lateBoundElementAccessAssignmentDeclarations.d.ts] -export declare function foo(): void; -export declare namespace foo { - var bar: number; - var strMemName: string; -} diff --git a/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.symbols b/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.symbols deleted file mode 100644 index d407959b0c3..00000000000 --- a/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.symbols +++ /dev/null @@ -1,58 +0,0 @@ -=== tests/cases/compiler/lateBoundElementAccessAssignmentDeclarations.ts === -export function foo() {} ->foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) - -foo.bar = 12; ->foo.bar : Symbol(foo.bar, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24)) ->foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) ->bar : Symbol(foo.bar, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24)) - -const _private = Symbol(); ->_private : Symbol(_private, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 5)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) - -foo[_private] = "ok"; ->foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) ->_private : Symbol(_private, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 5)) - -const strMem = "strMemName"; ->strMem : Symbol(strMem, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 5)) - -foo[strMem] = "ok"; ->foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) ->strMem : Symbol(strMem, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 5)) - -const dashStrMem = "dashed-str-mem"; ->dashStrMem : Symbol(dashStrMem, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 5)) - -foo[dashStrMem] = "ok"; ->foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) ->dashStrMem : Symbol(dashStrMem, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 5)) - -const numMem = 42; ->numMem : Symbol(numMem, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 8, 5)) - -foo[numMem] = "ok"; ->foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) ->numMem : Symbol(numMem, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 8, 5)) - -const x: string = foo[_private]; ->x : Symbol(x, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 11, 5)) ->foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) ->_private : Symbol(_private, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 5)) - -const y: string = foo[strMem]; ->y : Symbol(y, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 12, 5)) ->foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) ->strMem : Symbol(strMem, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 5)) - -const z: string = foo[numMem]; ->z : Symbol(z, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 13, 5)) ->foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) ->numMem : Symbol(numMem, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 8, 5)) - -const a: string = foo[dashStrMem]; ->a : Symbol(a, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 14, 5)) ->foo : Symbol(foo, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 0), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 0, 24), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 2, 26), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 4, 28), Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 36) ... and 1 more) ->dashStrMem : Symbol(dashStrMem, Decl(lateBoundElementAccessAssignmentDeclarations.ts, 6, 5)) - diff --git a/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.types b/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.types deleted file mode 100644 index 2175a04ecfc..00000000000 --- a/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarations.types +++ /dev/null @@ -1,80 +0,0 @@ -=== tests/cases/compiler/lateBoundElementAccessAssignmentDeclarations.ts === -export function foo() {} ->foo : typeof foo - -foo.bar = 12; ->foo.bar = 12 : 12 ->foo.bar : number ->foo : typeof foo ->bar : number ->12 : 12 - -const _private = Symbol(); ->_private : unique symbol ->Symbol() : unique symbol ->Symbol : SymbolConstructor - -foo[_private] = "ok"; ->foo[_private] = "ok" : "ok" ->foo[_private] : string ->foo : typeof foo ->_private : unique symbol ->"ok" : "ok" - -const strMem = "strMemName"; ->strMem : "strMemName" ->"strMemName" : "strMemName" - -foo[strMem] = "ok"; ->foo[strMem] = "ok" : "ok" ->foo[strMem] : string ->foo : typeof foo ->strMem : "strMemName" ->"ok" : "ok" - -const dashStrMem = "dashed-str-mem"; ->dashStrMem : "dashed-str-mem" ->"dashed-str-mem" : "dashed-str-mem" - -foo[dashStrMem] = "ok"; ->foo[dashStrMem] = "ok" : "ok" ->foo[dashStrMem] : string ->foo : typeof foo ->dashStrMem : "dashed-str-mem" ->"ok" : "ok" - -const numMem = 42; ->numMem : 42 ->42 : 42 - -foo[numMem] = "ok"; ->foo[numMem] = "ok" : "ok" ->foo[numMem] : string ->foo : typeof foo ->numMem : 42 ->"ok" : "ok" - -const x: string = foo[_private]; ->x : string ->foo[_private] : string ->foo : typeof foo ->_private : unique symbol - -const y: string = foo[strMem]; ->y : string ->foo[strMem] : string ->foo : typeof foo ->strMem : "strMemName" - -const z: string = foo[numMem]; ->z : string ->foo[numMem] : string ->foo : typeof foo ->numMem : 42 - -const a: string = foo[dashStrMem]; ->a : string ->foo[dashStrMem] : string ->foo : typeof foo ->dashStrMem : "dashed-str-mem" - diff --git a/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.js b/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.js deleted file mode 100644 index a9b6a0a86cd..00000000000 --- a/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.js +++ /dev/null @@ -1,29 +0,0 @@ -//// [file.js] -export function foo() {} -foo.bar = 12; -const _private = Symbol(); -foo[_private] = "ok"; -const strMem = "strMemName"; -foo[strMem] = "ok"; -const dashStrMem = "dashed-str-mem"; -foo[dashStrMem] = "ok"; -const numMem = 42; -foo[numMem] = "ok"; - -/** @type {string} */ -const x = foo[_private]; -/** @type {string} */ -const y = foo[strMem]; -/** @type {string} */ -const z = foo[numMem]; -/** @type {string} */ -const a = foo[dashStrMem]; - - - -//// [file.d.ts] -export function foo(): void; -export namespace foo { - export const bar: number; - export const strMemName: string; -} diff --git a/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.symbols b/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.symbols deleted file mode 100644 index 669ed588b19..00000000000 --- a/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.symbols +++ /dev/null @@ -1,62 +0,0 @@ -=== tests/cases/compiler/file.js === -export function foo() {} ->foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) - -foo.bar = 12; ->foo.bar : Symbol(foo.bar, Decl(file.js, 0, 24)) ->foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) ->bar : Symbol(foo.bar, Decl(file.js, 0, 24)) - -const _private = Symbol(); ->_private : Symbol(_private, Decl(file.js, 2, 5)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) - -foo[_private] = "ok"; ->foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) ->_private : Symbol(_private, Decl(file.js, 2, 5)) - -const strMem = "strMemName"; ->strMem : Symbol(strMem, Decl(file.js, 4, 5)) - -foo[strMem] = "ok"; ->foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) ->strMem : Symbol(strMem, Decl(file.js, 4, 5)) - -const dashStrMem = "dashed-str-mem"; ->dashStrMem : Symbol(dashStrMem, Decl(file.js, 6, 5)) - -foo[dashStrMem] = "ok"; ->foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) ->dashStrMem : Symbol(dashStrMem, Decl(file.js, 6, 5)) - -const numMem = 42; ->numMem : Symbol(numMem, Decl(file.js, 8, 5)) - -foo[numMem] = "ok"; ->foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) ->numMem : Symbol(numMem, Decl(file.js, 8, 5)) - -/** @type {string} */ -const x = foo[_private]; ->x : Symbol(x, Decl(file.js, 12, 5)) ->foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) ->_private : Symbol(_private, Decl(file.js, 2, 5)) - -/** @type {string} */ -const y = foo[strMem]; ->y : Symbol(y, Decl(file.js, 14, 5)) ->foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) ->strMem : Symbol(strMem, Decl(file.js, 4, 5)) - -/** @type {string} */ -const z = foo[numMem]; ->z : Symbol(z, Decl(file.js, 16, 5)) ->foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) ->numMem : Symbol(numMem, Decl(file.js, 8, 5)) - -/** @type {string} */ -const a = foo[dashStrMem]; ->a : Symbol(a, Decl(file.js, 18, 5)) ->foo : Symbol(foo, Decl(file.js, 0, 0), Decl(file.js, 0, 24), Decl(file.js, 2, 26), Decl(file.js, 4, 28), Decl(file.js, 6, 36) ... and 1 more) ->dashStrMem : Symbol(dashStrMem, Decl(file.js, 6, 5)) - diff --git a/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.types b/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.types deleted file mode 100644 index d2c80bf4a58..00000000000 --- a/tests/baselines/reference/lateBoundElementAccessAssignmentDeclarationsInJs.types +++ /dev/null @@ -1,84 +0,0 @@ -=== tests/cases/compiler/file.js === -export function foo() {} ->foo : typeof foo - -foo.bar = 12; ->foo.bar = 12 : 12 ->foo.bar : number ->foo : typeof foo ->bar : number ->12 : 12 - -const _private = Symbol(); ->_private : unique symbol ->Symbol() : unique symbol ->Symbol : SymbolConstructor - -foo[_private] = "ok"; ->foo[_private] = "ok" : "ok" ->foo[_private] : string ->foo : typeof foo ->_private : unique symbol ->"ok" : "ok" - -const strMem = "strMemName"; ->strMem : "strMemName" ->"strMemName" : "strMemName" - -foo[strMem] = "ok"; ->foo[strMem] = "ok" : "ok" ->foo[strMem] : string ->foo : typeof foo ->strMem : "strMemName" ->"ok" : "ok" - -const dashStrMem = "dashed-str-mem"; ->dashStrMem : "dashed-str-mem" ->"dashed-str-mem" : "dashed-str-mem" - -foo[dashStrMem] = "ok"; ->foo[dashStrMem] = "ok" : "ok" ->foo[dashStrMem] : string ->foo : typeof foo ->dashStrMem : "dashed-str-mem" ->"ok" : "ok" - -const numMem = 42; ->numMem : 42 ->42 : 42 - -foo[numMem] = "ok"; ->foo[numMem] = "ok" : "ok" ->foo[numMem] : string ->foo : typeof foo ->numMem : 42 ->"ok" : "ok" - -/** @type {string} */ -const x = foo[_private]; ->x : string ->foo[_private] : string ->foo : typeof foo ->_private : unique symbol - -/** @type {string} */ -const y = foo[strMem]; ->y : string ->foo[strMem] : string ->foo : typeof foo ->strMem : "strMemName" - -/** @type {string} */ -const z = foo[numMem]; ->z : string ->foo[numMem] : string ->foo : typeof foo ->numMem : 42 - -/** @type {string} */ -const a = foo[dashStrMem]; ->a : string ->foo[dashStrMem] : string ->foo : typeof foo ->dashStrMem : "dashed-str-mem" - diff --git a/tests/cases/compiler/lateBoundElementAccessAssignmentDeclarations.ts b/tests/cases/compiler/lateBoundElementAccessAssignmentDeclarations.ts deleted file mode 100644 index fc90e9486bb..00000000000 --- a/tests/cases/compiler/lateBoundElementAccessAssignmentDeclarations.ts +++ /dev/null @@ -1,18 +0,0 @@ -// @strict: true -// @declaration: true -// @target: es6 -export function foo() {} -foo.bar = 12; -const _private = Symbol(); -foo[_private] = "ok"; -const strMem = "strMemName"; -foo[strMem] = "ok"; -const dashStrMem = "dashed-str-mem"; -foo[dashStrMem] = "ok"; -const numMem = 42; -foo[numMem] = "ok"; - -const x: string = foo[_private]; -const y: string = foo[strMem]; -const z: string = foo[numMem]; -const a: string = foo[dashStrMem]; \ No newline at end of file diff --git a/tests/cases/compiler/lateBoundElementAccessAssignmentDeclarationsInJs.ts b/tests/cases/compiler/lateBoundElementAccessAssignmentDeclarationsInJs.ts deleted file mode 100644 index 878d05ffa0a..00000000000 --- a/tests/cases/compiler/lateBoundElementAccessAssignmentDeclarationsInJs.ts +++ /dev/null @@ -1,26 +0,0 @@ -// @strict: true -// @declaration: true -// @target: es6 -// @checkJs: true -// @allowJs: true -// @emitDeclarationOnly: true -// @filename: file.js -export function foo() {} -foo.bar = 12; -const _private = Symbol(); -foo[_private] = "ok"; -const strMem = "strMemName"; -foo[strMem] = "ok"; -const dashStrMem = "dashed-str-mem"; -foo[dashStrMem] = "ok"; -const numMem = 42; -foo[numMem] = "ok"; - -/** @type {string} */ -const x = foo[_private]; -/** @type {string} */ -const y = foo[strMem]; -/** @type {string} */ -const z = foo[numMem]; -/** @type {string} */ -const a = foo[dashStrMem]; \ No newline at end of file From 15dd0002ef6ef8fe04f0a390fb5317ede413e316 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 25 Feb 2020 17:36:56 -0800 Subject: [PATCH 16/17] Unwrap substitutions both before _and_ after potential simplification (#32116) * Unwrap substitutions both before _and_ after potential simplification * Repeatedly unwrap/simplify until no more can be performed * Use seperate loops for source and target to reduce redundant calls * Move loop into function * Inline worker --- src/compiler/checker.ts | 15 +++-- ...eyofNestedSimplifiedSubstituteUnwrapped.js | 50 +++++++++++++++ ...estedSimplifiedSubstituteUnwrapped.symbols | 62 +++++++++++++++++++ ...fNestedSimplifiedSubstituteUnwrapped.types | 39 ++++++++++++ ...eyofNestedSimplifiedSubstituteUnwrapped.ts | 22 +++++++ 5 files changed, 183 insertions(+), 5 deletions(-) create mode 100644 tests/baselines/reference/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.js create mode 100644 tests/baselines/reference/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.symbols create mode 100644 tests/baselines/reference/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.types create mode 100644 tests/cases/compiler/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 24bf24b60a2..43297244e1a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14826,11 +14826,16 @@ namespace ts { } function getNormalizedType(type: Type, writing: boolean): Type { - return isFreshLiteralType(type) ? (type).regularType : - getObjectFlags(type) & ObjectFlags.Reference && (type).node ? createTypeReference((type).target, getTypeArguments(type)) : - type.flags & TypeFlags.Substitution ? writing ? (type).typeVariable : (type).substitute : - type.flags & TypeFlags.Simplifiable ? getSimplifiedType(type, writing) : - type; + do { + const t = isFreshLiteralType(type) ? (type).regularType : + getObjectFlags(type) & ObjectFlags.Reference && (type).node ? createTypeReference((type).target, getTypeArguments(type)) : + type.flags & TypeFlags.Substitution ? writing ? (type).typeVariable : (type).substitute : + type.flags & TypeFlags.Simplifiable ? getSimplifiedType(type, writing) : + type; + if (t === type) break; + type = t; + } while (true); + return type; } /** diff --git a/tests/baselines/reference/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.js b/tests/baselines/reference/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.js new file mode 100644 index 00000000000..2ff1261fd79 --- /dev/null +++ b/tests/baselines/reference/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.js @@ -0,0 +1,50 @@ +//// [indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts] +type AnyFunction = (...args: any[]) => any; +type Params = Parameters>; + +interface Wrapper { + call(event: K, ...args: Params): void; +} + +interface AWrapped { + foo(): void; +} + +class A { + foo: Wrapper; +} + +interface BWrapped extends AWrapped { + bar(): void; +} + +class B extends A { + foo: Wrapper; +} + +//// [indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.js] +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var A = /** @class */ (function () { + function A() { + } + return A; +}()); +var B = /** @class */ (function (_super) { + __extends(B, _super); + function B() { + return _super !== null && _super.apply(this, arguments) || this; + } + return B; +}(A)); diff --git a/tests/baselines/reference/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.symbols b/tests/baselines/reference/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.symbols new file mode 100644 index 00000000000..41f6b4a5ebc --- /dev/null +++ b/tests/baselines/reference/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.symbols @@ -0,0 +1,62 @@ +=== tests/cases/compiler/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts === +type AnyFunction = (...args: any[]) => any; +>AnyFunction : Symbol(AnyFunction, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 0, 0)) +>args : Symbol(args, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 0, 20)) + +type Params = Parameters>; +>Params : Symbol(Params, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 0, 43)) +>T : Symbol(T, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 1, 12)) +>Parameters : Symbol(Parameters, Decl(lib.es5.d.ts, --, --)) +>Extract : Symbol(Extract, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 1, 12)) +>AnyFunction : Symbol(AnyFunction, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 0, 0)) + +interface Wrapper { +>Wrapper : Symbol(Wrapper, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 1, 53)) +>T : Symbol(T, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 3, 18)) + + call(event: K, ...args: Params): void; +>call : Symbol(Wrapper.call, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 3, 22)) +>K : Symbol(K, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 4, 6)) +>T : Symbol(T, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 3, 18)) +>event : Symbol(event, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 4, 25)) +>K : Symbol(K, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 4, 6)) +>args : Symbol(args, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 4, 34)) +>Params : Symbol(Params, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 0, 43)) +>T : Symbol(T, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 3, 18)) +>K : Symbol(K, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 4, 6)) +} + +interface AWrapped { +>AWrapped : Symbol(AWrapped, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 5, 1)) + + foo(): void; +>foo : Symbol(AWrapped.foo, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 7, 20)) +} + +class A { +>A : Symbol(A, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 9, 1)) + + foo: Wrapper; +>foo : Symbol(A.foo, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 11, 9)) +>Wrapper : Symbol(Wrapper, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 1, 53)) +>AWrapped : Symbol(AWrapped, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 5, 1)) +} + +interface BWrapped extends AWrapped { +>BWrapped : Symbol(BWrapped, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 13, 1)) +>AWrapped : Symbol(AWrapped, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 5, 1)) + + bar(): void; +>bar : Symbol(BWrapped.bar, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 15, 37)) +} + +class B extends A { +>B : Symbol(B, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 17, 1)) +>A : Symbol(A, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 9, 1)) + + foo: Wrapper; +>foo : Symbol(B.foo, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 19, 19)) +>Wrapper : Symbol(Wrapper, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 1, 53)) +>BWrapped : Symbol(BWrapped, Decl(indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts, 13, 1)) +} diff --git a/tests/baselines/reference/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.types b/tests/baselines/reference/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.types new file mode 100644 index 00000000000..2c57c390ddc --- /dev/null +++ b/tests/baselines/reference/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.types @@ -0,0 +1,39 @@ +=== tests/cases/compiler/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts === +type AnyFunction = (...args: any[]) => any; +>AnyFunction : AnyFunction +>args : any[] + +type Params = Parameters>; +>Params : Parameters> + +interface Wrapper { + call(event: K, ...args: Params): void; +>call : (event: K, ...args: Parameters>) => void +>event : K +>args : Parameters> +} + +interface AWrapped { + foo(): void; +>foo : () => void +} + +class A { +>A : A + + foo: Wrapper; +>foo : Wrapper +} + +interface BWrapped extends AWrapped { + bar(): void; +>bar : () => void +} + +class B extends A { +>B : B +>A : A + + foo: Wrapper; +>foo : Wrapper +} diff --git a/tests/cases/compiler/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts b/tests/cases/compiler/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts new file mode 100644 index 00000000000..a68ea9beee6 --- /dev/null +++ b/tests/cases/compiler/indexedAccessKeyofNestedSimplifiedSubstituteUnwrapped.ts @@ -0,0 +1,22 @@ +type AnyFunction = (...args: any[]) => any; +type Params = Parameters>; + +interface Wrapper { + call(event: K, ...args: Params): void; +} + +interface AWrapped { + foo(): void; +} + +class A { + foo: Wrapper; +} + +interface BWrapped extends AWrapped { + bar(): void; +} + +class B extends A { + foo: Wrapper; +} \ No newline at end of file From 56b6d0d6663b71588dea2cb5ccdd88ba904b0795 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Tue, 25 Feb 2020 20:47:21 -0500 Subject: [PATCH 17/17] Update user baselines (#37033) --- .../reference/docker/office-ui-fabric.log | 24 +++- tests/baselines/reference/docker/vue-next.log | 107 +++++++++++------- .../user/chrome-devtools-frontend.log | 2 +- 3 files changed, 88 insertions(+), 45 deletions(-) diff --git a/tests/baselines/reference/docker/office-ui-fabric.log b/tests/baselines/reference/docker/office-ui-fabric.log index f10d196fbbe..778cf93e3e8 100644 --- a/tests/baselines/reference/docker/office-ui-fabric.log +++ b/tests/baselines/reference/docker/office-ui-fabric.log @@ -72,6 +72,26 @@ Standard output: @fluentui/docs: [XX:XX:XX] Using gulpfile /office-ui-fabric-react/gulpfile.ts @fluentui/docs: > @fluentui/ability-attributes@X.X.X schema /office-ui-fabric-react/packages/fluentui/ability-attributes @fluentui/docs: > allyschema -c "process.env.NODE_ENV !== 'production'" schema.json > ./src/schema.ts +@fluentui/docs: DocToccing single file "/office-ui-fabric-react/.github/CONTRIBUTING.md" for github.com. +@fluentui/docs: ================== +@fluentui/docs: "/office-ui-fabric-react/.github/CONTRIBUTING.md" will be updated +@fluentui/docs: Everything is OK. +@fluentui/docs: DocToccing single file "/office-ui-fabric-react/.github/setup-local-development.md" for github.com. +@fluentui/docs: ================== +@fluentui/docs: "/office-ui-fabric-react/.github/setup-local-development.md" will be updated +@fluentui/docs: Everything is OK. +@fluentui/docs: DocToccing single file "/office-ui-fabric-react/.github/add-a-feature.md" for github.com. +@fluentui/docs: ================== +@fluentui/docs: "/office-ui-fabric-react/.github/add-a-feature.md" will be updated +@fluentui/docs: Everything is OK. +@fluentui/docs: DocToccing single file "/office-ui-fabric-react/.github/document-a-feature.md" for github.com. +@fluentui/docs: ================== +@fluentui/docs: "/office-ui-fabric-react/.github/document-a-feature.md" will be updated +@fluentui/docs: Everything is OK. +@fluentui/docs: DocToccing single file "/office-ui-fabric-react/.github/test-a-feature.md" for github.com. +@fluentui/docs: ================== +@fluentui/docs: "/office-ui-fabric-react/.github/test-a-feature.md" will be updated +@fluentui/docs: Everything is OK. @fluentui/docs: Starting type checking service... @fluentui/docs: Using 1 worker with 2048MB memory limit @fluentui/docs: [XX:XX:XX] Time: ?s @@ -95,9 +115,6 @@ Standard output: Standard error: info cli using local version of lerna -lerna notice cli vX.X.X -lerna info ci enabled -lerna info Executing command in 62 packages: "yarn run build" @fluentui/ability-attributes: npm WARN lifecycle The node binary used for scripts is but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. @uifabric/example-data: [XX:XX:XX XM] ▲ One of these [node-sass, postcss, autoprefixer] is not installed, so this task has no effect @uifabric/set-version: [XX:XX:XX XM] ▲ One of these [node-sass, postcss, autoprefixer] is not installed, so this task has no effect @@ -118,4 +135,3 @@ lerna info Executing command in 62 packages: "yarn run build" @fluentui/docs: [XX:XX:XX] 'build:docs' errored after @fluentui/docs: error Command failed with exit code 1. lerna ERR! yarn run build exited 1 in '@fluentui/docs' -lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately. diff --git a/tests/baselines/reference/docker/vue-next.log b/tests/baselines/reference/docker/vue-next.log index 8aa9b31e46e..8ddd3fd3327 100644 --- a/tests/baselines/reference/docker/vue-next.log +++ b/tests/baselines/reference/docker/vue-next.log @@ -1,7 +1,7 @@ Exit Code: 0 Standard output: -> @ build /vue-next +> @X.X.X-alpha.6 build /vue-next > node scripts/build.js "--types" Rolling up type definitions for compiler-core... Writing: /vue-next/temp/compiler-core.api.json @@ -13,6 +13,16 @@ Writing: /vue-next/temp/compiler-dom.api.json The API report is up to date: temp/compiler-dom.api.md Writing package typings: /vue-next/packages/compiler-dom/dist/compiler-dom.d.ts API Extractor completed successfully. +Rolling up type definitions for compiler-sfc... +Writing: /vue-next/temp/compiler-sfc.api.json +The API report is up to date: temp/compiler-sfc.api.md +Writing package typings: /vue-next/packages/compiler-sfc/dist/compiler-sfc.d.ts +API Extractor completed successfully. +Rolling up type definitions for compiler-ssr... +Writing: /vue-next/temp/compiler-ssr.api.json +The API report is up to date: temp/compiler-ssr.api.md +Writing package typings: /vue-next/packages/compiler-ssr/dist/compiler-ssr.d.ts +API Extractor completed successfully. Rolling up type definitions for reactivity... Writing: /vue-next/temp/reactivity.api.json The API report is up to date: temp/reactivity.api.md @@ -34,93 +44,110 @@ The API report is up to date: temp/runtime-test.api.md Writing package typings: /vue-next/packages/runtime-test/dist/runtime-test.d.ts API Extractor completed successfully. Rolling up type definitions for server-renderer... +Writing: /vue-next/temp/server-renderer.api.json +The API report is up to date: temp/server-renderer.api.md +Writing package typings: /vue-next/packages/server-renderer/dist/server-renderer.d.ts +API Extractor completed successfully. Standard error: +/vue-next/packages/compiler-core/src/index.ts → packages/compiler-core/dist/compiler-core.esm-bundler.js... +created packages/compiler-core/dist/compiler-core.esm-bundler.js in ?s /vue-next/packages/compiler-core/src/index.ts → packages/compiler-core/dist/compiler-core.cjs.js... created packages/compiler-core/dist/compiler-core.cjs.js in ?s /vue-next/packages/compiler-core/src/index.ts → packages/compiler-core/dist/compiler-core.cjs.prod.js... created packages/compiler-core/dist/compiler-core.cjs.prod.js in ?s +/vue-next/packages/compiler-dom/src/index.ts → packages/compiler-dom/dist/compiler-dom.esm-bundler.js... +created packages/compiler-dom/dist/compiler-dom.esm-bundler.js in ?s /vue-next/packages/compiler-dom/src/index.ts → packages/compiler-dom/dist/compiler-dom.cjs.js... created packages/compiler-dom/dist/compiler-dom.cjs.js in ?s /vue-next/packages/compiler-dom/src/index.ts → packages/compiler-dom/dist/compiler-dom.global.js... created packages/compiler-dom/dist/compiler-dom.global.js in ?s -/vue-next/packages/compiler-dom/src/index.ts → packages/compiler-dom/dist/compiler-dom.esm-browser.js... -created packages/compiler-dom/dist/compiler-dom.esm-browser.js in ?s +/vue-next/packages/compiler-dom/src/index.ts → packages/compiler-dom/dist/compiler-dom.esm.js... +created packages/compiler-dom/dist/compiler-dom.esm.js in ?s /vue-next/packages/compiler-dom/src/index.ts → packages/compiler-dom/dist/compiler-dom.cjs.prod.js... created packages/compiler-dom/dist/compiler-dom.cjs.prod.js in ?s /vue-next/packages/compiler-dom/src/index.ts → packages/compiler-dom/dist/compiler-dom.global.prod.js... created packages/compiler-dom/dist/compiler-dom.global.prod.js in ?s -/vue-next/packages/compiler-dom/src/index.ts → packages/compiler-dom/dist/compiler-dom.esm-browser.prod.js... -created packages/compiler-dom/dist/compiler-dom.esm-browser.prod.js in ?s -Warning: /vue-next/packages/compiler-core/src/transforms/vFor.ts:122:37 - (TS2339) Property 'codegenNode' does not exist on type 'TemplateChildNode'.; Property 'codegenNode' does not exist on type 'CompoundExpressionNode'. +/vue-next/packages/compiler-dom/src/index.ts → packages/compiler-dom/dist/compiler-dom.esm.prod.js... +created packages/compiler-dom/dist/compiler-dom.esm.prod.js in ?s +/vue-next/packages/compiler-sfc/src/index.ts → packages/compiler-sfc/dist/compiler-sfc.cjs.js... +(!) Unresolved dependencies +https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency +url (imported by packages/compiler-sfc/src/templateUtils.ts) +created packages/compiler-sfc/dist/compiler-sfc.cjs.js in ?s +/vue-next/packages/compiler-ssr/src/index.ts → packages/compiler-ssr/dist/compiler-ssr.cjs.js... +created packages/compiler-ssr/dist/compiler-ssr.cjs.js in ?s /vue-next/packages/reactivity/src/index.ts → packages/reactivity/dist/reactivity.esm-bundler.js... created packages/reactivity/dist/reactivity.esm-bundler.js in ?s /vue-next/packages/reactivity/src/index.ts → packages/reactivity/dist/reactivity.cjs.js... created packages/reactivity/dist/reactivity.cjs.js in ?s /vue-next/packages/reactivity/src/index.ts → packages/reactivity/dist/reactivity.global.js... created packages/reactivity/dist/reactivity.global.js in ?s -/vue-next/packages/reactivity/src/index.ts → packages/reactivity/dist/reactivity.esm-browser.js... -created packages/reactivity/dist/reactivity.esm-browser.js in ?s +/vue-next/packages/reactivity/src/index.ts → packages/reactivity/dist/reactivity.esm.js... +created packages/reactivity/dist/reactivity.esm.js in ?s /vue-next/packages/reactivity/src/index.ts → packages/reactivity/dist/reactivity.cjs.prod.js... created packages/reactivity/dist/reactivity.cjs.prod.js in ?s /vue-next/packages/reactivity/src/index.ts → packages/reactivity/dist/reactivity.global.prod.js... created packages/reactivity/dist/reactivity.global.prod.js in ?s -/vue-next/packages/reactivity/src/index.ts → packages/reactivity/dist/reactivity.esm-browser.prod.js... -created packages/reactivity/dist/reactivity.esm-browser.prod.js in ?s +/vue-next/packages/reactivity/src/index.ts → packages/reactivity/dist/reactivity.esm.prod.js... +created packages/reactivity/dist/reactivity.esm.prod.js in ?s /vue-next/packages/runtime-core/src/index.ts → packages/runtime-core/dist/runtime-core.esm-bundler.js... created packages/runtime-core/dist/runtime-core.esm-bundler.js in ?s /vue-next/packages/runtime-core/src/index.ts → packages/runtime-core/dist/runtime-core.cjs.js... created packages/runtime-core/dist/runtime-core.cjs.js in ?s /vue-next/packages/runtime-core/src/index.ts → packages/runtime-core/dist/runtime-core.cjs.prod.js... created packages/runtime-core/dist/runtime-core.cjs.prod.js in ?s -Warning: /vue-next/packages/compiler-core/src/transforms/vFor.ts:122:37 - (TS2339) Property 'codegenNode' does not exist on type 'TemplateChildNode'.; Property 'codegenNode' does not exist on type 'CompoundExpressionNode'. /vue-next/packages/runtime-dom/src/index.ts → packages/runtime-dom/dist/runtime-dom.esm-bundler.js... created packages/runtime-dom/dist/runtime-dom.esm-bundler.js in ?s /vue-next/packages/runtime-dom/src/index.ts → packages/runtime-dom/dist/runtime-dom.cjs.js... created packages/runtime-dom/dist/runtime-dom.cjs.js in ?s /vue-next/packages/runtime-dom/src/index.ts → packages/runtime-dom/dist/runtime-dom.global.js... created packages/runtime-dom/dist/runtime-dom.global.js in ?s -/vue-next/packages/runtime-dom/src/index.ts → packages/runtime-dom/dist/runtime-dom.esm-browser.js... -created packages/runtime-dom/dist/runtime-dom.esm-browser.js in ?s +/vue-next/packages/runtime-dom/src/index.ts → packages/runtime-dom/dist/runtime-dom.esm.js... +created packages/runtime-dom/dist/runtime-dom.esm.js in ?s /vue-next/packages/runtime-dom/src/index.ts → packages/runtime-dom/dist/runtime-dom.cjs.prod.js... created packages/runtime-dom/dist/runtime-dom.cjs.prod.js in ?s /vue-next/packages/runtime-dom/src/index.ts → packages/runtime-dom/dist/runtime-dom.global.prod.js... created packages/runtime-dom/dist/runtime-dom.global.prod.js in ?s -/vue-next/packages/runtime-dom/src/index.ts → packages/runtime-dom/dist/runtime-dom.esm-browser.prod.js... -created packages/runtime-dom/dist/runtime-dom.esm-browser.prod.js in ?s -Warning: /vue-next/packages/compiler-core/src/transforms/vFor.ts:122:37 - (TS2339) Property 'codegenNode' does not exist on type 'TemplateChildNode'.; Property 'codegenNode' does not exist on type 'CompoundExpressionNode'. -Warning: /vue-next/packages/runtime-core/src/component.ts:322:19 - (TS7006) Parameter 'err' implicitly has an 'any' type. -/vue-next/packages/runtime-test/src/index.ts → packages/runtime-test/dist/runtime-test.esm-bundler.js... -created packages/runtime-test/dist/runtime-test.esm-bundler.js in ?s -/vue-next/packages/runtime-test/src/index.ts → packages/runtime-test/dist/runtime-test.cjs.js... -created packages/runtime-test/dist/runtime-test.cjs.js in ?s +/vue-next/packages/runtime-dom/src/index.ts → packages/runtime-dom/dist/runtime-dom.esm.prod.js... +created packages/runtime-dom/dist/runtime-dom.esm.prod.js in ?s /vue-next/packages/runtime-test/src/index.ts → packages/runtime-test/dist/runtime-test.global.js... created packages/runtime-test/dist/runtime-test.global.js in ?s -/vue-next/packages/runtime-test/src/index.ts → packages/runtime-test/dist/runtime-test.cjs.prod.js... -created packages/runtime-test/dist/runtime-test.cjs.prod.js in ?s /vue-next/packages/runtime-test/src/index.ts → packages/runtime-test/dist/runtime-test.global.prod.js... created packages/runtime-test/dist/runtime-test.global.prod.js in ?s -Warning: /vue-next/packages/compiler-core/src/transforms/vFor.ts:122:37 - (TS2339) Property 'codegenNode' does not exist on type 'TemplateChildNode'.; Property 'codegenNode' does not exist on type 'CompoundExpressionNode'. -Warning: /vue-next/packages/runtime-core/src/component.ts:322:19 - (TS7006) Parameter 'err' implicitly has an 'any' type. /vue-next/packages/server-renderer/src/index.ts → packages/server-renderer/dist/server-renderer.cjs.js... -(!) Generated an empty bundle created packages/server-renderer/dist/server-renderer.cjs.js in ?s /vue-next/packages/server-renderer/src/index.ts → packages/server-renderer/dist/server-renderer.cjs.prod.js... -(!) Generated an empty bundle created packages/server-renderer/dist/server-renderer.cjs.prod.js in ?s -(node:18) UnhandledPromiseRejectionWarning: Error: Internal Error: Unable to determine module for: /vue-next/packages/server-renderer/dist/packages/server-renderer/src/index.d.ts -You have encountered a software defect. Please consider reporting the issue to the maintainers of this application. - at ExportAnalyzer._getModuleSymbolFromSourceFile (/vue-next/node_modules/@microsoft/api-extractor/lib/analyzer/ExportAnalyzer.js:146:15) - at ExportAnalyzer.fetchAstModuleFromSourceFile (/vue-next/node_modules/@microsoft/api-extractor/lib/analyzer/ExportAnalyzer.js:41:35) - at AstSymbolTable.fetchAstModuleFromWorkingPackage (/vue-next/node_modules/@microsoft/api-extractor/lib/analyzer/AstSymbolTable.js:53:37) - at Collector.analyze (/vue-next/node_modules/@microsoft/api-extractor/lib/collector/Collector.js:114:51) - at Function.invoke (/vue-next/node_modules/@microsoft/api-extractor/lib/api/Extractor.js:97:19) - at build (/vue-next/scripts/build.js:91:30) - at processTicksAndRejections (internal/process/task_queues.js:89:5) - at async buildAll (/vue-next/scripts/build.js:45:5) - at async /vue-next/scripts/build.js:35:5 -(node:18) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) -(node:18) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. +/vue-next/packages/size-check/src/index.ts → packages/size-check/dist/size-check.global.js... +created packages/size-check/dist/size-check.global.js in ?s +/vue-next/packages/size-check/src/index.ts → packages/size-check/dist/size-check.global.prod.js... +created packages/size-check/dist/size-check.global.prod.js in ?s +/vue-next/packages/template-explorer/src/index.ts → packages/template-explorer/dist/template-explorer.global.js... +created packages/template-explorer/dist/template-explorer.global.js in ?s +/vue-next/packages/vue/src/index.ts → packages/vue/dist/vue.esm-bundler.js... +[!] (plugin rpt2) Error: /vue-next/packages/vue/src/devCheck.ts(2,11): semantic error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead? +packages/vue/src/devCheck.ts +Error: /vue-next/packages/vue/src/devCheck.ts(2,11): semantic error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead? + at error (/vue-next/node_modules/rollup/dist/shared/node-entry.js:5400:30) + at throwPluginError (/vue-next/node_modules/rollup/dist/shared/node-entry.js:11874:12) + at Object.error (/vue-next/node_modules/rollup/dist/shared/node-entry.js:12908:24) + at Object.error (/vue-next/node_modules/rollup/dist/shared/node-entry.js:12077:38) + at RollupContext.error (/vue-next/node_modules/rollup-plugin-typescript2/src/rollupcontext.ts:37:18) + at /vue-next/node_modules/rollup-plugin-typescript2/src/print-diagnostics.ts:41:11 + at arrayEach (/vue-next/node_modules/rollup-plugin-typescript2/node_modules/lodash/lodash.js:516:11) + at forEach (/vue-next/node_modules/rollup-plugin-typescript2/node_modules/lodash/lodash.js:9342:14) + at _.each (/vue-next/node_modules/rollup-plugin-typescript2/src/print-diagnostics.ts:9:2) + at Object.transform (/vue-next/node_modules/rollup-plugin-typescript2/src/index.ts:234:5) +(node:17) UnhandledPromiseRejectionWarning: Error: Command failed with exit code 1 (EPERM): rollup -c --environment COMMIT:d4c6957,NODE_ENV:production,TARGET:vue,TYPES:true + at makeError (/vue-next/node_modules/execa/lib/error.js:59:11) + at handlePromise (/vue-next/node_modules/execa/index.js:112:26) + at processTicksAndRejections (internal/process/task_queues.js:97:5) + at async build (/vue-next/scripts/build.js:72:3) + at async buildAll (/vue-next/scripts/build.js:51:5) + at async run (/vue-next/scripts/build.js:41:5) +(node:17) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) +(node:17) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. diff --git a/tests/baselines/reference/user/chrome-devtools-frontend.log b/tests/baselines/reference/user/chrome-devtools-frontend.log index 11082d6201a..cac86ea489e 100644 --- a/tests/baselines/reference/user/chrome-devtools-frontend.log +++ b/tests/baselines/reference/user/chrome-devtools-frontend.log @@ -12,7 +12,7 @@ node_modules/chrome-devtools-frontend/front_end/Runtime.js(270,9): error TS2322: node_modules/chrome-devtools-frontend/front_end/Runtime.js(280,5): error TS2322: Type 'Promise' is not assignable to type 'Promise'. node_modules/chrome-devtools-frontend/front_end/Runtime.js(283,12): error TS2554: Expected 2-3 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/Runtime.js(525,9): error TS2322: Type 'Window' is not assignable to type 'Window & typeof globalThis'. - Type 'Window' is missing the following properties from type 'typeof globalThis': globalThis, eval, parseInt, parseFloat, and 872 more. + Type 'Window' is missing the following properties from type 'typeof globalThis': globalThis, eval, parseInt, parseFloat, and 871 more. node_modules/chrome-devtools-frontend/front_end/Runtime.js(527,49): error TS2352: Conversion of type 'Window & typeof globalThis' to type 'new () => any' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. Type 'Window & typeof globalThis' provides no match for the signature 'new (): any'. node_modules/chrome-devtools-frontend/front_end/Runtime.js(539,24): error TS2351: This expression is not constructable.