mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-11 08:31:29 +00:00
Compare commits
597 Commits
rr/mitropo
...
v1.4.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ddb7937ee | ||
|
|
60340bd559 | ||
|
|
923742ee83 | ||
|
|
3e9162f5f0 | ||
|
|
3115e5b332 | ||
|
|
df2d14040f | ||
|
|
3f34bc1711 | ||
|
|
034b947748 | ||
|
|
cd005cd919 | ||
|
|
d25b099029 | ||
|
|
74c8d74166 | ||
|
|
11cee19500 | ||
|
|
e578dc07b9 | ||
|
|
0a755c13af | ||
|
|
425e6db61c | ||
|
|
7bdd2785c6 | ||
|
|
e99b55ef12 | ||
|
|
c6500792b3 | ||
|
|
381e0acf80 | ||
|
|
76f9ed96bc | ||
|
|
5f83c23859 | ||
|
|
f7f249f19a | ||
|
|
36e9a00178 | ||
|
|
4d269ea7da | ||
|
|
ba0e47cdf6 | ||
|
|
9147d0d3f6 | ||
|
|
5cf27cdcae | ||
|
|
42bbf1b3f5 | ||
|
|
368846838b | ||
|
|
b6d740b760 | ||
|
|
ff6da9b85c | ||
|
|
22507b7f6c | ||
|
|
18d1e92c61 | ||
|
|
045cfb3ba7 | ||
|
|
70823f30ec | ||
|
|
386a2ea62c | ||
|
|
c45f2f0510 | ||
|
|
0491719503 | ||
|
|
f17617d601 | ||
|
|
c42aa572a8 | ||
|
|
c5b1b7bbce | ||
|
|
78e1b58bcb | ||
|
|
05d465c522 | ||
|
|
c5280b6f9d | ||
|
|
8fe31582e1 | ||
|
|
cc9bd1ad8c | ||
|
|
8584f85692 | ||
|
|
5576f34b93 | ||
|
|
c2a5111d89 | ||
|
|
86b8135ca2 | ||
|
|
df10fce902 | ||
|
|
fb178115ed | ||
|
|
4371d2f197 | ||
|
|
2d9bd91a5d | ||
|
|
05c4d16dee | ||
|
|
cbcb33421c | ||
|
|
1ce3ff18eb | ||
|
|
bfd4eac01b | ||
|
|
2e4ce37b1e | ||
|
|
0eb85c69a4 | ||
|
|
69172c053e | ||
|
|
bfb0660683 | ||
|
|
6836d0ae19 | ||
|
|
2dfd346c06 | ||
|
|
5a8c0c6d12 | ||
|
|
8b60fd7051 | ||
|
|
8509faddae | ||
|
|
c7b0b53ee9 | ||
|
|
1fe66ec082 | ||
|
|
31cb13accd | ||
|
|
45cc2a2289 | ||
|
|
40a896cde6 | ||
|
|
d2f2330f13 | ||
|
|
435668a0cc | ||
|
|
ee2938c66b | ||
|
|
61d4cac329 | ||
|
|
1fb8f05c8b | ||
|
|
82895723a2 | ||
|
|
b35465dd1a | ||
|
|
662874ba59 | ||
|
|
14b1bb596f | ||
|
|
f789df4792 | ||
|
|
a9dec2824d | ||
|
|
bce77bc170 | ||
|
|
5772a53a63 | ||
|
|
4732b74781 | ||
|
|
d8a357cce3 | ||
|
|
847dbf212f | ||
|
|
11a9a992b2 | ||
|
|
e06be4a7e3 | ||
|
|
d75ce04357 | ||
|
|
5b82d231f8 | ||
|
|
6c5cb2edf2 | ||
|
|
5d1727b681 | ||
|
|
c6373987a9 | ||
|
|
f7018888b4 | ||
|
|
a6c2ad9995 | ||
|
|
e79ad8c99f | ||
|
|
b924a02c52 | ||
|
|
a7bd0a7ff4 | ||
|
|
0b98e83754 | ||
|
|
5c6b18c6bd | ||
|
|
47969e77dd | ||
|
|
0bf839b830 | ||
|
|
4e957a206b | ||
|
|
0e55d6d3ec | ||
|
|
ca4284b3c4 | ||
|
|
0e2f666d19 | ||
|
|
15ab6ede2c | ||
|
|
76f1b02ba5 | ||
|
|
ab8c862e85 | ||
|
|
7e0df1e777 | ||
|
|
f4244f2dda | ||
|
|
7cdc5ba275 | ||
|
|
d8b3b6fd78 | ||
|
|
cc73268daa | ||
|
|
325b6dfd9a | ||
|
|
feb0767cb1 | ||
|
|
8ed2dec1cc | ||
|
|
df00daa5ae | ||
|
|
9858d1fe67 | ||
|
|
daade4ea5d | ||
|
|
b395a4d270 | ||
|
|
f5dd22127f | ||
|
|
f86992cd75 | ||
|
|
f559b5d54b | ||
|
|
02c4aab112 | ||
|
|
f3f7547e30 | ||
|
|
059f496bad | ||
|
|
876dda6a96 | ||
|
|
c6749451c2 | ||
|
|
af80a0a8cd | ||
|
|
47a1822123 | ||
|
|
20674b1376 | ||
|
|
f57adc266a | ||
|
|
721ee7e3c7 | ||
|
|
6d0c3d4dcd | ||
|
|
1f4b9d894e | ||
|
|
a50a5bef27 | ||
|
|
fd19ee374b | ||
|
|
dc6788629b | ||
|
|
0a341d303f | ||
|
|
a42b6a4d41 | ||
|
|
f5fce1e302 | ||
|
|
bd117ce800 | ||
|
|
8fcf688905 | ||
|
|
74fb25edb6 | ||
|
|
868e9f3147 | ||
|
|
06bf203e05 | ||
|
|
12c60d9544 | ||
|
|
9cad15b462 | ||
|
|
5ecc1c16a5 | ||
|
|
007ba7dbfb | ||
|
|
c66f0deff9 | ||
|
|
0d5b8c569c | ||
|
|
5c4a1b2552 | ||
|
|
67703add94 | ||
|
|
da1a51ce3a | ||
|
|
d10a570203 | ||
|
|
0701ea57c7 | ||
|
|
61e55c9b4b | ||
|
|
074bff4dc6 | ||
|
|
a2c0e81baa | ||
|
|
0a8b4c6996 | ||
|
|
17e210e19c | ||
|
|
8ae480aa4c | ||
|
|
4d7eeccdf6 | ||
|
|
055d2fff1f | ||
|
|
7620dffee4 | ||
|
|
2068d07908 | ||
|
|
b08c7eff38 | ||
|
|
e5cce3f3d9 | ||
|
|
f580653740 | ||
|
|
b332174f91 | ||
|
|
c5ecb60ed3 | ||
|
|
8a4e99a718 | ||
|
|
12a338fa52 | ||
|
|
70b98018c3 | ||
|
|
37a67d85fd | ||
|
|
feee61b1e3 | ||
|
|
613898bf16 | ||
|
|
68bb96ddaf | ||
|
|
503f8f63da | ||
|
|
1a140ddf58 | ||
|
|
d2cfabb210 | ||
|
|
69e45061a0 | ||
|
|
46e4a21dfd | ||
|
|
2b73400c8f | ||
|
|
c6f342bd9e | ||
|
|
46f0c39c58 | ||
|
|
181ecb9e19 | ||
|
|
a8cdf4bd88 | ||
|
|
e8ef514f4b | ||
|
|
d54243609c | ||
|
|
34bcc97160 | ||
|
|
fc5328d7a6 | ||
|
|
cf9a881a3f | ||
|
|
40e29a34b8 | ||
|
|
30b9f63146 | ||
|
|
aa3eb2e3a0 | ||
|
|
91272d042f | ||
|
|
02b4836c17 | ||
|
|
b342422959 | ||
|
|
c28533aa61 | ||
|
|
da924219c0 | ||
|
|
7ac36eff82 | ||
|
|
60a9629b2f | ||
|
|
66c5b58420 | ||
|
|
aa1f689b2f | ||
|
|
5fb57511ca | ||
|
|
ede7737348 | ||
|
|
6c8544aa97 | ||
|
|
42a4f70294 | ||
|
|
189dba39a6 | ||
|
|
2c2799e531 | ||
|
|
fa274e03dd | ||
|
|
e341ba30c0 | ||
|
|
94d334d92c | ||
|
|
700234ed2a | ||
|
|
64aa5dcd70 | ||
|
|
24a4229d70 | ||
|
|
b2c7055892 | ||
|
|
5f8b0ffc8d | ||
|
|
0e43040535 | ||
|
|
4f130321c1 | ||
|
|
29feb78fbc | ||
|
|
4d659a4d47 | ||
|
|
d40d50922a | ||
|
|
72de5447d6 | ||
|
|
9940ef685b | ||
|
|
d5b276a80b | ||
|
|
ef9b309d27 | ||
|
|
70ef0b2e4b | ||
|
|
1a05fc023f | ||
|
|
e505271225 | ||
|
|
3b96519d68 | ||
|
|
7ea0a2918c | ||
|
|
55c2a888b1 | ||
|
|
57efee8d79 | ||
|
|
a386d5c351 | ||
|
|
57284816c3 | ||
|
|
f0ab9358ba | ||
|
|
0cb3c647c2 | ||
|
|
a62a563477 | ||
|
|
669092bf63 | ||
|
|
aeb93f5a3f | ||
|
|
e277fd793d | ||
|
|
765f62e2e2 | ||
|
|
434d13f131 | ||
|
|
0c999107be | ||
|
|
e0f0f5da8d | ||
|
|
0bd70f877f | ||
|
|
0c468e17e0 | ||
|
|
16ca988f24 | ||
|
|
611fa3a290 | ||
|
|
a74b2f1507 | ||
|
|
904f154cbf | ||
|
|
59edd8dd20 | ||
|
|
6f72dedd3c | ||
|
|
c3106be503 | ||
|
|
38ba0cd93a | ||
|
|
34ca070553 | ||
|
|
00dc4046c1 | ||
|
|
60d415fd3a | ||
|
|
b4865998de | ||
|
|
4239214520 | ||
|
|
b5b78d897c | ||
|
|
fb7f14c551 | ||
|
|
4140b38c31 | ||
|
|
ad1cadb94e | ||
|
|
83d0043a5f | ||
|
|
b97156094e | ||
|
|
85e3ad5bef | ||
|
|
4e959a5d3c | ||
|
|
ad5df77251 | ||
|
|
2ff4dd0891 | ||
|
|
3255debef3 | ||
|
|
8d218aefc4 | ||
|
|
4a6c5efd5c | ||
|
|
84471282b7 | ||
|
|
9e7a4af91d | ||
|
|
1d3559bac5 | ||
|
|
0f195bf65d | ||
|
|
2c8344a339 | ||
|
|
2cb0e1584c | ||
|
|
f8dd945c4b | ||
|
|
54b6519694 | ||
|
|
9eeb024fa5 | ||
|
|
6ea35d3934 | ||
|
|
51e977fd3d | ||
|
|
65806649a6 | ||
|
|
02df11bae8 | ||
|
|
1ba824af44 | ||
|
|
5883ee1328 | ||
|
|
64be011d49 | ||
|
|
81b78aeece | ||
|
|
d70a675e9e | ||
|
|
8d9949f62f | ||
|
|
e341065bef | ||
|
|
00fb7058b7 | ||
|
|
e6b271b7d6 | ||
|
|
a977e8ea09 | ||
|
|
9b572295ca | ||
|
|
2d9152b639 | ||
|
|
32b9f83b3a | ||
|
|
3a0b98fe6e | ||
|
|
844c58e67a | ||
|
|
94b8ea4837 | ||
|
|
83877b33e8 | ||
|
|
9cef58cefd | ||
|
|
454dced6bb | ||
|
|
26bcd82400 | ||
|
|
b71942b3dd | ||
|
|
8a10a21712 | ||
|
|
5804ca3437 | ||
|
|
587e418ba2 | ||
|
|
a3550c95b7 | ||
|
|
144a66347f | ||
|
|
ee20744fae | ||
|
|
d1f8f27b75 | ||
|
|
a372aa2073 | ||
|
|
05c07032ee | ||
|
|
127156042b | ||
|
|
5e6af8ee02 | ||
|
|
95276fc13b | ||
|
|
bb87e7817c | ||
|
|
8cbd4d1240 | ||
|
|
f2d2bafd56 | ||
|
|
9c34419a77 | ||
|
|
c168083ab6 | ||
|
|
971142721e | ||
|
|
214913d21f | ||
|
|
11e2baac78 | ||
|
|
a1b28fd6ce | ||
|
|
abc6ca2b37 | ||
|
|
8e2e1f63c7 | ||
|
|
87aa084225 | ||
|
|
1f04feddf3 | ||
|
|
3ad6d5ca35 | ||
|
|
51333d4d0b | ||
|
|
595927f687 | ||
|
|
bff86a335e | ||
|
|
c0c91460d0 | ||
|
|
2e114dcf35 | ||
|
|
7fa8e68ca8 | ||
|
|
923b736f37 | ||
|
|
5b27cf679f | ||
|
|
fb9ab023e3 | ||
|
|
cb18fc8893 | ||
|
|
a30370bdcd | ||
|
|
2fc3c11f32 | ||
|
|
100b9314cf | ||
|
|
de5cfa0812 | ||
|
|
42a7b1ad45 | ||
|
|
4272180ad3 | ||
|
|
e28b0cbdc3 | ||
|
|
c657aa5f56 | ||
|
|
b403081a2f | ||
|
|
bb4a35a788 | ||
|
|
276fb265a8 | ||
|
|
a13faab02b | ||
|
|
150c958782 | ||
|
|
130d401184 | ||
|
|
44930a59fa | ||
|
|
6e7a79bc16 | ||
|
|
a2e3166f3e | ||
|
|
c5068c2296 | ||
|
|
8d8861b887 | ||
|
|
06e1550924 | ||
|
|
8f8f901b2e | ||
|
|
2321ddad79 | ||
|
|
cf2a554c78 | ||
|
|
1ed04ff939 | ||
|
|
e32308af02 | ||
|
|
e126402267 | ||
|
|
c575dae3d9 | ||
|
|
32606dbd16 | ||
|
|
3ddfd706a3 | ||
|
|
d43975d55a | ||
|
|
c15b9128a7 | ||
|
|
486b910963 | ||
|
|
9b5c01ad6a | ||
|
|
5c44096828 | ||
|
|
4aed5fc5fc | ||
|
|
75acd603e4 | ||
|
|
6dae86aa51 | ||
|
|
984d3cd736 | ||
|
|
f2a8e6a9cd | ||
|
|
4ac0fa2e95 | ||
|
|
e5544069f7 | ||
|
|
c93c6e5d16 | ||
|
|
f7806558c0 | ||
|
|
1997bb5207 | ||
|
|
c9215ba09f | ||
|
|
b4aeb89b55 | ||
|
|
ee2c3b27e2 | ||
|
|
cdfb17bea8 | ||
|
|
942173f3ee | ||
|
|
463da96885 | ||
|
|
4ccf107ba1 | ||
|
|
ae33b3c281 | ||
|
|
7a1b045fea | ||
|
|
9afbcb3f54 | ||
|
|
91b242d8a6 | ||
|
|
c5768e2ad0 | ||
|
|
17f852e4b4 | ||
|
|
e601006043 | ||
|
|
8af22c9c35 | ||
|
|
7fe7f5e50a | ||
|
|
84d27b4710 | ||
|
|
d9a03db329 | ||
|
|
68864eaf72 | ||
|
|
2fa26fefa0 | ||
|
|
3d3a9ad0b8 | ||
|
|
0bd07c51db | ||
|
|
2c2f22cc90 | ||
|
|
fbd3092bbb | ||
|
|
9f081cfeaa | ||
|
|
55747fb64f | ||
|
|
8cae8fcc10 | ||
|
|
5a7ef83963 | ||
|
|
90f3ed5a1e | ||
|
|
65969b4018 | ||
|
|
c88c8ae145 | ||
|
|
d14795139f | ||
|
|
85e512faab | ||
|
|
d3f5725e75 | ||
|
|
efe47e8573 | ||
|
|
45c87dc15a | ||
|
|
61c0261b94 | ||
|
|
247453df3b | ||
|
|
c5661daa72 | ||
|
|
56c2495999 | ||
|
|
e6d5fdc81f | ||
|
|
f7f4a7d532 | ||
|
|
e9637abb24 | ||
|
|
d98e3a4d08 | ||
|
|
855ff3d4cd | ||
|
|
b39f184868 | ||
|
|
133b4cbf1a | ||
|
|
61ae186631 | ||
|
|
38de675fef | ||
|
|
3393a222df | ||
|
|
74b3af0a2c | ||
|
|
3957be447a | ||
|
|
a37df6ec3f | ||
|
|
bf40aaf596 | ||
|
|
7088aabc6b | ||
|
|
19ddaf5089 | ||
|
|
ea29eb9ec2 | ||
|
|
14b3b3c7a3 | ||
|
|
098921a249 | ||
|
|
4685c99cbd | ||
|
|
168e1e00cf | ||
|
|
78d6ce2672 | ||
|
|
af203f1a70 | ||
|
|
cd469bcaf5 | ||
|
|
c818a33b29 | ||
|
|
da0c5a867c | ||
|
|
24f8c14b8c | ||
|
|
9f07c0c568 | ||
|
|
5d5c83f26d | ||
|
|
4cd3459bc3 | ||
|
|
88817213ee | ||
|
|
c0cbe42165 | ||
|
|
7579d19fb4 | ||
|
|
433983cd00 | ||
|
|
62d508c024 | ||
|
|
654644519d | ||
|
|
b202b183fe | ||
|
|
9c869ef21b | ||
|
|
d6b710edef | ||
|
|
25436a5ae2 | ||
|
|
1ec64d23e1 | ||
|
|
66770a3026 | ||
|
|
3810278af2 | ||
|
|
db83afe407 | ||
|
|
7356a66ae0 | ||
|
|
a5972eb0cf | ||
|
|
20b6ec857a | ||
|
|
4ec68832eb | ||
|
|
386645d9ef | ||
|
|
a52bde34aa | ||
|
|
69bca4f0fe | ||
|
|
23bcd4b247 | ||
|
|
2343845ce7 | ||
|
|
133626fb1d | ||
|
|
045d502005 | ||
|
|
559612e5c0 | ||
|
|
06c071c158 | ||
|
|
999ed15719 | ||
|
|
702d7c3722 | ||
|
|
dac21d9fbc | ||
|
|
39bf821844 | ||
|
|
268d42a2fd | ||
|
|
85b823fba3 | ||
|
|
0c2824f1cc | ||
|
|
be8983ee34 | ||
|
|
62b6c9a277 | ||
|
|
d324cd91c1 | ||
|
|
e9d3faffec | ||
|
|
4843d998ea | ||
|
|
362ea857de | ||
|
|
3689f76e22 | ||
|
|
0a19571d5d | ||
|
|
ec84ae6dfa | ||
|
|
a00a85869c | ||
|
|
8ddc96778e | ||
|
|
861e20267f | ||
|
|
c6316ddf77 | ||
|
|
e70e8fd10b | ||
|
|
5df39478f6 | ||
|
|
245ce4b114 | ||
|
|
a4ca2b8618 | ||
|
|
a85e4fbf0b | ||
|
|
e87abaee3b | ||
|
|
1f9a5834c3 | ||
|
|
5ab46e9f6c | ||
|
|
4d37e55fa7 | ||
|
|
0763a6d20b | ||
|
|
61ede55319 | ||
|
|
f66ab1d1f9 | ||
|
|
eb24189adb | ||
|
|
6e73a708fe | ||
|
|
748fb7307c | ||
|
|
2f2b9fec50 | ||
|
|
4602865376 | ||
|
|
b6be9bed04 | ||
|
|
4fe6ea243b | ||
|
|
2c4221d75b | ||
|
|
3364b9f0ac | ||
|
|
0ca7c542c9 | ||
|
|
a7cf8b656c | ||
|
|
fcbf587434 | ||
|
|
59130061c0 | ||
|
|
01983eeee1 | ||
|
|
610ea3d53f | ||
|
|
9214ee454e | ||
|
|
e0e9518bb8 | ||
|
|
e540cfd1a5 | ||
|
|
a027df67c1 | ||
|
|
b860872df5 | ||
|
|
b03970ba08 | ||
|
|
500414ae5a | ||
|
|
bd1dcb72e3 | ||
|
|
7ca0547d1d | ||
|
|
311df7bcb0 | ||
|
|
ae6e459015 | ||
|
|
0e45def480 | ||
|
|
7990399e0d | ||
|
|
15bbac7e75 | ||
|
|
5aa7adcd01 | ||
|
|
123c3e4c78 | ||
|
|
c2495dbe5f | ||
|
|
2d78aa2148 | ||
|
|
bc34d69d56 | ||
|
|
b74e24b819 | ||
|
|
47e76c260b | ||
|
|
441e86e892 | ||
|
|
14cd518aa9 | ||
|
|
74b35939fa | ||
|
|
8d91ce5774 | ||
|
|
dc2440185b | ||
|
|
2262f0a4ef | ||
|
|
65b282bada | ||
|
|
a62fbd7fa1 | ||
|
|
d08260d60c | ||
|
|
56cf876cb8 | ||
|
|
61f8953bd3 | ||
|
|
b185884005 | ||
|
|
eba09719d2 | ||
|
|
70e928f4d9 | ||
|
|
7029e78ca2 | ||
|
|
a394de00c5 | ||
|
|
d29251f507 | ||
|
|
e61f5956cb | ||
|
|
740bbaeb8c | ||
|
|
6851607a04 | ||
|
|
5b5684cd5d | ||
|
|
a6a9427757 | ||
|
|
52dace2970 | ||
|
|
3716d2c4e7 | ||
|
|
4f96393f14 | ||
|
|
6995eb87df | ||
|
|
f94653fd49 | ||
|
|
007b3d97d6 | ||
|
|
b8918eab5d | ||
|
|
aaa2747a4e | ||
|
|
5c40432b4e | ||
|
|
6fe1c56c32 | ||
|
|
130eeff06e | ||
|
|
385498aa78 | ||
|
|
6ec97cc85f | ||
|
|
328db2f0bf | ||
|
|
357203fb11 | ||
|
|
f8693209ab | ||
|
|
1e9ee7014b |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -58,5 +58,4 @@ kotlin-ultimate/
|
||||
node_modules/
|
||||
.rpt2_cache/
|
||||
libraries/tools/kotlin-test-js-runner/lib/
|
||||
libraries/tools/kotlin-source-map-loader/lib/
|
||||
local.properties
|
||||
|
||||
15
.idea/codeStyles/Project.xml
generated
15
.idea/codeStyles/Project.xml
generated
@@ -13,6 +13,21 @@
|
||||
</option>
|
||||
</JavaCodeStyleSettings>
|
||||
<JetCodeStyleSettings>
|
||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||
<value>
|
||||
<package name="java.util" alias="false" withSubpackages="false" />
|
||||
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="PACKAGES_IMPORT_LAYOUT">
|
||||
<value>
|
||||
<package name="" alias="false" withSubpackages="true" />
|
||||
<package name="java" alias="false" withSubpackages="true" />
|
||||
<package name="javax" alias="false" withSubpackages="true" />
|
||||
<package name="kotlin" alias="false" withSubpackages="true" />
|
||||
<package name="" alias="true" withSubpackages="true" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</JetCodeStyleSettings>
|
||||
<MarkdownNavigatorCodeStyleSettings>
|
||||
|
||||
21
.idea/runConfigurations/Test__stdlib_js_public_kotlin_api_test__overwrite_results.xml
generated
Normal file
21
.idea/runConfigurations/Test__stdlib_js_public_kotlin_api_test__overwrite_results.xml
generated
Normal file
@@ -0,0 +1,21 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Test: stdlib-js public kotlin api test, overwrite results" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="--tests "org.jetbrains.kotlin.js.test.ApiTest" -Poverwrite.output=true" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value=":js:js.tests:test" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" value="" />
|
||||
</ExternalSystemSettings>
|
||||
<GradleScriptDebugEnabled>false</GradleScriptDebugEnabled>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
2
.idea/scopes/Apply_copyright.xml
generated
2
.idea/scopes/Apply_copyright.xml
generated
@@ -1,3 +1,3 @@
|
||||
<component name="DependencyValidationManager">
|
||||
<scope name="Apply copyright" pattern="!file[*]:*//testData//*&&!file[*]:testData//*&&!file[*]:*.gradle.kts&&!file[*]:*.gradle" />
|
||||
<scope name="Apply copyright" pattern="!file[*]:*//testData//*&&!file[*]:testData//*&&!file[*]:*.gradle.kts&&!file[*]:*.gradle&&!file[kotlin.kotlin-ultimate]:*/&&!file[kotlin.kotlin-ultimate.*]:*/&&!file[kotlin.libraries]:stdlib/api//*" />
|
||||
</component>
|
||||
11102
ChangeLog.md
11102
ChangeLog.md
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.compilerRunner
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
|
||||
@@ -25,7 +25,7 @@ class MessageCollectorToOutputItemsCollectorAdapter(
|
||||
private val delegate: MessageCollector,
|
||||
private val outputCollector: OutputItemsCollector
|
||||
) : MessageCollector by delegate {
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
|
||||
// TODO: consider adding some other way of passing input -> output mapping from compiler, e.g. dedicated service
|
||||
OutputMessageUtil.parseOutputMessage(message)?.let {
|
||||
outputCollector.add(it.sourceFiles, it.outputFile)
|
||||
|
||||
@@ -187,7 +187,7 @@ extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
|
||||
extra["versions.ktor-network"] = "1.0.1"
|
||||
|
||||
if (!project.hasProperty("versions.kotlin-native")) {
|
||||
extra["versions.kotlin-native"] = "1.4-M3-dev-15627"
|
||||
extra["versions.kotlin-native"] = "1.4"
|
||||
}
|
||||
|
||||
val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled)
|
||||
@@ -200,7 +200,11 @@ extra["intellijSeparateSdks"] = intellijSeparateSdks
|
||||
|
||||
extra["IntellijCoreDependencies"] =
|
||||
listOf(
|
||||
if (Platform[191].orHigher()) "asm-all-7.0.1" else "asm-all",
|
||||
when {
|
||||
Platform[202].orHigher() -> "asm-all-8.0.1"
|
||||
Platform[191].orHigher() -> "asm-all-7.0.1"
|
||||
else -> "asm-all"
|
||||
},
|
||||
"guava",
|
||||
"jdom",
|
||||
"jna",
|
||||
|
||||
@@ -105,7 +105,7 @@ dependencies {
|
||||
|
||||
implementation("com.github.jengelman.gradle.plugins:shadow:${rootProject.extra["versions.shadow"]}")
|
||||
implementation("net.sf.proguard:proguard-gradle:6.2.2")
|
||||
implementation("org.jetbrains.intellij.deps:asm-all:7.0.1")
|
||||
implementation("org.jetbrains.intellij.deps:asm-all:8.0.1")
|
||||
|
||||
implementation("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:0.5")
|
||||
}
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress("unused")
|
||||
|
||||
// usages in build scripts are not tracked properly
|
||||
@@ -97,9 +102,11 @@ fun Project.kotlinStdlib(suffix: String? = null, classifier: String? = null): An
|
||||
dependencies.project(listOfNotNull(":kotlin-stdlib", suffix).joinToString("-"), classifier)
|
||||
}
|
||||
|
||||
fun Project.kotlinBuiltins(): Any =
|
||||
fun Project.kotlinBuiltins(): Any = kotlinBuiltins(forJvm = false)
|
||||
|
||||
fun Project.kotlinBuiltins(forJvm: Boolean): Any =
|
||||
if (kotlinBuildProperties.useBootstrapStdlib) "org.jetbrains.kotlin:builtins:$bootstrapKotlinVersion"
|
||||
else dependencies.project(":core:builtins")
|
||||
else dependencies.project(":core:builtins", configuration = "runtimeElementsJvm".takeIf { forJvm })
|
||||
|
||||
fun DependencyHandler.projectTests(name: String): ProjectDependency = project(name, configuration = "tests-jar")
|
||||
fun DependencyHandler.projectRuntimeJar(name: String): ProjectDependency = project(name, configuration = "runtimeJar")
|
||||
|
||||
@@ -46,6 +46,7 @@ open class PublishedKotlinModule : Plugin<Project> {
|
||||
configure<SigningExtension> {
|
||||
isRequired = signingRequired
|
||||
sign(configurations["archives"])
|
||||
useGpgCmd()
|
||||
}
|
||||
|
||||
tasks.named<Sign>("signArchives").configure {
|
||||
|
||||
@@ -108,6 +108,10 @@ fun Project.projectTest(
|
||||
systemProperty("kotlin.ni", if (rootProject.hasProperty("newInferenceTests")) "true" else "false")
|
||||
systemProperty("org.jetbrains.kotlin.skip.muted.tests", if (rootProject.hasProperty("skipMutedTests")) "true" else "false")
|
||||
|
||||
if (Platform[202].orHigher()) {
|
||||
systemProperty("idea.ignore.disabled.plugins", "true")
|
||||
}
|
||||
|
||||
var subProjectTempRoot: Path? = null
|
||||
doFirst {
|
||||
val teamcity = rootProject.findProperty("teamcity") as? Map<Any?, *>
|
||||
|
||||
@@ -29,7 +29,13 @@ dependencies {
|
||||
testCompile(intellijDep()) { includeJars("openapi", rootProject = rootProject) }
|
||||
}
|
||||
|
||||
testCompile(intellijDep()) { includeJars("util", "idea", "idea_rt", "groovy-all", rootProject = rootProject) }
|
||||
testCompile(intellijDep()) { includeJars("util", "idea", "idea_rt", rootProject = rootProject) }
|
||||
Platform[202].orHigher {
|
||||
testCompile(intellijDep()) { includeJars("groovy", rootProject = rootProject) }
|
||||
}
|
||||
Platform[201].orLower {
|
||||
testCompile(intellijDep()) { includeJars("groovy-all", rootProject = rootProject) }
|
||||
}
|
||||
Platform[191].orLower {
|
||||
testCompile(intellijDep()) { includeJars("jps-builders") }
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
val kind = KotlinBaseTest.extractConfigurationKind(testFiles)
|
||||
val jdkKind = KotlinBaseTest.getTestJdkKind(testFiles)
|
||||
val keyConfiguration = CompilerConfiguration()
|
||||
CodegenTestCase.updateConfigurationByDirectivesInTestFiles(testFiles, keyConfiguration)
|
||||
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, keyConfiguration)
|
||||
|
||||
val key = ConfigurationKey(kind, jdkKind, keyConfiguration.toString())
|
||||
val compiler = if (isJvm8Target) {
|
||||
@@ -303,7 +303,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
val filesHolder = holders.getOrPut(key) {
|
||||
FilesWriter(compiler, KotlinTestUtils.newConfiguration(kind, jdkKind, KotlinTestUtils.getAnnotationsJar()).apply {
|
||||
println("Creating new configuration by $key")
|
||||
CodegenTestCase.updateConfigurationByDirectivesInTestFiles(testFiles, this)
|
||||
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, this)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.backend.common
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.backend.common.bridges.findInterfaceImplementation
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
@@ -24,6 +23,7 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.multiplatform.ExpectedActualResolver
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.util.getExceptionMessage
|
||||
import org.jetbrains.kotlin.util.getNonPrivateTraitMembersForDelegation
|
||||
import org.jetbrains.kotlin.utils.DFS
|
||||
import org.jetbrains.kotlin.utils.KotlinExceptionWithAttachments
|
||||
|
||||
@@ -55,14 +55,8 @@ object CodegenUtil {
|
||||
@JvmOverloads
|
||||
fun getNonPrivateTraitMethods(descriptor: ClassDescriptor, copy: Boolean = true): Map<FunctionDescriptor, FunctionDescriptor> {
|
||||
val result = linkedMapOf<FunctionDescriptor, FunctionDescriptor>()
|
||||
for (declaration in DescriptorUtils.getAllDescriptors(descriptor.defaultType.memberScope)) {
|
||||
if (declaration !is CallableMemberDescriptor) continue
|
||||
|
||||
val traitMember = findInterfaceImplementation(declaration)
|
||||
if (traitMember == null ||
|
||||
Visibilities.isPrivate(traitMember.visibility) ||
|
||||
traitMember.visibility == Visibilities.INVISIBLE_FAKE) continue
|
||||
|
||||
for ((declaration, traitMember) in getNonPrivateTraitMembersForDelegation(descriptor)) {
|
||||
assert(traitMember.modality !== Modality.ABSTRACT) { "Cannot delegate to abstract trait method: $declaration" }
|
||||
|
||||
// inheritedMember can be abstract here. In order for FunctionCodegen to generate the method body, we're creating a copy here
|
||||
@@ -93,20 +87,18 @@ object CodegenUtil {
|
||||
private fun mapMembers(
|
||||
inherited: CallableMemberDescriptor,
|
||||
traitMember: CallableMemberDescriptor
|
||||
): LinkedHashMap<FunctionDescriptor, FunctionDescriptor> {
|
||||
val result = linkedMapOf<FunctionDescriptor, FunctionDescriptor>()
|
||||
if (traitMember is SimpleFunctionDescriptor) {
|
||||
result[traitMember] = inherited as FunctionDescriptor
|
||||
} else if (traitMember is PropertyDescriptor) {
|
||||
): Map<FunctionDescriptor, FunctionDescriptor> = when (traitMember) {
|
||||
is SimpleFunctionDescriptor -> mapOf(traitMember to inherited as FunctionDescriptor)
|
||||
is PropertyDescriptor -> linkedMapOf<FunctionDescriptor, FunctionDescriptor>().also { result ->
|
||||
for (traitAccessor in traitMember.accessors) {
|
||||
for (inheritedAccessor in (inherited as PropertyDescriptor).accessors) {
|
||||
if (inheritedAccessor::class.java == traitAccessor::class.java) { // same accessor kind
|
||||
result.put(traitAccessor, inheritedAccessor)
|
||||
if ((inheritedAccessor is PropertyGetterDescriptor) == (traitAccessor is PropertyGetterDescriptor)) {
|
||||
result[traitAccessor] = inheritedAccessor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
else -> error("Unexpected member: $inherited")
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
|
||||
@@ -24,6 +24,8 @@ import org.jetbrains.kotlin.resolve.OverridingUtil
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.isOrOverridesSynthesized
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.isTypeRefinementEnabled
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
||||
import org.jetbrains.kotlin.util.findImplementationFromInterface
|
||||
import org.jetbrains.kotlin.util.findInterfaceImplementation
|
||||
|
||||
fun <Signature> generateBridgesForFunctionDescriptor(
|
||||
descriptor: FunctionDescriptor,
|
||||
@@ -81,60 +83,4 @@ open class DescriptorBasedFunctionHandle(val descriptor: FunctionDescriptor) : F
|
||||
override fun toString(): String {
|
||||
return descriptor.toString()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Given a fake override in a class, returns an overridden declaration with implementation in trait, such that a method delegating to that
|
||||
* trait implementation should be generated into the class containing the fake override; or null if the given function is not a fake
|
||||
* override of any trait implementation or such method was already generated into the superclass or is a method from Any.
|
||||
*/
|
||||
fun findInterfaceImplementation(descriptor: CallableMemberDescriptor): CallableMemberDescriptor? {
|
||||
if (descriptor.kind.isReal) return null
|
||||
if (isOrOverridesSynthesized(descriptor)) return null
|
||||
|
||||
val implementation = findImplementationFromInterface(descriptor) ?: return null
|
||||
val immediateConcreteSuper = firstSuperMethodFromKotlin(descriptor, implementation) ?: return null
|
||||
|
||||
if (!DescriptorUtils.isInterface(immediateConcreteSuper.containingDeclaration)) {
|
||||
// If this implementation is already generated into the superclass, we need not generate it again, it'll be inherited
|
||||
return null
|
||||
}
|
||||
|
||||
return immediateConcreteSuper
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a fake override, returns an overridden non-abstract function from an interface which is the actual implementation of this function
|
||||
* that should be called when the given fake override is called.
|
||||
*/
|
||||
fun findImplementationFromInterface(descriptor: CallableMemberDescriptor): CallableMemberDescriptor? {
|
||||
val overridden = OverridingUtil.getOverriddenDeclarations(descriptor)
|
||||
val filtered = OverridingUtil.filterOutOverridden(overridden)
|
||||
|
||||
val result = filtered.firstOrNull { it.modality != Modality.ABSTRACT } ?: return null
|
||||
|
||||
if (DescriptorUtils.isClassOrEnumClass(result.containingDeclaration)) return null
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a fake override and its implementation (non-abstract declaration) somewhere in supertypes,
|
||||
* returns the first immediate super function of the given fake override which overrides that implementation.
|
||||
* The returned function should be called from TImpl-bridges generated for the given fake override.
|
||||
*/
|
||||
fun firstSuperMethodFromKotlin(
|
||||
descriptor: CallableMemberDescriptor,
|
||||
implementation: CallableMemberDescriptor
|
||||
): CallableMemberDescriptor? {
|
||||
return descriptor.overriddenDescriptors.firstOrNull { overridden ->
|
||||
overridden.modality != Modality.ABSTRACT &&
|
||||
(overridden == implementation || OverridingUtil.overrides(
|
||||
overridden,
|
||||
implementation,
|
||||
overridden.module.isTypeRefinementEnabled(),
|
||||
true
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,6 +105,15 @@ public abstract class AnnotationCodegen {
|
||||
@Nullable Annotated annotated,
|
||||
@Nullable Type returnType,
|
||||
@Nullable KotlinType typeForTypeAnnotations
|
||||
) {
|
||||
genAnnotations(annotated, returnType, typeForTypeAnnotations, null);
|
||||
}
|
||||
|
||||
public void genAnnotations(
|
||||
@Nullable Annotated annotated,
|
||||
@Nullable Type returnType,
|
||||
@Nullable KotlinType typeForTypeAnnotations,
|
||||
@Nullable DeclarationDescriptorWithVisibility parameterContainer
|
||||
) {
|
||||
if (annotated == null) return;
|
||||
|
||||
@@ -139,22 +148,23 @@ public abstract class AnnotationCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
generateAdditionalAnnotations(annotated, returnType, annotationDescriptorsAlreadyPresent);
|
||||
generateAdditionalAnnotations(annotated, returnType, annotationDescriptorsAlreadyPresent, parameterContainer);
|
||||
generateTypeAnnotations(annotated, typeForTypeAnnotations);
|
||||
}
|
||||
|
||||
private void generateAdditionalAnnotations(
|
||||
@NotNull Annotated annotated,
|
||||
@Nullable Type returnType,
|
||||
@NotNull Set<String> annotationDescriptorsAlreadyPresent
|
||||
@NotNull Set<String> annotationDescriptorsAlreadyPresent,
|
||||
@Nullable DeclarationDescriptorWithVisibility parameterContainer
|
||||
) {
|
||||
if (annotated instanceof CallableDescriptor) {
|
||||
generateAdditionalCallableAnnotations((CallableDescriptor) annotated, returnType, annotationDescriptorsAlreadyPresent);
|
||||
generateAdditionalCallableAnnotations((CallableDescriptor) annotated, returnType, annotationDescriptorsAlreadyPresent, parameterContainer);
|
||||
}
|
||||
else if (annotated instanceof FieldDescriptor) {
|
||||
generateAdditionalCallableAnnotations(
|
||||
((FieldDescriptor) annotated).getCorrespondingProperty(), returnType, annotationDescriptorsAlreadyPresent
|
||||
);
|
||||
((FieldDescriptor) annotated).getCorrespondingProperty(), returnType, annotationDescriptorsAlreadyPresent,
|
||||
parameterContainer);
|
||||
}
|
||||
else if (annotated instanceof ClassDescriptor) {
|
||||
generateAdditionalClassAnnotations(annotationDescriptorsAlreadyPresent, (ClassDescriptor) annotated);
|
||||
@@ -164,11 +174,15 @@ public abstract class AnnotationCodegen {
|
||||
private void generateAdditionalCallableAnnotations(
|
||||
@NotNull CallableDescriptor descriptor,
|
||||
@Nullable Type returnType,
|
||||
@NotNull Set<String> annotationDescriptorsAlreadyPresent
|
||||
@NotNull Set<String> annotationDescriptorsAlreadyPresent,
|
||||
@Nullable DeclarationDescriptorWithVisibility parameterContainer
|
||||
) {
|
||||
// No need to annotate privates, synthetic accessors and their parameters
|
||||
if (isInvisibleFromTheOutside(descriptor)) return;
|
||||
if (descriptor instanceof ValueParameterDescriptor && isInvisibleFromTheOutside(descriptor.getContainingDeclaration())) return;
|
||||
if (descriptor instanceof ParameterDescriptor &&
|
||||
isInvisibleFromTheOutside(parameterContainer != null ? parameterContainer : descriptor.getContainingDeclaration())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// No need to annotate annotation methods since they're always non-null
|
||||
if (descriptor instanceof PropertyGetterDescriptor &&
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.backend.common.bridges.ImplKt;
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.codegen.context.ClassContext;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.psi.synthetics.SyntheticClassOrObjectDescriptor;
|
||||
@@ -38,6 +39,8 @@ import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.enumEntryNeedS
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorToSourceUtils.descriptorToDeclaration;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKind.CLASS_MEMBER_DELEGATION_TO_DEFAULT_IMPL;
|
||||
import static org.jetbrains.kotlin.util.DeclarationUtilKt.findImplementationFromInterface;
|
||||
import static org.jetbrains.kotlin.util.DeclarationUtilKt.findInterfaceImplementation;
|
||||
|
||||
public abstract class ClassBodyCodegen extends MemberCodegen<KtPureClassOrObject> {
|
||||
@NotNull
|
||||
@@ -124,7 +127,7 @@ public abstract class ClassBodyCodegen extends MemberCodegen<KtPureClassOrObject
|
||||
for (DeclarationDescriptor memberDescriptor : DescriptorUtils.getAllDescriptors(descriptor.getDefaultType().getMemberScope())) {
|
||||
if (memberDescriptor instanceof CallableMemberDescriptor) {
|
||||
CallableMemberDescriptor member = (CallableMemberDescriptor) memberDescriptor;
|
||||
if (!member.getKind().isReal() && ImplKt.findInterfaceImplementation(member) == null) {
|
||||
if (!member.getKind().isReal() && findInterfaceImplementation(member) == null) {
|
||||
if (member instanceof FunctionDescriptor) {
|
||||
functionCodegen.generateBridges((FunctionDescriptor) member);
|
||||
}
|
||||
@@ -219,21 +222,32 @@ public abstract class ClassBodyCodegen extends MemberCodegen<KtPureClassOrObject
|
||||
protected void generateDelegatesToDefaultImpl() {
|
||||
if (isJvmInterface(descriptor)) return;
|
||||
|
||||
boolean isErasedInlineClass = InlineClassesUtilsKt.isInlineClass(descriptor) && kind == OwnerKind.ERASED_INLINE_CLASS;
|
||||
JvmKotlinType receiverType = new JvmKotlinType(typeMapper.mapType(descriptor), descriptor.getDefaultType());
|
||||
|
||||
for (Map.Entry<FunctionDescriptor, FunctionDescriptor> entry : CodegenUtil.getNonPrivateTraitMethods(descriptor).entrySet()) {
|
||||
FunctionDescriptor interfaceFun = entry.getKey();
|
||||
//skip java 8 default methods
|
||||
if (!CodegenUtilKt.isDefinitelyNotDefaultImplsMethod(interfaceFun) &&
|
||||
!JvmAnnotationUtilKt.isCallableMemberCompiledToJvmDefault(
|
||||
DescriptorUtils.unwrapFakeOverrideToAnyDeclaration(interfaceFun), state.getJvmDefaultMode()
|
||||
)
|
||||
) {
|
||||
generateDelegationToDefaultImpl(interfaceFun, entry.getValue());
|
||||
}
|
||||
generateDelegationToDefaultImpl(entry.getKey(), entry.getValue(), receiverType, functionCodegen, state, isErasedInlineClass);
|
||||
}
|
||||
}
|
||||
|
||||
private void generateDelegationToDefaultImpl(@NotNull FunctionDescriptor interfaceFun, @NotNull FunctionDescriptor inheritedFun) {
|
||||
public static void generateDelegationToDefaultImpl(
|
||||
@NotNull FunctionDescriptor interfaceFun,
|
||||
@NotNull FunctionDescriptor inheritedFun,
|
||||
@NotNull JvmKotlinType receiverType,
|
||||
@NotNull FunctionCodegen functionCodegen,
|
||||
@NotNull GenerationState state,
|
||||
boolean isErasedInlineClass
|
||||
) {
|
||||
CallableMemberDescriptor actualImplementation =
|
||||
interfaceFun.getKind().isReal() ? interfaceFun : findImplementationFromInterface(interfaceFun);
|
||||
assert actualImplementation != null : "Can't find actual implementation for " + interfaceFun;
|
||||
// Skip Java 8 default methods
|
||||
if (CodegenUtilKt.isDefinitelyNotDefaultImplsMethod(actualImplementation) ||
|
||||
JvmAnnotationUtilKt.isCallableMemberCompiledToJvmDefault(actualImplementation, state.getJvmDefaultMode())) {
|
||||
return;
|
||||
}
|
||||
|
||||
KotlinTypeMapper typeMapper = state.getTypeMapper();
|
||||
functionCodegen.generateMethod(
|
||||
new JvmDeclarationOrigin(
|
||||
CLASS_MEMBER_DELEGATION_TO_DEFAULT_IMPL, descriptorToDeclaration(interfaceFun), interfaceFun, null
|
||||
@@ -248,7 +262,7 @@ public abstract class ClassBodyCodegen extends MemberCodegen<KtPureClassOrObject
|
||||
DeclarationDescriptor declarationInheritedFun = inheritedFun.getContainingDeclaration();
|
||||
PsiElement classForInheritedFun = descriptorToDeclaration(declarationInheritedFun);
|
||||
if (classForInheritedFun instanceof KtDeclaration) {
|
||||
codegen.markLineNumber((KtElement) classForInheritedFun, false);
|
||||
codegen.markLineNumber(classForInheritedFun, false);
|
||||
}
|
||||
|
||||
ClassDescriptor containingTrait = (ClassDescriptor) containingDeclaration;
|
||||
@@ -282,18 +296,15 @@ public abstract class ClassBodyCodegen extends MemberCodegen<KtPureClassOrObject
|
||||
InstructionAdapter iv = codegen.v;
|
||||
Type[] myArgTypes = signature.getAsmMethod().getArgumentTypes();
|
||||
Type[] toArgTypes = defaultImplsMethod.getArgumentTypes();
|
||||
boolean isErasedInlineClass =
|
||||
InlineClassesUtilsKt.isInlineClass(descriptor) && kind == OwnerKind.ERASED_INLINE_CLASS;
|
||||
|
||||
int myArgI = 0;
|
||||
int argVar = 0;
|
||||
|
||||
Type receiverType = typeMapper.mapType(descriptor);
|
||||
KotlinType interfaceKotlinType = ((ClassDescriptor) inheritedFun.getContainingDeclaration()).getDefaultType();
|
||||
StackValue.local(argVar, receiverType, descriptor.getDefaultType())
|
||||
StackValue.local(argVar, receiverType.getType(), receiverType.getKotlinType())
|
||||
.put(OBJECT_TYPE, interfaceKotlinType, iv);
|
||||
if (isErasedInlineClass) myArgI++;
|
||||
argVar += receiverType.getSize();
|
||||
argVar += receiverType.getType().getSize();
|
||||
|
||||
int toArgI = 1;
|
||||
|
||||
|
||||
@@ -185,6 +185,12 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
|
||||
generateBridges();
|
||||
generateClosureBody();
|
||||
|
||||
if (samType != null) {
|
||||
SamWrapperCodegen.generateDelegatesToDefaultImpl(
|
||||
asmType, classDescriptor, samType.getClassDescriptor(), functionCodegen, state
|
||||
);
|
||||
}
|
||||
|
||||
this.constructor = generateConstructor();
|
||||
|
||||
if (isConst(closure)) {
|
||||
|
||||
@@ -1585,7 +1585,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
assert topOfStack == tryWithFinallyBlockStackElement : "Top element of stack doesn't equals processing finally block";
|
||||
|
||||
KtTryExpression jetTryExpression = tryWithFinallyBlockStackElement.expression;
|
||||
Label finallyStart = new Label();
|
||||
Label finallyStart = linkedLabel();
|
||||
v.mark(finallyStart);
|
||||
tryWithFinallyBlockStackElement.addGapLabel(finallyStart);
|
||||
addGapLabelsForNestedTryCatchWithoutFinally(state, nestedTryBlocksWithoutFinally, finallyStart);
|
||||
@@ -2835,7 +2835,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
TypeApproximator approximator = new TypeApproximator(state.getModule().getBuiltIns());
|
||||
|
||||
KotlinType approximatedType =
|
||||
CapturedTypeConstructorKt.isCaptured(type) ?
|
||||
TypeUtils.contains(type, (containedType) -> CapturedTypeConstructorKt.isCaptured(containedType)) ?
|
||||
(KotlinType) approximator.approximateToSuperType(
|
||||
type, TypeApproximatorConfiguration.InternalTypesApproximation.INSTANCE
|
||||
) : null;
|
||||
|
||||
@@ -70,7 +70,6 @@ import java.io.StringWriter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.jetbrains.kotlin.builtins.KotlinBuiltIns.isNullableAny;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
|
||||
import static org.jetbrains.kotlin.codegen.CodegenUtilKt.generateBridgeForMainFunctionIfNecessary;
|
||||
import static org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.METHOD_FOR_FUNCTION;
|
||||
@@ -493,11 +492,11 @@ public class FunctionCodegen {
|
||||
@NotNull FunctionDescriptor functionDescriptor,
|
||||
@NotNull MethodVisitor mv,
|
||||
@NotNull JvmMethodSignature jvmSignature,
|
||||
@NotNull InnerClassConsumer innerClassConsumer,
|
||||
@NotNull MemberCodegen<?> memberCodegen,
|
||||
@NotNull GenerationState state
|
||||
) {
|
||||
generateParameterAnnotations(
|
||||
functionDescriptor, mv, jvmSignature, functionDescriptor.getValueParameters(), innerClassConsumer, state
|
||||
functionDescriptor, mv, jvmSignature, functionDescriptor.getValueParameters(), memberCodegen, state
|
||||
);
|
||||
}
|
||||
|
||||
@@ -506,7 +505,7 @@ public class FunctionCodegen {
|
||||
@NotNull MethodVisitor mv,
|
||||
@NotNull JvmMethodSignature jvmSignature,
|
||||
@NotNull List<ValueParameterDescriptor> valueParameters,
|
||||
@NotNull InnerClassConsumer innerClassConsumer,
|
||||
@NotNull MemberCodegen<?> memberCodegen,
|
||||
@NotNull GenerationState state
|
||||
) {
|
||||
if (isAccessor(functionDescriptor)) return;
|
||||
@@ -517,6 +516,7 @@ public class FunctionCodegen {
|
||||
|
||||
Asm7UtilKt.visitAnnotableParameterCount(mv, kotlinParameterTypes.size() - syntheticParameterCount);
|
||||
|
||||
boolean isDefaultImpl = OwnerKind.DEFAULT_IMPLS == memberCodegen.context.getContextKind();
|
||||
for (int i = 0; i < kotlinParameterTypes.size(); i++) {
|
||||
JvmMethodParameterSignature parameterSignature = kotlinParameterTypes.get(i);
|
||||
JvmMethodParameterKind kind = parameterSignature.getKind();
|
||||
@@ -529,13 +529,14 @@ public class FunctionCodegen {
|
||||
? iterator.next()
|
||||
: kind == JvmMethodParameterKind.RECEIVER
|
||||
? JvmCodegenUtil.getDirectMember(functionDescriptor).getExtensionReceiverParameter()
|
||||
: null;
|
||||
: isDefaultImpl && kind == JvmMethodParameterKind.THIS ? JvmCodegenUtil.getDirectMember(functionDescriptor)
|
||||
.getDispatchReceiverParameter() : null;
|
||||
|
||||
if (annotated != null) {
|
||||
//noinspection ConstantConditions
|
||||
int parameterIndex = i - syntheticParameterCount;
|
||||
AnnotationCodegen.forParameter(parameterIndex, mv, innerClassConsumer, state)
|
||||
.genAnnotations(annotated, parameterSignature.getAsmType(), annotated.getReturnType());
|
||||
AnnotationCodegen.forParameter(parameterIndex, mv, memberCodegen, state)
|
||||
.genAnnotations(annotated, parameterSignature.getAsmType(), annotated.getReturnType(), functionDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -607,7 +608,7 @@ public class FunctionCodegen {
|
||||
true, mv,
|
||||
method.getAsmMethod(),
|
||||
method.getOwner().getInternalName(),
|
||||
true);
|
||||
true, signature.getReturnType());
|
||||
methodEnd = new Label();
|
||||
}
|
||||
else {
|
||||
@@ -711,8 +712,7 @@ public class FunctionCodegen {
|
||||
@NotNull JvmDefaultMode jvmDefaultMode
|
||||
) {
|
||||
return OwnerKind.DEFAULT_IMPLS == context.getContextKind() &&
|
||||
JvmAnnotationUtilKt
|
||||
.isCompiledToJvmDefault(DescriptorUtils.unwrapFakeOverrideToAnyDeclaration(functionDescriptor),
|
||||
JvmAnnotationUtilKt.isCompiledToJvmDefault(DescriptorUtils.unwrapFakeOverrideToAnyDeclaration(functionDescriptor),
|
||||
jvmDefaultMode) &&
|
||||
jvmDefaultMode.isCompatibility();
|
||||
}
|
||||
@@ -850,7 +850,8 @@ public class FunctionCodegen {
|
||||
@NotNull Method asmMethod,
|
||||
@NotNull String classToDelegateTo,
|
||||
int opcode,
|
||||
boolean isInterface
|
||||
boolean isInterface,
|
||||
@NotNull Type returnType
|
||||
) {
|
||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
||||
Type[] argTypes = asmMethod.getArgumentTypes();
|
||||
@@ -872,7 +873,8 @@ public class FunctionCodegen {
|
||||
paramIndex += argType.getSize();
|
||||
}
|
||||
iv.visitMethodInsn(opcode, classToDelegateTo, asmMethod.getName(), asmMethod.getDescriptor(), isInterface);
|
||||
iv.areturn(asmMethod.getReturnType());
|
||||
StackValue.onStack(asmMethod.getReturnType()).coerceTo(returnType, null, iv);
|
||||
iv.areturn(returnType);
|
||||
}
|
||||
|
||||
private static void generateDelegateToStaticErasedVersion(
|
||||
@@ -911,7 +913,19 @@ public class FunctionCodegen {
|
||||
@NotNull String classToDelegateTo,
|
||||
boolean isInterfaceMethodCall
|
||||
) {
|
||||
generateDelegateToMethodBody(isStatic ? 0 : 1, mv, asmMethod, classToDelegateTo, Opcodes.INVOKESTATIC, isInterfaceMethodCall);
|
||||
generateDelegateToStaticMethodBody(isStatic, mv, asmMethod, classToDelegateTo, isInterfaceMethodCall, asmMethod.getReturnType());
|
||||
}
|
||||
|
||||
|
||||
private static void generateDelegateToStaticMethodBody(
|
||||
boolean isStatic,
|
||||
@NotNull MethodVisitor mv,
|
||||
@NotNull Method asmMethod,
|
||||
@NotNull String classToDelegateTo,
|
||||
boolean isInterfaceMethodCall,
|
||||
@NotNull Type returnType
|
||||
) {
|
||||
generateDelegateToMethodBody(isStatic ? 0 : 1, mv, asmMethod, classToDelegateTo, Opcodes.INVOKESTATIC, isInterfaceMethodCall, returnType);
|
||||
}
|
||||
|
||||
private static boolean needIndexForVar(JvmMethodParameterKind kind) {
|
||||
@@ -1064,18 +1078,6 @@ public class FunctionCodegen {
|
||||
);
|
||||
}
|
||||
|
||||
public static boolean isMethodOfAny(@NotNull FunctionDescriptor descriptor) {
|
||||
String name = descriptor.getName().asString();
|
||||
List<ValueParameterDescriptor> parameters = descriptor.getValueParameters();
|
||||
if (parameters.isEmpty()) {
|
||||
return name.equals("hashCode") || name.equals("toString");
|
||||
}
|
||||
else if (parameters.size() == 1 && name.equals("equals")) {
|
||||
return isNullableAny(parameters.get(0).getType());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String[] getThrownExceptions(@NotNull FunctionDescriptor function, @NotNull KotlinTypeMapper typeMapper) {
|
||||
return ArrayUtil.toStringArray(CollectionsKt.map(
|
||||
@@ -1669,7 +1671,9 @@ public class FunctionCodegen {
|
||||
|
||||
if (JvmAnnotationUtilKt.isCompiledToJvmDefault(memberDescriptor, mode)) {
|
||||
return (kind != OwnerKind.DEFAULT_IMPLS && !isSynthetic) ||
|
||||
(kind == OwnerKind.DEFAULT_IMPLS && (isSynthetic || mode.isCompatibility()));
|
||||
(kind == OwnerKind.DEFAULT_IMPLS &&
|
||||
(isSynthetic || //TODO: move synthetic method generation into interface
|
||||
(mode.isCompatibility() && !JvmAnnotationUtilKt.hasJvmDefaultNoCompatibilityAnnotation(containingDeclaration))));
|
||||
} else {
|
||||
switch (kind) {
|
||||
case DEFAULT_IMPLS: return true;
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import com.intellij.util.ArrayUtil
|
||||
import org.jetbrains.kotlin.backend.common.bridges.findImplementationFromInterface
|
||||
import org.jetbrains.kotlin.backend.common.bridges.firstSuperMethodFromKotlin
|
||||
import org.jetbrains.kotlin.util.findImplementationFromInterface
|
||||
import org.jetbrains.kotlin.codegen.context.ClassContext
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.codegen.state.JvmMethodExceptionTypes
|
||||
@@ -29,6 +28,7 @@ import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKind
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
||||
import org.jetbrains.kotlin.util.firstSuperMethodFromKotlin
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes.*
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ import org.jetbrains.kotlin.load.java.descriptors.JavaForKotlinOverridePropertyD
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.jvm.annotations.isCompiledToJvmDefault
|
||||
import org.jetbrains.kotlin.resolve.jvm.annotations.hasPlatformDependentAnnotation
|
||||
import org.jetbrains.kotlin.util.findImplementationFromInterface
|
||||
import org.jetbrains.kotlin.util.findInterfaceImplementation
|
||||
|
||||
class DescriptorBasedFunctionHandleForJvm(
|
||||
descriptor: FunctionDescriptor,
|
||||
|
||||
@@ -422,14 +422,6 @@ public class PropertyCodegen {
|
||||
}
|
||||
modifiers |= getVisibilityForBackingField(propertyDescriptor, isDelegate);
|
||||
|
||||
// If val is initialized in EXACTLY_ONCE closure, other class from the same package initializes it
|
||||
// so, its visibility should be package private and not final
|
||||
if (!propertyDescriptor.isVar() &&
|
||||
bindingContext.get(BindingContext.FIELD_CAPTURED_IN_EXACLY_ONCE_CLOSURE, propertyDescriptor) != null
|
||||
) {
|
||||
modifiers &= ~(ACC_PRIVATE | ACC_FINAL);
|
||||
}
|
||||
|
||||
if (AsmUtil.isPropertyWithBackingFieldCopyInOuterClass(propertyDescriptor)) {
|
||||
ImplementationBodyCodegen parentBodyCodegen = (ImplementationBodyCodegen) memberCodegen.getParentCodegen();
|
||||
parentBodyCodegen.addCompanionObjectPropertyToCopy(propertyDescriptor, defaultValue);
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.codegen;
|
||||
import kotlin.text.StringsKt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.backend.common.CodegenUtil;
|
||||
import org.jetbrains.kotlin.codegen.context.ClassContext;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
@@ -32,6 +33,7 @@ import org.jetbrains.kotlin.psi.KtFile;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions;
|
||||
@@ -42,6 +44,7 @@ import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
|
||||
import org.jetbrains.org.objectweb.asm.commons.Method;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
|
||||
@@ -87,7 +90,7 @@ public class SamWrapperCodegen {
|
||||
|
||||
boolean isKotlinFunInterface = !(samType.getClassDescriptor() instanceof JavaClassDescriptor);
|
||||
|
||||
ClassDescriptor classDescriptor = new ClassDescriptorImpl(
|
||||
ClassDescriptorImpl classDescriptor = new ClassDescriptorImpl(
|
||||
samType.getClassDescriptor().getContainingDeclaration(),
|
||||
fqName.shortName(),
|
||||
Modality.FINAL,
|
||||
@@ -97,6 +100,8 @@ public class SamWrapperCodegen {
|
||||
/* isExternal = */ false,
|
||||
LockBasedStorageManager.NO_LOCKS
|
||||
);
|
||||
classDescriptor.initialize(MemberScope.Empty.INSTANCE, Collections.emptySet(), null);
|
||||
|
||||
// e.g. compare(T, T)
|
||||
SimpleFunctionDescriptor erasedInterfaceFunction = samType.getOriginalAbstractMethod().copy(
|
||||
classDescriptor,
|
||||
@@ -135,12 +140,17 @@ public class SamWrapperCodegen {
|
||||
null);
|
||||
|
||||
generateConstructor(asmType, functionAsmType, cv);
|
||||
generateMethod(asmType, functionAsmType, cv, erasedInterfaceFunction, functionType);
|
||||
|
||||
ClassContext context = state.getRootContext().intoClass(classDescriptor, OwnerKind.IMPLEMENTATION, state);
|
||||
FunctionCodegen functionCodegen = new FunctionCodegen(context, cv, state, parentCodegen);
|
||||
generateMethod(asmType, functionAsmType, erasedInterfaceFunction, functionType, functionCodegen);
|
||||
|
||||
if (isKotlinFunInterface) {
|
||||
generateGetFunctionDelegate(cv, asmType, functionAsmType);
|
||||
generateEquals(cv, asmType, functionAsmType, samAsmType);
|
||||
generateHashCode(cv, asmType, functionAsmType);
|
||||
|
||||
generateDelegatesToDefaultImpl(asmType, classDescriptor, samType.getClassDescriptor(), functionCodegen, state);
|
||||
}
|
||||
|
||||
cv.done();
|
||||
@@ -171,25 +181,22 @@ public class SamWrapperCodegen {
|
||||
}
|
||||
|
||||
private void generateMethod(
|
||||
Type ownerType,
|
||||
Type functionType,
|
||||
ClassBuilder cv,
|
||||
SimpleFunctionDescriptor erasedInterfaceFunction,
|
||||
KotlinType functionJetType
|
||||
@NotNull Type ownerType,
|
||||
@NotNull Type functionType,
|
||||
@NotNull SimpleFunctionDescriptor erasedInterfaceFunction,
|
||||
@NotNull KotlinType functionKotlinType,
|
||||
@NotNull FunctionCodegen functionCodegen
|
||||
) {
|
||||
// using root context to avoid creating ClassDescriptor and everything else
|
||||
FunctionCodegen codegen = new FunctionCodegen(state.getRootContext().intoClass(
|
||||
(ClassDescriptor) erasedInterfaceFunction.getContainingDeclaration(), OwnerKind.IMPLEMENTATION, state), cv, state, parentCodegen);
|
||||
|
||||
FunctionDescriptor invokeFunction =
|
||||
functionJetType.getMemberScope().getContributedFunctions(OperatorNameConventions.INVOKE, NoLookupLocation.FROM_BACKEND).iterator().next().getOriginal();
|
||||
FunctionDescriptor invokeFunction = functionKotlinType.getMemberScope().getContributedFunctions(
|
||||
OperatorNameConventions.INVOKE, NoLookupLocation.FROM_BACKEND
|
||||
).iterator().next().getOriginal();
|
||||
StackValue functionField = StackValue.field(functionType, ownerType, FUNCTION_FIELD_NAME, false, StackValue.none());
|
||||
codegen.genSamDelegate(erasedInterfaceFunction, invokeFunction, functionField);
|
||||
functionCodegen.genSamDelegate(erasedInterfaceFunction, invokeFunction, functionField);
|
||||
|
||||
// generate sam bridges
|
||||
// TODO: erasedInterfaceFunction is actually not an interface function, but function in generated class
|
||||
SimpleFunctionDescriptor originalInterfaceErased = samType.getOriginalAbstractMethod();
|
||||
ClosureCodegen.generateBridgesForSAM(originalInterfaceErased, erasedInterfaceFunction, codegen);
|
||||
ClosureCodegen.generateBridgesForSAM(originalInterfaceErased, erasedInterfaceFunction, functionCodegen);
|
||||
}
|
||||
|
||||
private static void generateEquals(
|
||||
@@ -248,6 +255,31 @@ public class SamWrapperCodegen {
|
||||
FunctionCodegen.endVisit(iv, "getFunctionDelegate of SAM wrapper");
|
||||
}
|
||||
|
||||
public static void generateDelegatesToDefaultImpl(
|
||||
@NotNull Type asmType,
|
||||
@NotNull ClassDescriptor classDescriptor,
|
||||
@NotNull ClassDescriptor funInterface,
|
||||
@NotNull FunctionCodegen functionCodegen,
|
||||
@NotNull GenerationState state
|
||||
) {
|
||||
JvmKotlinType receiverType = new JvmKotlinType(asmType, classDescriptor.getDefaultType());
|
||||
|
||||
for (DeclarationDescriptor descriptor : DescriptorUtils.getAllDescriptors(funInterface.getDefaultType().getMemberScope())) {
|
||||
if (!(descriptor instanceof CallableMemberDescriptor)) continue;
|
||||
CallableMemberDescriptor member = (CallableMemberDescriptor) descriptor;
|
||||
if (member.getModality() == Modality.ABSTRACT ||
|
||||
Visibilities.isPrivate(member.getVisibility()) ||
|
||||
member.getVisibility() == Visibilities.INVISIBLE_FAKE ||
|
||||
DescriptorUtils.isMethodOfAny(member)) continue;
|
||||
|
||||
for (Map.Entry<FunctionDescriptor, FunctionDescriptor> entry : CodegenUtil.INSTANCE.copyFunctions(
|
||||
member, member, classDescriptor, Modality.OPEN, Visibilities.PUBLIC, CallableMemberDescriptor.Kind.DECLARATION, false
|
||||
).entrySet()) {
|
||||
ClassBodyCodegen.generateDelegationToDefaultImpl(entry.getKey(), entry.getValue(), receiverType, functionCodegen, state, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private FqName getWrapperName(
|
||||
@NotNull KtFile containingFile,
|
||||
|
||||
@@ -821,20 +821,17 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
|
||||
Map<ValueParameterDescriptor, ResolvedValueArgument> arguments = newResolvedCall.getValueArguments();
|
||||
for (ValueParameterDescriptor valueParameter : arguments.keySet()) {
|
||||
SamType samType = SamType.createByValueParameter(valueParameter);
|
||||
if (samType == null) continue;
|
||||
|
||||
ResolvedValueArgument argument = arguments.get(valueParameter);
|
||||
if (argument instanceof ExpressionValueArgument) {
|
||||
ValueArgument valueArgument = ((ExpressionValueArgument) argument).getValueArgument();
|
||||
if (valueArgument != null && newResolvedCall.getExpectedTypeForSamConvertedArgument(valueArgument) != null) {
|
||||
recordSamTypeOnArgumentExpression(samType, valueArgument);
|
||||
recordSamTypeOnArgumentExpression(valueParameter, valueArgument);
|
||||
}
|
||||
} else if (argument instanceof VarargValueArgument) {
|
||||
VarargValueArgument varargValueArgument = (VarargValueArgument) argument;
|
||||
for (ValueArgument valueArgument : varargValueArgument.getArguments()) {
|
||||
if (valueArgument != null && newResolvedCall.getExpectedTypeForSamConvertedArgument(valueArgument) != null) {
|
||||
recordSamTypeOnArgumentExpression(samType, valueArgument);
|
||||
recordSamTypeOnArgumentExpression(valueParameter, valueArgument);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -872,6 +869,13 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
}
|
||||
}
|
||||
|
||||
private void recordSamTypeOnArgumentExpression(ValueParameterDescriptor valueParameter, ValueArgument valueArgument) {
|
||||
SamType samType = SamType.createByValueParameter(valueParameter);
|
||||
if (samType == null) return;
|
||||
|
||||
recordSamTypeOnArgumentExpression(samType, valueArgument);
|
||||
}
|
||||
|
||||
private void recordSamTypeOnArgumentExpression(SamType samType, ValueArgument valueArgument) {
|
||||
KtExpression argumentExpression = valueArgument.getArgumentExpression();
|
||||
assert argumentExpression != null : valueArgument.asElement().getText();
|
||||
|
||||
@@ -60,6 +60,7 @@ import org.jetbrains.org.objectweb.asm.Opcodes.*
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
import org.jetbrains.org.objectweb.asm.commons.Method
|
||||
import org.jetbrains.org.objectweb.asm.tree.LabelNode
|
||||
import java.util.*
|
||||
|
||||
fun generateIsCheck(
|
||||
@@ -666,3 +667,22 @@ private fun generateLambdaForRunSuspend(
|
||||
lambdaBuilder.done()
|
||||
return lambdaBuilder.thisName
|
||||
}
|
||||
|
||||
internal fun LabelNode.linkWithLabel(): LabelNode {
|
||||
// Remember labelNode in label and vise versa.
|
||||
// Before ASM 8 there was JB patch in MethodNode that makes such linking in constructor of LabelNode.
|
||||
//
|
||||
// protected LabelNode getLabelNode(final Label label) {
|
||||
// if (!(label.info instanceof LabelNode)) {
|
||||
// //label.info = new LabelNode(label); //[JB: needed for Coverage agent]
|
||||
// label.info = new LabelNode(); //ASM 8
|
||||
// }
|
||||
// return (LabelNode) label.info;
|
||||
// }
|
||||
if (label.info == null) {
|
||||
label.info = this
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
fun linkedLabel(): Label = LabelNode().linkWithLabel().label
|
||||
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.codegen.optimization.common.*
|
||||
import org.jetbrains.kotlin.codegen.optimization.fixStack.FixStackMethodTransformer
|
||||
import org.jetbrains.kotlin.codegen.optimization.fixStack.top
|
||||
import org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer
|
||||
import org.jetbrains.kotlin.codegen.linkWithLabel
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.config.isReleaseCoroutines
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
||||
@@ -750,7 +751,7 @@ class CoroutineTransformerMethodVisitor(
|
||||
suspendMarkerVarIndex: Int,
|
||||
suspendPointLineNumber: LineNumberNode?
|
||||
): LabelNode {
|
||||
val continuationLabel = LabelNode()
|
||||
val continuationLabel = LabelNode().linkWithLabel()
|
||||
val continuationLabelAfterLoadedResult = LabelNode()
|
||||
val suspendElementLineNumber = lineNumber
|
||||
var nextLineNumberNode = nextDefinitelyHitLineNumber(suspension)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.codegen.inline
|
||||
|
||||
import org.jetbrains.kotlin.codegen.*
|
||||
import org.jetbrains.kotlin.codegen.linkWithLabel
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
@@ -15,6 +16,7 @@ import org.jetbrains.kotlin.resolve.inline.InlineUtil
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
||||
import org.jetbrains.org.objectweb.asm.Label
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.tree.LabelNode
|
||||
import org.jetbrains.org.objectweb.asm.tree.MethodNode
|
||||
|
||||
class InlineCodegenForDefaultBody(
|
||||
@@ -27,7 +29,7 @@ class InlineCodegenForDefaultBody(
|
||||
) : CallGenerator {
|
||||
private val sourceMapper: SourceMapper = codegen.parentCodegen.orCreateSourceMapper
|
||||
|
||||
private val methodStartLabel = Label()
|
||||
private val methodStartLabel = linkedLabel()
|
||||
|
||||
init {
|
||||
assert(InlineUtil.isInline(function)) {
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.kotlin.codegen.CodegenUtilKt.linkedLabel;
|
||||
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.*;
|
||||
import static org.jetbrains.kotlin.codegen.inline.MethodInlinerUtilKt.getNextMeaningful;
|
||||
|
||||
@@ -198,7 +199,7 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
|
||||
//Creating temp node for finally block copy with some additional instruction
|
||||
MethodNode finallyBlockCopy = createEmptyMethodNode();
|
||||
Label newFinallyStart = new Label();
|
||||
Label insertedBlockEnd = new Label();
|
||||
Label insertedBlockEnd = linkedLabel();
|
||||
|
||||
boolean generateAloadAstore = nonLocalReturnType != Type.VOID_TYPE && !finallyInfo.isEmpty();
|
||||
if (generateAloadAstore) {
|
||||
|
||||
@@ -102,7 +102,7 @@ class MethodInliner(
|
||||
}
|
||||
|
||||
//substitute returns with "goto end" instruction to keep non local returns in lambdas
|
||||
val end = Label()
|
||||
val end = linkedLabel()
|
||||
val isTransformingAnonymousObject = nodeRemapper is RegeneratedLambdaFieldRemapper
|
||||
transformedNode = doInline(transformedNode)
|
||||
if (!isTransformingAnonymousObject) {
|
||||
|
||||
@@ -66,16 +66,10 @@ class SourceMapCopier(val parent: SourceMapper, private val smap: SMAP, val call
|
||||
return mappedLineNumber
|
||||
}
|
||||
|
||||
val newLineNumber = if (lineNumber == 65100) {
|
||||
// TODO This is a compatibility hack for reading bytecode generated by 1.4-M1. Once the bootstrap
|
||||
// compiler is updated to a newer version, it can be removed (as newer bytecode explicitly lists
|
||||
// this range in the SMAP).
|
||||
parent.mapSyntheticLineNumber(InlineOnlySmapSkipper.LOCAL_VARIABLE_INLINE_ARGUMENT_SYNTHETIC_LINE_NUMBER)
|
||||
} else {
|
||||
val range = lastVisitedRange?.takeIf { lineNumber in it } ?: smap.findRange(lineNumber) ?: return -1
|
||||
lastVisitedRange = range
|
||||
parent.mapLineNumber(range.mapDestToSource(lineNumber), callSite ?: range.callSite)
|
||||
}
|
||||
val range = lastVisitedRange?.takeIf { lineNumber in it } ?: smap.findRange(lineNumber) ?: return -1
|
||||
lastVisitedRange = range
|
||||
val newLineNumber = parent.mapLineNumber(range.mapDestToSource(lineNumber), callSite ?: range.callSite)
|
||||
|
||||
visitedLines.put(lineNumber, newLineNumber)
|
||||
return newLineNumber
|
||||
}
|
||||
|
||||
@@ -33,7 +33,11 @@ class TrimMargin : IntrinsicMethod() {
|
||||
val marginPrefix = argument.valueArgument?.getArgumentExpression()
|
||||
?.let { codegen.getCompileTimeConstant(it) as? StringValue }
|
||||
?.value ?: return null
|
||||
literalText.trimMargin(marginPrefix)
|
||||
try {
|
||||
literalText.trimMargin(marginPrefix)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
else -> error("Unknown value argument type ${argument::class}: $argument")
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class LabelNormalizationMethodTransformer : MethodTransformer() {
|
||||
|
||||
private class TransformerForMethod(val methodNode: MethodNode) {
|
||||
val instructions = methodNode.instructions
|
||||
val newLabelNodes = SmartIdentityTable<Label, LabelNode>()
|
||||
val newLabelNodes = SmartIdentityTable<LabelNode, LabelNode>()
|
||||
|
||||
fun transform() {
|
||||
if (rewriteLabelInstructions()) {
|
||||
@@ -48,11 +48,11 @@ class LabelNormalizationMethodTransformer : MethodTransformer() {
|
||||
if (thisNode is LabelNode) {
|
||||
val prevNode = thisNode.previous
|
||||
if (prevNode is LabelNode) {
|
||||
newLabelNodes[thisNode.label] = prevNode
|
||||
newLabelNodes[thisNode] = prevNode
|
||||
removedAnyLabels = true
|
||||
thisNode = instructions.removeNodeGetNext(thisNode)
|
||||
} else {
|
||||
newLabelNodes[thisNode.label] = thisNode
|
||||
newLabelNodes[thisNode] = thisNode
|
||||
thisNode = thisNode.next
|
||||
}
|
||||
} else {
|
||||
@@ -145,12 +145,12 @@ class LabelNormalizationMethodTransformer : MethodTransformer() {
|
||||
}
|
||||
|
||||
private fun getNew(oldLabelNode: LabelNode): LabelNode {
|
||||
return newLabelNodes[oldLabelNode.label]
|
||||
return newLabelNodes[oldLabelNode]
|
||||
?: throw IllegalStateException("Label wasn't found during iterating through instructions")
|
||||
}
|
||||
|
||||
private fun getNewOrOld(oldLabelNode: LabelNode): LabelNode =
|
||||
newLabelNodes[oldLabelNode.label] ?: oldLabelNode
|
||||
newLabelNodes[oldLabelNode] ?: oldLabelNode
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.codegen.optimization.nullCheck
|
||||
import org.jetbrains.kotlin.codegen.coroutines.withInstructionAdapter
|
||||
import org.jetbrains.kotlin.codegen.inline.ReifiedTypeInliner
|
||||
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethods
|
||||
import org.jetbrains.kotlin.codegen.linkWithLabel
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.StrictBasicValue
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.debugText
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.isInsn
|
||||
@@ -269,7 +270,7 @@ class RedundantNullCheckMethodTransformer(private val generationState: Generatio
|
||||
// <...> -- v is null here
|
||||
|
||||
val jumpsIfNull = insn.opcode == Opcodes.IFNULL
|
||||
val originalLabel = insn.label
|
||||
val originalLabel = insn.label.linkWithLabel()
|
||||
originalLabels[insn] = originalLabel
|
||||
insn.label = synthetic(LabelNode(Label()))
|
||||
|
||||
@@ -342,7 +343,7 @@ class RedundantNullCheckMethodTransformer(private val generationState: Generatio
|
||||
val originalLabel: LabelNode?
|
||||
val insertAfterNotNull: AbstractInsnNode
|
||||
if (jumpsIfInstance) {
|
||||
originalLabel = next.label
|
||||
originalLabel = next.label.linkWithLabel()
|
||||
originalLabels[next] = next.label
|
||||
val newLabel = synthetic(LabelNode(Label()))
|
||||
methodNode.instructions.add(newLabel)
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.classId
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyPrivateApi
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.nonSourceAnnotations
|
||||
import org.jetbrains.kotlin.resolve.jvm.annotations.hasJvmDefaultAnnotation
|
||||
import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForParameterTypes
|
||||
import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForReturnType
|
||||
import org.jetbrains.kotlin.serialization.DescriptorSerializer
|
||||
import org.jetbrains.kotlin.serialization.DescriptorSerializer.Companion.writeVersionRequirement
|
||||
@@ -93,7 +94,13 @@ class JvmSerializerExtension @JvmOverloads constructor(
|
||||
writeVersionRequirementForJvmDefaultIfNeeded(descriptor, proto, versionRequirementTable)
|
||||
|
||||
if (jvmDefaultMode.forAllMethodsWithBody && isInterface(descriptor)) {
|
||||
proto.setExtension(JvmProtoBuf.jvmClassFlags, JvmFlags.getClassFlags(true))
|
||||
proto.setExtension(
|
||||
JvmProtoBuf.jvmClassFlags,
|
||||
JvmFlags.getClassFlags(
|
||||
jvmDefaultMode.forAllMethodsWithBody,
|
||||
JvmDefaultMode.ALL_COMPATIBILITY == jvmDefaultMode
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +209,10 @@ class JvmSerializerExtension @JvmOverloads constructor(
|
||||
versionRequirementTable?.writeInlineParameterNullCheckRequirement(proto::addVersionRequirement)
|
||||
}
|
||||
|
||||
if (requiresFunctionNameManglingForReturnType(descriptor)) {
|
||||
if (requiresFunctionNameManglingForReturnType(descriptor) &&
|
||||
!DescriptorUtils.hasJvmNameAnnotation(descriptor) &&
|
||||
!requiresFunctionNameManglingForParameterTypes(descriptor)
|
||||
) {
|
||||
versionRequirementTable?.writeFunctionNameManglingForReturnTypeRequirement(proto::addVersionRequirement)
|
||||
}
|
||||
}
|
||||
@@ -267,7 +277,7 @@ class JvmSerializerExtension @JvmOverloads constructor(
|
||||
versionRequirementTable?.writeInlineParameterNullCheckRequirement(proto::addVersionRequirement)
|
||||
}
|
||||
|
||||
if (requiresFunctionNameManglingForReturnType(descriptor)) {
|
||||
if (!DescriptorUtils.hasJvmNameAnnotation(descriptor) && requiresFunctionNameManglingForReturnType(descriptor)) {
|
||||
versionRequirementTable?.writeFunctionNameManglingForReturnTypeRequirement(proto::addVersionRequirement)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.codegen.state
|
||||
|
||||
import org.jetbrains.kotlin.codegen.coroutines.unwrapInitialDescriptorForSuspendFunction
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.InlineClassDescriptorResolver
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
|
||||
import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForParameterTypes
|
||||
@@ -24,10 +25,13 @@ fun getManglingSuffixBasedOnKotlinSignature(
|
||||
if (descriptor is ConstructorDescriptor) return null
|
||||
if (InlineClassDescriptorResolver.isSynthesizedBoxOrUnboxMethod(descriptor)) return null
|
||||
|
||||
// Don't mangle functions with '@JvmName' annotation.
|
||||
// Some stdlib functions ('Result.success', 'Result.failure') are annotated with '@JvmName' as a workaround for forward compatibility.
|
||||
if (DescriptorUtils.hasJvmNameAnnotation(descriptor)) return null
|
||||
|
||||
// If a function accepts inline class parameters, mangle its name.
|
||||
val actualValueParameterTypes = listOfNotNull(descriptor.extensionReceiverParameter?.type) + descriptor.valueParameters.map { it.type }
|
||||
if (requiresFunctionNameManglingForParameterTypes(actualValueParameterTypes)) {
|
||||
return "-" + md5base64(collectSignatureForMangling(actualValueParameterTypes))
|
||||
if (requiresFunctionNameManglingForParameterTypes(descriptor)) {
|
||||
return "-" + md5base64(collectSignatureForMangling(descriptor))
|
||||
}
|
||||
|
||||
// If a class member function returns inline class value, mangle its name.
|
||||
@@ -42,8 +46,10 @@ fun getManglingSuffixBasedOnKotlinSignature(
|
||||
return null
|
||||
}
|
||||
|
||||
private fun collectSignatureForMangling(types: List<KotlinType>) =
|
||||
types.joinToString { getSignatureElementForMangling(it) }
|
||||
private fun collectSignatureForMangling(descriptor: CallableMemberDescriptor): String {
|
||||
val types = listOfNotNull(descriptor.extensionReceiverParameter?.type) + descriptor.valueParameters.map { it.type }
|
||||
return types.joinToString { getSignatureElementForMangling(it) }
|
||||
}
|
||||
|
||||
private fun getSignatureElementForMangling(type: KotlinType): String = buildString {
|
||||
val descriptor = type.constructor.declarationDescriptor ?: return ""
|
||||
|
||||
@@ -67,7 +67,7 @@ class BuiltInsSerializer(dependOnOldBuiltIns: Boolean) : MetadataSerializer(Buil
|
||||
PrintingMessageCollector(System.err, MessageRenderer.PLAIN_RELATIVE_PATHS, false),
|
||||
false
|
||||
) {
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
|
||||
// Only report diagnostics without a particular location because there's plenty of errors in built-in sources
|
||||
// (functions without bodies, incorrect combination of modifiers, etc.)
|
||||
if (location == null) {
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.serialization.builtins
|
||||
import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||
import org.jetbrains.kotlin.metadata.builtins.BuiltInsBinaryVersion
|
||||
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
|
||||
import org.jetbrains.kotlin.serialization.AnnotationSerializer
|
||||
import org.jetbrains.kotlin.serialization.KotlinSerializerExtensionBase
|
||||
import org.jetbrains.kotlin.serialization.deserialization.builtins.BuiltInSerializerProtocol
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
@@ -31,20 +32,29 @@ class BuiltInsSerializerExtension : KotlinSerializerExtensionBase(BuiltInSeriali
|
||||
"CharRange" to "kotlin/ranges/CharRange"
|
||||
)
|
||||
|
||||
override fun createAnnotationSerializer(): AnnotationSerializer = object : AnnotationSerializer(stringTable) {
|
||||
override fun ignoreAnnotation(type: KotlinType): Boolean =
|
||||
type.presentableName == "JvmStatic" || type.presentableName == "JvmField" || super.ignoreAnnotation(type)
|
||||
}
|
||||
|
||||
override val metadataVersion: BinaryVersion
|
||||
get() = BuiltInsBinaryVersion.INSTANCE
|
||||
|
||||
override fun shouldUseTypeTable(): Boolean = true
|
||||
|
||||
override fun serializeErrorType(type: KotlinType, builder: ProtoBuf.Type.Builder) {
|
||||
val unwrapped = type.unwrap()
|
||||
if (unwrapped !is UnresolvedType) {
|
||||
throw UnsupportedOperationException("Error types which are not UnresolvedType instances are not supported here: $unwrapped")
|
||||
}
|
||||
|
||||
val className = shortNameToClassId[unwrapped.presentableName]
|
||||
?: throw UnsupportedOperationException("Unsupported unresolved type: $unwrapped")
|
||||
val className = shortNameToClassId[type.presentableName]
|
||||
?: throw UnsupportedOperationException("Unsupported unresolved type: ${type.unwrap()}")
|
||||
|
||||
builder.className = stringTable.getQualifiedClassNameIndex(className, false)
|
||||
}
|
||||
|
||||
private val KotlinType.presentableName: String
|
||||
get() {
|
||||
val unwrapped = unwrap()
|
||||
if (unwrapped !is UnresolvedType) {
|
||||
throw UnsupportedOperationException("Error types which are not UnresolvedType instances are not supported here: $unwrapped")
|
||||
}
|
||||
return unwrapped.presentableName
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,6 +340,12 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
)
|
||||
var explicitApi: String by FreezableVar(ExplicitApiMode.DISABLED.state)
|
||||
|
||||
@Argument(
|
||||
value = "-Xdeserialize-fake-overrides",
|
||||
description = "Fallback to deserializing fake overrides"
|
||||
)
|
||||
var deserializeFakeOverrides: Boolean by FreezableVar(false)
|
||||
|
||||
open fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
|
||||
return HashMap<AnalysisFlag<*>, Any>().apply {
|
||||
put(AnalysisFlags.skipMetadataVersionCheck, skipMetadataVersionCheck)
|
||||
@@ -382,6 +388,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
put(LanguageFeature.NewInference, LanguageFeature.State.ENABLED)
|
||||
put(LanguageFeature.SamConversionPerArgument, LanguageFeature.State.ENABLED)
|
||||
put(LanguageFeature.FunctionReferenceWithDefaultValueAsOtherType, LanguageFeature.State.ENABLED)
|
||||
put(LanguageFeature.DisableCompatibilityModeForNewInference, LanguageFeature.State.ENABLED)
|
||||
}
|
||||
|
||||
if (inlineClasses) {
|
||||
@@ -461,6 +468,8 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
|
||||
if (!functionReferenceWithDefaultValueFeaturePassedExplicitly)
|
||||
put(LanguageFeature.FunctionReferenceWithDefaultValueAsOtherType, LanguageFeature.State.ENABLED)
|
||||
|
||||
put(LanguageFeature.DisableCompatibilityModeForNewInference, LanguageFeature.State.ENABLED)
|
||||
}
|
||||
|
||||
if (featuresThatForcePreReleaseBinaries.isNotEmpty()) {
|
||||
|
||||
@@ -169,6 +169,9 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
@Argument(value = "-Xenable-js-scripting", description = "Enable experimental support of .kts files using K/JS (with -Xir only)")
|
||||
var enableJsScripting: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(value = "-Xdisable-fake-override-validator", description = "Disable IR fake override validator")
|
||||
var disableFakeOverrideValidator: Boolean by FreezableVar(false)
|
||||
|
||||
override fun checkIrSupport(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) {
|
||||
if (!isIrBackendEnabled()) return
|
||||
|
||||
|
||||
@@ -18,24 +18,61 @@ package org.jetbrains.kotlin.cli.common.messages
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
interface CompilerMessageSourceLocation : Serializable {
|
||||
val path: String
|
||||
val line: Int
|
||||
val column: Int
|
||||
val lineEnd: Int get() = -1
|
||||
val columnEnd: Int get() = -1
|
||||
val lineContent: String?
|
||||
}
|
||||
|
||||
data class CompilerMessageLocation private constructor(
|
||||
val path: String,
|
||||
val line: Int,
|
||||
val column: Int,
|
||||
val lineContent: String?
|
||||
) : Serializable {
|
||||
override val path: String,
|
||||
override val line: Int,
|
||||
override val column: Int,
|
||||
override val lineContent: String?
|
||||
) : CompilerMessageSourceLocation {
|
||||
override fun toString(): String =
|
||||
path + (if (line != -1 || column != -1) " ($line:$column)" else "")
|
||||
path + (if (line != -1 || column != -1) " ($line:$column)" else "")
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun create(path: String?): CompilerMessageLocation? =
|
||||
create(path, -1, -1, null)
|
||||
create(path, -1, -1, null)
|
||||
|
||||
@JvmStatic
|
||||
fun create(path: String?, line: Int, column: Int, lineContent: String?): CompilerMessageLocation? =
|
||||
if (path == null) null else CompilerMessageLocation(path, line, column, lineContent)
|
||||
if (path == null) null else CompilerMessageLocation(path, line, column, lineContent)
|
||||
|
||||
private val serialVersionUID: Long = 8228357578L
|
||||
}
|
||||
}
|
||||
|
||||
data class CompilerMessageLocationWithRange private constructor(
|
||||
override val path: String,
|
||||
override val line: Int,
|
||||
override val column: Int,
|
||||
override val lineEnd: Int,
|
||||
override val columnEnd: Int,
|
||||
override val lineContent: String?
|
||||
) : CompilerMessageSourceLocation {
|
||||
override fun toString(): String =
|
||||
path + (if (line != -1 || column != -1) " ($line:$column)" else "")
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun create(
|
||||
path: String?,
|
||||
lineStart: Int,
|
||||
columnStart: Int,
|
||||
lineEnd: Int?,
|
||||
columnEnd: Int?,
|
||||
lineContent: String?
|
||||
): CompilerMessageLocationWithRange? =
|
||||
if (path == null) null else CompilerMessageLocationWithRange(path, lineStart, columnStart, lineEnd ?: -1, columnEnd ?: -1, lineContent)
|
||||
|
||||
private val serialVersionUID: Long = 8228357578L
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class FilteringMessageCollector implements MessageCollector {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void report(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageLocation location) {
|
||||
public void report(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageSourceLocation location) {
|
||||
if (!decline.test(severity)) {
|
||||
messageCollector.report(severity, message, location);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class GroupingMessageCollector implements MessageCollector {
|
||||
@@ -32,7 +31,7 @@ public class GroupingMessageCollector implements MessageCollector {
|
||||
private final boolean treatWarningsAsErrors;
|
||||
|
||||
// Note that the key in this map can be null
|
||||
private final Multimap<CompilerMessageLocation, Message> groupedMessages = LinkedHashMultimap.create();
|
||||
private final Multimap<CompilerMessageSourceLocation, Message> groupedMessages = LinkedHashMultimap.create();
|
||||
|
||||
public GroupingMessageCollector(@NotNull MessageCollector delegate, boolean treatWarningsAsErrors) {
|
||||
this.delegate = delegate;
|
||||
@@ -48,7 +47,7 @@ public class GroupingMessageCollector implements MessageCollector {
|
||||
public void report(
|
||||
@NotNull CompilerMessageSeverity severity,
|
||||
@NotNull String message,
|
||||
@Nullable CompilerMessageLocation location
|
||||
@Nullable CompilerMessageSourceLocation location
|
||||
) {
|
||||
if (CompilerMessageSeverity.VERBOSE.contains(severity)) {
|
||||
delegate.report(severity, message, location);
|
||||
@@ -78,9 +77,9 @@ public class GroupingMessageCollector implements MessageCollector {
|
||||
report(CompilerMessageSeverity.ERROR, "warnings found and -Werror specified", null);
|
||||
}
|
||||
|
||||
List<CompilerMessageLocation> sortedKeys =
|
||||
List<CompilerMessageSourceLocation> sortedKeys =
|
||||
CollectionsKt.sortedWith(groupedMessages.keySet(), Comparator.nullsFirst(CompilerMessageLocationComparator.INSTANCE));
|
||||
for (CompilerMessageLocation location : sortedKeys) {
|
||||
for (CompilerMessageSourceLocation location : sortedKeys) {
|
||||
for (Message message : groupedMessages.get(location)) {
|
||||
if (!hasExplicitErrors || message.severity.isError() || message.severity == CompilerMessageSeverity.STRONG_WARNING) {
|
||||
delegate.report(message.severity, message.message, message.location);
|
||||
@@ -91,7 +90,7 @@ public class GroupingMessageCollector implements MessageCollector {
|
||||
groupedMessages.clear();
|
||||
}
|
||||
|
||||
private static class CompilerMessageLocationComparator implements Comparator<CompilerMessageLocation> {
|
||||
private static class CompilerMessageLocationComparator implements Comparator<CompilerMessageSourceLocation> {
|
||||
public static final CompilerMessageLocationComparator INSTANCE = new CompilerMessageLocationComparator();
|
||||
|
||||
// First, output all messages without any location information. Then, only those with the file path.
|
||||
@@ -104,7 +103,7 @@ public class GroupingMessageCollector implements MessageCollector {
|
||||
// foo.kt:42: error: bad line
|
||||
// foo.kt:42:43: error: bad character
|
||||
@Override
|
||||
public int compare(CompilerMessageLocation o1, CompilerMessageLocation o2) {
|
||||
public int compare(CompilerMessageSourceLocation o1, CompilerMessageSourceLocation o2) {
|
||||
if (o1.getColumn() == -1 && o2.getColumn() != -1) return -1;
|
||||
if (o1.getColumn() != -1 && o2.getColumn() == -1) return 1;
|
||||
|
||||
@@ -118,9 +117,9 @@ public class GroupingMessageCollector implements MessageCollector {
|
||||
private static class Message {
|
||||
private final CompilerMessageSeverity severity;
|
||||
private final String message;
|
||||
private final CompilerMessageLocation location;
|
||||
private final CompilerMessageSourceLocation location;
|
||||
|
||||
private Message(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageLocation location) {
|
||||
private Message(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageSourceLocation location) {
|
||||
this.severity = severity;
|
||||
this.message = message;
|
||||
this.location = location;
|
||||
|
||||
@@ -19,13 +19,13 @@ package org.jetbrains.kotlin.cli.common.messages
|
||||
interface MessageCollector {
|
||||
fun clear()
|
||||
|
||||
fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation? = null)
|
||||
fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation? = null)
|
||||
|
||||
fun hasErrors(): Boolean
|
||||
|
||||
companion object {
|
||||
val NONE: MessageCollector = object : MessageCollector {
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ private interface ArgsConverter<T> {
|
||||
}
|
||||
|
||||
fun tryConvertSingle(parameter: KParameter, arg: NamedArgument<T>): Result
|
||||
fun tryConvertVararg(parameter: KParameter, firstArg: NamedArgument<T>, restArgsIt: Iterator<NamedArgument<T>>): Result
|
||||
fun tryConvertTail(parameter: KParameter, firstArg: NamedArgument<T>, restArgsIt: Iterator<NamedArgument<T>>): Result
|
||||
fun tryConvertVararg(parameter: KParameter, firstArg: NamedArgument<T>, restArgs: Sequence<NamedArgument<T>>): Result
|
||||
fun tryConvertTail(parameter: KParameter, firstArg: NamedArgument<T>, restArgs: Sequence<NamedArgument<T>>): Result
|
||||
}
|
||||
|
||||
private enum class ArgsTraversalState { UNNAMED, NAMED, TAIL }
|
||||
@@ -77,7 +77,7 @@ private fun <T> tryCreateCallableMapping(
|
||||
val res = mutableMapOf<KParameter, Any?>()
|
||||
var state = ArgsTraversalState.UNNAMED
|
||||
val unboundParams = callable.parameters.toMutableList()
|
||||
val argIt = args.iterator()
|
||||
val argIt = LookAheadIterator(args.iterator())
|
||||
while (argIt.hasNext()) {
|
||||
if (unboundParams.isEmpty()) return null // failed to match: no param left for the arg
|
||||
val arg = argIt.next()
|
||||
@@ -102,7 +102,11 @@ private fun <T> tryCreateCallableMapping(
|
||||
res[par] = cvtRes.v
|
||||
} else if (par.type.jvmErasure.java.isArray) {
|
||||
// try vararg
|
||||
val cvtVRes = converter.tryConvertVararg(par, arg, argIt)
|
||||
|
||||
// Collect all the arguments that do not have a name
|
||||
val unnamed = argIt.sequenceUntil { it.name != null }
|
||||
|
||||
val cvtVRes = converter.tryConvertVararg(par, arg, unnamed)
|
||||
if (cvtVRes is ArgsConverter.Result.Success) {
|
||||
res[par] = cvtVRes.v
|
||||
} else return null // failed to match: no suitable param for unnamed arg
|
||||
@@ -121,7 +125,7 @@ private fun <T> tryCreateCallableMapping(
|
||||
ArgsTraversalState.TAIL -> {
|
||||
assert(arg.name == null)
|
||||
val par = unboundParams.removeAt(unboundParams.lastIndex)
|
||||
val cvtVRes = converter.tryConvertTail(par, arg, argIt)
|
||||
val cvtVRes = converter.tryConvertTail(par, arg, argIt.asSequence())
|
||||
if (cvtVRes is ArgsConverter.Result.Success) {
|
||||
if (argIt.hasNext()) return null // failed to match: not all tail args are consumed
|
||||
res[par] = cvtVRes.v
|
||||
@@ -162,7 +166,7 @@ private class StringArgsConverter : ArgsConverter<String> {
|
||||
override fun tryConvertVararg(
|
||||
parameter: KParameter,
|
||||
firstArg: NamedArgument<String>,
|
||||
restArgsIt: Iterator<NamedArgument<String>>
|
||||
restArgs: Sequence<NamedArgument<String>>
|
||||
): ArgsConverter.Result {
|
||||
fun convertPrimitivesArray(type: KType, args: Sequence<String?>): Any? =
|
||||
when (type.classifier) {
|
||||
@@ -179,7 +183,7 @@ private class StringArgsConverter : ArgsConverter<String> {
|
||||
|
||||
val parameterType = parameter.type
|
||||
if (parameterType.jvmErasure.java.isArray) {
|
||||
val argsSequence = sequenceOf(firstArg.value) + restArgsIt.asSequence().map { it.value }
|
||||
val argsSequence = sequenceOf(firstArg.value) + restArgs.map { it.value }
|
||||
val primArrayArgCandidate = convertPrimitivesArray(parameterType, argsSequence)
|
||||
if (primArrayArgCandidate != null)
|
||||
return ArgsConverter.Result.Success(primArrayArgCandidate)
|
||||
@@ -195,9 +199,9 @@ private class StringArgsConverter : ArgsConverter<String> {
|
||||
override fun tryConvertTail(
|
||||
parameter: KParameter,
|
||||
firstArg: NamedArgument<String>,
|
||||
restArgsIt: Iterator<NamedArgument<String>>
|
||||
restArgs: Sequence<NamedArgument<String>>
|
||||
): ArgsConverter.Result =
|
||||
tryConvertVararg(parameter, firstArg, restArgsIt)
|
||||
tryConvertVararg(parameter, firstArg, restArgs)
|
||||
}
|
||||
|
||||
private class AnyArgsConverter : ArgsConverter<Any> {
|
||||
@@ -218,18 +222,33 @@ private class AnyArgsConverter : ArgsConverter<Any> {
|
||||
else -> null
|
||||
}
|
||||
|
||||
if (value::class.isSubclassOf(parameter.type.jvmErasure)) return ArgsConverter.Result.Success(value)
|
||||
fun evaluateValue(arg: Any): Any? {
|
||||
if (arg::class.isSubclassOf(parameter.type.jvmErasure)) return arg
|
||||
return convertPrimitivesArray(parameter.type, arg)
|
||||
}
|
||||
|
||||
return convertPrimitivesArray(parameter.type, value)?.let { ArgsConverter.Result.Success(it) }
|
||||
?: ArgsConverter.Result.Failure
|
||||
evaluateValue(value)?.let { return ArgsConverter.Result.Success(it) }
|
||||
|
||||
// Handle the scenario where [arg::class] is an Array<Any>
|
||||
// but it's values could all still be valid
|
||||
val parameterKClass = parameter.type.classifier as? KClass<*>
|
||||
val arrayComponentType = parameterKClass?.java?.takeIf { it.isArray}?.componentType?.kotlin
|
||||
|
||||
if (value is Array<*> && arrayComponentType != null) {
|
||||
// TODO: Idea! Maybe we should check if the values in the array are compatible with [arrayComponentType]
|
||||
// if they aren't perhaps we should fail silently
|
||||
convertAnyArray(arrayComponentType, value.asSequence())?.let(::evaluateValue)?.let { return ArgsConverter.Result.Success(it) }
|
||||
}
|
||||
|
||||
return ArgsConverter.Result.Failure
|
||||
}
|
||||
|
||||
override fun tryConvertVararg(
|
||||
parameter: KParameter, firstArg: NamedArgument<Any>, restArgsIt: Iterator<NamedArgument<Any>>
|
||||
parameter: KParameter, firstArg: NamedArgument<Any>, restArgs: Sequence<NamedArgument<Any>>
|
||||
): ArgsConverter.Result {
|
||||
val parameterType = parameter.type
|
||||
if (parameterType.jvmErasure.java.isArray) {
|
||||
val argsSequence = sequenceOf(firstArg.value) + restArgsIt.asSequence().map { it.value }
|
||||
val argsSequence = sequenceOf(firstArg.value) + restArgs.map { it.value }
|
||||
val arrayElementType = parameterType.arguments.firstOrNull()?.type
|
||||
val arrayArgCandidate = convertAnyArray(arrayElementType?.classifier, argsSequence)
|
||||
if (arrayArgCandidate != null)
|
||||
@@ -242,7 +261,7 @@ private class AnyArgsConverter : ArgsConverter<Any> {
|
||||
override fun tryConvertTail(
|
||||
parameter: KParameter,
|
||||
firstArg: NamedArgument<Any>,
|
||||
restArgsIt: Iterator<NamedArgument<Any>>
|
||||
restArgs: Sequence<NamedArgument<Any>>
|
||||
): ArgsConverter.Result =
|
||||
tryConvertSingle(parameter, firstArg)
|
||||
}
|
||||
@@ -266,3 +285,38 @@ private fun <T> convertAnyArrayImpl(classifier: KClassifier?, args: Sequence<T?>
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/*
|
||||
An iterator that allows us to read the next value without consuming it.
|
||||
*/
|
||||
private class LookAheadIterator<T>(private val iterator: Iterator<T>) : Iterator<T> {
|
||||
private var currentLookAhead: T? = null
|
||||
|
||||
override fun hasNext(): Boolean {
|
||||
return currentLookAhead != null || iterator.hasNext()
|
||||
}
|
||||
|
||||
override fun next(): T {
|
||||
currentLookAhead?.let { value ->
|
||||
currentLookAhead = null
|
||||
return value
|
||||
}
|
||||
|
||||
return iterator.next()
|
||||
}
|
||||
|
||||
fun nextWithoutConsuming(): T {
|
||||
return currentLookAhead ?: iterator.next().also { currentLookAhead = it }
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Will return a sequence with the values of the iterator until the predicate evaluates to true.
|
||||
*/
|
||||
private fun <T> LookAheadIterator<T>.sequenceUntil(predicate: (T) -> Boolean): Sequence<T> = sequence {
|
||||
while (hasNext()) {
|
||||
if (predicate(nextWithoutConsuming()))
|
||||
break
|
||||
yield(next())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,6 +322,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
}
|
||||
|
||||
configuration.put(JSConfigurationKeys.PRINT_REACHABILITY_INFO, arguments.irDcePrintReachabilityInfo)
|
||||
configuration.put(JSConfigurationKeys.DISABLE_FAKE_OVERRIDE_VALIDATOR, arguments.disableFakeOverrideValidator)
|
||||
}
|
||||
|
||||
override fun executableScriptFileName(): String {
|
||||
|
||||
@@ -26,6 +26,7 @@ fun <A : CommonCompilerArguments> CompilerConfiguration.setupCommonArguments(
|
||||
put(CommonConfigurationKeys.EXPECT_ACTUAL_LINKER, arguments.expectActualLinker)
|
||||
putIfNotNull(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT, arguments.intellijPluginRoot)
|
||||
put(CommonConfigurationKeys.REPORT_OUTPUT_FILES, arguments.reportOutputFiles)
|
||||
put(CommonConfigurationKeys.DESERIALIZE_FAKE_OVERRIDES, arguments.deserializeFakeOverrides)
|
||||
|
||||
val metadataVersionString = arguments.metadataVersion
|
||||
if (metadataVersionString != null) {
|
||||
|
||||
@@ -31,6 +31,6 @@ interface MessageCollectorBasedReporter : DiagnosticMessageReporter {
|
||||
override fun report(diagnostic: Diagnostic, file: PsiFile, render: String) = messageCollector.report(
|
||||
AnalyzerWithCompilerReport.convertSeverity(diagnostic.severity),
|
||||
render,
|
||||
MessageUtil.psiFileToMessageLocation(file, file.name, DiagnosticUtils.getLineAndColumn(diagnostic))
|
||||
MessageUtil.psiFileToMessageLocation(file, file.name, DiagnosticUtils.getLineAndColumnRange(diagnostic))
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.cli.common.messages
|
||||
|
||||
import com.intellij.psi.PsiFile
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticUtils
|
||||
|
||||
/**
|
||||
* This class behaviour is the same as [MessageCollector.report] in [AnalyzerWithCompilerReport.reportDiagnostic].
|
||||
*/
|
||||
class DefaultDiagnosticReporter(override val messageCollector: MessageCollector) : MessageCollectorBasedReporter
|
||||
|
||||
interface MessageCollectorBasedReporter : DiagnosticMessageReporter {
|
||||
val messageCollector: MessageCollector
|
||||
|
||||
override fun report(diagnostic: Diagnostic, file: PsiFile, render: String) = messageCollector.report(
|
||||
AnalyzerWithCompilerReport.convertSeverity(diagnostic.severity),
|
||||
render,
|
||||
MessageUtil.psiFileToMessageLocation(file, file.name, DiagnosticUtils.getLineAndColumn(diagnostic))
|
||||
)
|
||||
}
|
||||
@@ -7,7 +7,7 @@ package org.jetbrains.kotlin.cli.common.messages
|
||||
|
||||
class GradleStyleMessageRenderer : MessageRenderer {
|
||||
|
||||
override fun render(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?): String {
|
||||
override fun render(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?): String {
|
||||
val prefix = when (severity) {
|
||||
CompilerMessageSeverity.WARNING, CompilerMessageSeverity.STRONG_WARNING -> "w"
|
||||
CompilerMessageSeverity.ERROR, CompilerMessageSeverity.EXCEPTION -> "e"
|
||||
|
||||
@@ -32,7 +32,7 @@ public interface MessageRenderer {
|
||||
MessageRenderer WITHOUT_PATHS = new PlainTextMessageRenderer() {
|
||||
@Nullable
|
||||
@Override
|
||||
protected String getPath(@NotNull CompilerMessageLocation location) {
|
||||
protected String getPath(@NotNull CompilerMessageSourceLocation location) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public interface MessageRenderer {
|
||||
MessageRenderer PLAIN_FULL_PATHS = new PlainTextMessageRenderer() {
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getPath(@NotNull CompilerMessageLocation location) {
|
||||
protected String getPath(@NotNull CompilerMessageSourceLocation location) {
|
||||
return location.getPath();
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public interface MessageRenderer {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getPath(@NotNull CompilerMessageLocation location) {
|
||||
protected String getPath(@NotNull CompilerMessageSourceLocation location) {
|
||||
return FileUtilsKt.descendantRelativeTo(new File(location.getPath()), cwd).getPath();
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public interface MessageRenderer {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected String getPath(@NotNull CompilerMessageLocation location) {
|
||||
protected String getPath(@NotNull CompilerMessageSourceLocation location) {
|
||||
return FileUtil.toSystemIndependentName(
|
||||
FileUtilsKt.descendantRelativeTo(new File(location.getPath()), cwd).getPath()
|
||||
);
|
||||
@@ -91,7 +91,7 @@ public interface MessageRenderer {
|
||||
|
||||
String renderPreamble();
|
||||
|
||||
String render(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageLocation location);
|
||||
String render(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageSourceLocation location);
|
||||
|
||||
String renderUsage(@NotNull String usage);
|
||||
|
||||
|
||||
@@ -32,21 +32,23 @@ public class MessageUtil {
|
||||
private MessageUtil() {}
|
||||
|
||||
@Nullable
|
||||
public static CompilerMessageLocation psiElementToMessageLocation(@Nullable PsiElement element) {
|
||||
public static CompilerMessageSourceLocation psiElementToMessageLocation(@Nullable PsiElement element) {
|
||||
if (element == null) return null;
|
||||
PsiFile file = element.getContainingFile();
|
||||
return psiFileToMessageLocation(file, "<no path>", DiagnosticUtils.getLineAndColumnInPsiFile(file, element.getTextRange()));
|
||||
return psiFileToMessageLocation(file, "<no path>", DiagnosticUtils.getLineAndColumnRangeInPsiFile(file, element.getTextRange()));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static CompilerMessageLocation psiFileToMessageLocation(
|
||||
public static CompilerMessageSourceLocation psiFileToMessageLocation(
|
||||
@NotNull PsiFile file,
|
||||
@Nullable String defaultValue,
|
||||
@NotNull PsiDiagnosticUtils.LineAndColumn lineAndColumn
|
||||
@NotNull PsiDiagnosticUtils.LineAndColumnRange range
|
||||
) {
|
||||
VirtualFile virtualFile = file.getVirtualFile();
|
||||
String path = virtualFile != null ? virtualFileToPath(virtualFile) : defaultValue;
|
||||
return CompilerMessageLocation.create(path, lineAndColumn.getLine(), lineAndColumn.getColumn(), lineAndColumn.getLineContent());
|
||||
PsiDiagnosticUtils.LineAndColumn start = range.getStart();
|
||||
PsiDiagnosticUtils.LineAndColumn end = range.getEnd();
|
||||
return CompilerMessageLocationWithRange.create(path, start.getLine(), start.getColumn(), end.getLine(), end.getColumn(), start.getLineContent());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.cli.common.messages;
|
||||
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticUtils;
|
||||
import org.jetbrains.kotlin.diagnostics.PsiDiagnosticUtils;
|
||||
|
||||
import static com.intellij.openapi.util.io.FileUtil.toSystemDependentName;
|
||||
|
||||
public class MessageUtil {
|
||||
private MessageUtil() {}
|
||||
|
||||
@Nullable
|
||||
public static CompilerMessageLocation psiElementToMessageLocation(@Nullable PsiElement element) {
|
||||
if (element == null) return null;
|
||||
PsiFile file = element.getContainingFile();
|
||||
return psiFileToMessageLocation(file, "<no path>", DiagnosticUtils.getLineAndColumnInPsiFile(file, element.getTextRange()));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static CompilerMessageLocation psiFileToMessageLocation(
|
||||
@NotNull PsiFile file,
|
||||
@Nullable String defaultValue,
|
||||
@NotNull PsiDiagnosticUtils.LineAndColumn lineAndColumn
|
||||
) {
|
||||
VirtualFile virtualFile = file.getVirtualFile();
|
||||
String path = virtualFile != null ? virtualFileToPath(virtualFile) : defaultValue;
|
||||
return CompilerMessageLocation.create(path, lineAndColumn.getLine(), lineAndColumn.getColumn(), lineAndColumn.getLineContent());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String virtualFileToPath(@NotNull VirtualFile virtualFile) {
|
||||
return toSystemDependentName(virtualFile.getPath());
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public abstract class PlainTextMessageRenderer implements MessageRenderer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String render(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageLocation location) {
|
||||
public String render(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageSourceLocation location) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
int line = location != null ? location.getLine() : -1;
|
||||
@@ -156,7 +156,7 @@ public abstract class PlainTextMessageRenderer implements MessageRenderer {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected abstract String getPath(@NotNull CompilerMessageLocation location);
|
||||
protected abstract String getPath(@NotNull CompilerMessageSourceLocation location);
|
||||
|
||||
@Override
|
||||
public String renderUsage(@NotNull String usage) {
|
||||
|
||||
@@ -42,7 +42,7 @@ public class PrintingMessageCollector implements MessageCollector {
|
||||
public void report(
|
||||
@NotNull CompilerMessageSeverity severity,
|
||||
@NotNull String message,
|
||||
@Nullable CompilerMessageLocation location
|
||||
@Nullable CompilerMessageSourceLocation location
|
||||
) {
|
||||
if (!verbose && CompilerMessageSeverity.VERBOSE.contains(severity)) return;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public class XmlMessageRenderer implements MessageRenderer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String render(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageLocation location) {
|
||||
public String render(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageSourceLocation location) {
|
||||
StringBuilder out = new StringBuilder();
|
||||
String tagName = severity.getPresentableName();
|
||||
out.append("<").append(tagName);
|
||||
|
||||
@@ -66,6 +66,7 @@ import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.ImplicitsExtensionsResolutionFilter
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolver
|
||||
import org.jetbrains.kotlin.resolve.jvm.extensions.AnalysisHandlerExtension
|
||||
import org.jetbrains.kotlin.resolve.jvm.extensions.PackageFragmentProviderExtension
|
||||
@@ -135,7 +136,8 @@ object TopDownAnalyzerFacadeForJVM {
|
||||
declarationProviderFactory: (StorageManager, Collection<KtFile>) -> DeclarationProviderFactory,
|
||||
targetEnvironment: TargetEnvironment = CompilerEnvironment,
|
||||
sourceModuleSearchScope: GlobalSearchScope = newModuleSearchScope(project, files),
|
||||
klibList: List<KotlinLibrary> = emptyList()
|
||||
klibList: List<KotlinLibrary> = emptyList(),
|
||||
implicitsResolutionFilter: ImplicitsExtensionsResolutionFilter? = null
|
||||
): ComponentProvider {
|
||||
val jvmTarget = configuration.get(JVMConfigurationKeys.JVM_TARGET, JvmTarget.DEFAULT)
|
||||
val languageVersionSettings = configuration.languageVersionSettings
|
||||
@@ -186,7 +188,8 @@ object TopDownAnalyzerFacadeForJVM {
|
||||
targetEnvironment, lookupTracker, expectActualTracker,
|
||||
packagePartProvider(dependencyScope), languageVersionSettings,
|
||||
useBuiltInsProvider = true,
|
||||
configureJavaClassFinder = configureJavaClassFinder
|
||||
configureJavaClassFinder = configureJavaClassFinder,
|
||||
implicitsResolutionFilter = implicitsResolutionFilter
|
||||
)
|
||||
|
||||
moduleClassResolver.compiledCodeResolver = dependenciesContainer.get()
|
||||
@@ -220,7 +223,8 @@ object TopDownAnalyzerFacadeForJVM {
|
||||
partProvider, languageVersionSettings,
|
||||
useBuiltInsProvider = true,
|
||||
configureJavaClassFinder = configureJavaClassFinder,
|
||||
javaClassTracker = configuration[JVMConfigurationKeys.JAVA_CLASSES_TRACKER]
|
||||
javaClassTracker = configuration[JVMConfigurationKeys.JAVA_CLASSES_TRACKER],
|
||||
implicitsResolutionFilter = implicitsResolutionFilter
|
||||
).apply {
|
||||
initJvmBuiltInsForTopDownAnalysis()
|
||||
(partProvider as? IncrementalPackagePartProvider)?.deserializationConfiguration = get()
|
||||
|
||||
@@ -38,6 +38,17 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu
|
||||
}
|
||||
}
|
||||
|
||||
val jvmTarget = get(JVMConfigurationKeys.JVM_TARGET) ?: JvmTarget.DEFAULT
|
||||
if (jvmTarget.bytecodeVersion < JvmTarget.JVM_1_8.bytecodeVersion) {
|
||||
val jvmDefaultMode = languageVersionSettings.getFlag(JvmAnalysisFlags.jvmDefaultMode)
|
||||
if (jvmDefaultMode.forAllMethodsWithBody) {
|
||||
messageCollector.report(
|
||||
ERROR,
|
||||
"'-Xjvm-default=${jvmDefaultMode.description}' is only supported since JVM target 1.8. Recompile with '-jvm-target 1.8'"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
addAll(JVMConfigurationKeys.ADDITIONAL_JAVA_MODULES, arguments.additionalJavaModules?.asList())
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.jetbrains.kotlin.compiler.plugin.*
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import java.io.File
|
||||
import java.net.URLClassLoader
|
||||
import java.util.*
|
||||
|
||||
object PluginCliParser {
|
||||
@JvmStatic
|
||||
@@ -78,44 +77,52 @@ object PluginCliParser {
|
||||
configuration: CompilerConfiguration,
|
||||
classLoader: URLClassLoader
|
||||
) {
|
||||
val optionValuesByPlugin = pluginOptions?.map(::parsePluginOption)?.groupBy {
|
||||
if (it == null) throw CliOptionProcessingException("Wrong plugin option format: $it, should be ${CommonCompilerArguments.PLUGIN_OPTION_FORMAT}")
|
||||
it.pluginId
|
||||
} ?: mapOf()
|
||||
|
||||
// TODO issue a warning on using deprecated command line processors when all official plugin migrate to the newer convention
|
||||
val commandLineProcessors = ServiceLoaderLite.loadImplementations(CommandLineProcessor::class.java, classLoader)
|
||||
|
||||
for (processor in commandLineProcessors) {
|
||||
val declaredOptions = processor.pluginOptions.associateBy { it.optionName }
|
||||
val optionsToValues = MultiMap<AbstractCliOption, CliOptionValue>()
|
||||
processCompilerPluginsOptions(configuration, pluginOptions, commandLineProcessors)
|
||||
}
|
||||
}
|
||||
|
||||
for (optionValue in optionValuesByPlugin[processor.pluginId].orEmpty()) {
|
||||
val option = declaredOptions[optionValue!!.optionName]
|
||||
?: throw CliOptionProcessingException("Unsupported plugin option: $optionValue")
|
||||
optionsToValues.putValue(option, optionValue)
|
||||
fun processCompilerPluginsOptions(
|
||||
configuration: CompilerConfiguration,
|
||||
pluginOptions: Iterable<String>?,
|
||||
commandLineProcessors: List<CommandLineProcessor>
|
||||
) {
|
||||
val optionValuesByPlugin = pluginOptions?.map(::parsePluginOption)?.groupBy {
|
||||
if (it == null) throw CliOptionProcessingException("Wrong plugin option format: $it, should be ${CommonCompilerArguments.PLUGIN_OPTION_FORMAT}")
|
||||
it.pluginId
|
||||
} ?: mapOf()
|
||||
|
||||
for (processor in commandLineProcessors) {
|
||||
val declaredOptions = processor.pluginOptions.associateBy { it.optionName }
|
||||
val optionsToValues = MultiMap<AbstractCliOption, CliOptionValue>()
|
||||
|
||||
for (optionValue in optionValuesByPlugin[processor.pluginId].orEmpty()) {
|
||||
val option = declaredOptions[optionValue!!.optionName]
|
||||
?: throw CliOptionProcessingException("Unsupported plugin option: $optionValue")
|
||||
optionsToValues.putValue(option, optionValue)
|
||||
}
|
||||
|
||||
for (option in processor.pluginOptions) {
|
||||
val values = optionsToValues[option]
|
||||
if (option.required && values.isEmpty()) {
|
||||
throw PluginCliOptionProcessingException(
|
||||
processor.pluginId,
|
||||
processor.pluginOptions,
|
||||
"Required plugin option not present: ${processor.pluginId}:${option.optionName}"
|
||||
)
|
||||
}
|
||||
if (!option.allowMultipleOccurrences && values.size > 1) {
|
||||
throw PluginCliOptionProcessingException(
|
||||
processor.pluginId,
|
||||
processor.pluginOptions,
|
||||
"Multiple values are not allowed for plugin option ${processor.pluginId}:${option.optionName}"
|
||||
)
|
||||
}
|
||||
|
||||
for (option in processor.pluginOptions) {
|
||||
val values = optionsToValues[option]
|
||||
if (option.required && values.isEmpty()) {
|
||||
throw PluginCliOptionProcessingException(
|
||||
processor.pluginId,
|
||||
processor.pluginOptions,
|
||||
"Required plugin option not present: ${processor.pluginId}:${option.optionName}"
|
||||
)
|
||||
}
|
||||
if (!option.allowMultipleOccurrences && values.size > 1) {
|
||||
throw PluginCliOptionProcessingException(
|
||||
processor.pluginId,
|
||||
processor.pluginOptions,
|
||||
"Multiple values are not allowed for plugin option ${processor.pluginId}:${option.optionName}"
|
||||
)
|
||||
}
|
||||
|
||||
for (value in values) {
|
||||
processor.processOption(option, value.value, configuration)
|
||||
}
|
||||
for (value in values) {
|
||||
processor.processOption(option, value.value, configuration)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.cli.jvm.config.K2MetadataConfigurationKeys
|
||||
import org.jetbrains.kotlin.cli.jvm.config.addJvmClasspathRoots
|
||||
import org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser
|
||||
import org.jetbrains.kotlin.codegen.CompilationException
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
|
||||
@@ -19,7 +19,7 @@ public class KotlinCompilerVersion {
|
||||
// Binaries produced by this compiler with that language version (or any future language version) are going to be marked
|
||||
// as "pre-release" and will not be loaded by release versions of the compiler.
|
||||
// Change this value before and after every major release
|
||||
private static final boolean IS_PRE_RELEASE = true;
|
||||
private static final boolean IS_PRE_RELEASE = false;
|
||||
|
||||
public static final String TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY = "kotlin.test.is.pre.release";
|
||||
|
||||
|
||||
@@ -47,6 +47,9 @@ object CommonConfigurationKeys {
|
||||
|
||||
@JvmField
|
||||
val EXPECT_ACTUAL_LINKER = CompilerConfigurationKey.create<Boolean>("Experimental expext/actual linker")
|
||||
|
||||
@JvmField
|
||||
val DESERIALIZE_FAKE_OVERRIDES = CompilerConfigurationKey.create<Boolean>("Deserialize fake overrides")
|
||||
}
|
||||
|
||||
var CompilerConfiguration.languageVersionSettings: LanguageVersionSettings
|
||||
|
||||
@@ -6,19 +6,21 @@
|
||||
package org.jetbrains.kotlin.daemon.client.experimental
|
||||
|
||||
import io.ktor.network.sockets.Socket
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.Deferred
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.daemon.client.CompileServiceSessionAsync
|
||||
import org.jetbrains.kotlin.daemon.client.KotlinCompilerDaemonClient
|
||||
import org.jetbrains.kotlin.daemon.client.DaemonReportMessage
|
||||
import org.jetbrains.kotlin.daemon.client.DaemonReportingTargets
|
||||
import org.jetbrains.kotlin.daemon.client.KotlinCompilerDaemonClient
|
||||
import org.jetbrains.kotlin.daemon.client.launchProcessWithFallback
|
||||
import org.jetbrains.kotlin.daemon.common.*
|
||||
import org.jetbrains.kotlin.daemon.common.Profiler
|
||||
import org.jetbrains.kotlin.daemon.common.experimental.*
|
||||
import org.jetbrains.kotlin.daemon.common.experimental.socketInfrastructure.Server
|
||||
import org.jetbrains.kotlin.daemon.common.experimental.socketInfrastructure.ServerSocketWrapper
|
||||
import org.jetbrains.kotlin.daemon.common.*
|
||||
import java.io.File
|
||||
import java.io.Serializable
|
||||
import java.net.SocketException
|
||||
@@ -30,7 +32,6 @@ import java.util.concurrent.Semaphore
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.logging.Logger
|
||||
import kotlin.concurrent.thread
|
||||
import org.jetbrains.kotlin.daemon.client.launchProcessWithFallback
|
||||
|
||||
|
||||
class KotlinCompilerClient : KotlinCompilerDaemonClient {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.daemon.client
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
|
||||
@@ -66,7 +66,7 @@ fun MessageCollector.reportFromDaemon(outputsCollector: ((File, List<File>) -> U
|
||||
else -> throw IllegalStateException("Unexpected compiler message report severity $severity")
|
||||
}
|
||||
if (message != null) {
|
||||
report(compilerSeverity, message, attachment as? CompilerMessageLocation)
|
||||
report(compilerSeverity, message, attachment as? CompilerMessageSourceLocation)
|
||||
}
|
||||
else {
|
||||
reportUnexpected(category, severity, message, attachment)
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.daemon
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
|
||||
@@ -181,7 +181,7 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
|
||||
class TestMessageCollector : MessageCollector {
|
||||
data class Message(val severity: CompilerMessageSeverity, val message: String, val location: CompilerMessageLocation?)
|
||||
data class Message(val severity: CompilerMessageSeverity, val message: String, val location: CompilerMessageSourceLocation?)
|
||||
|
||||
val messages = arrayListOf<Message>()
|
||||
|
||||
@@ -189,7 +189,7 @@ class TestMessageCollector : MessageCollector {
|
||||
messages.clear()
|
||||
}
|
||||
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
|
||||
messages.add(Message(severity, message, location))
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ package org.jetbrains.kotlin.daemon.experimental.integration
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
|
||||
@@ -301,7 +301,7 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
|
||||
class TestMessageCollector : MessageCollector {
|
||||
data class Message(val severity: CompilerMessageSeverity, val message: String, val location: CompilerMessageLocation?)
|
||||
data class Message(val severity: CompilerMessageSeverity, val message: String, val location: CompilerMessageSourceLocation?)
|
||||
|
||||
val messages = arrayListOf<Message>()
|
||||
|
||||
@@ -309,7 +309,7 @@ class TestMessageCollector : MessageCollector {
|
||||
messages.clear()
|
||||
}
|
||||
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
|
||||
messages.add(Message(severity, message, location))
|
||||
}
|
||||
|
||||
|
||||
@@ -168,9 +168,9 @@ internal class KeepFirstErrorMessageCollector(compilerMessagesStream: PrintStrea
|
||||
private val innerCollector = PrintingMessageCollector(compilerMessagesStream, MessageRenderer.WITHOUT_PATHS, false)
|
||||
|
||||
internal var firstErrorMessage: String? = null
|
||||
internal var firstErrorLocation: CompilerMessageLocation? = null
|
||||
internal var firstErrorLocation: CompilerMessageSourceLocation? = null
|
||||
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
|
||||
if (firstErrorMessage == null && severity.isError) {
|
||||
firstErrorMessage = message
|
||||
firstErrorLocation = location
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.daemon.report
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageRenderer
|
||||
@@ -34,7 +34,7 @@ internal class CompileServicesFacadeMessageCollector(
|
||||
hasErrors = false
|
||||
}
|
||||
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
|
||||
log.info("Message: " + MessageRenderer.WITHOUT_PATHS.render(severity, message, location))
|
||||
when (severity) {
|
||||
CompilerMessageSeverity.OUTPUT -> {
|
||||
|
||||
@@ -5,17 +5,14 @@
|
||||
|
||||
package org.jetbrains.kotlin.daemon.report.experimental
|
||||
|
||||
import kotlinx.coroutines.*
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.async
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageRenderer
|
||||
import org.jetbrains.kotlin.daemon.KotlinCompileDaemon.log
|
||||
import org.jetbrains.kotlin.daemon.common.CompilationOptions
|
||||
import org.jetbrains.kotlin.daemon.common.ReportCategory
|
||||
import org.jetbrains.kotlin.daemon.common.ReportSeverity
|
||||
import org.jetbrains.kotlin.daemon.common.CompilerServicesFacadeBaseAsync
|
||||
import org.jetbrains.kotlin.daemon.common.report
|
||||
import org.jetbrains.kotlin.daemon.common.*
|
||||
|
||||
internal class CompileServicesFacadeMessageCollector(
|
||||
private val servicesFacade: CompilerServicesFacadeBaseAsync,
|
||||
@@ -28,7 +25,7 @@ internal class CompileServicesFacadeMessageCollector(
|
||||
hasErrors = false
|
||||
}
|
||||
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
|
||||
GlobalScope.async {
|
||||
log.info("Message: " + MessageRenderer.WITHOUT_PATHS.render(severity, message, location))
|
||||
when (severity) {
|
||||
|
||||
@@ -358,6 +358,20 @@ public abstract interface Comparable<in T> : R|kotlin/Any| {
|
||||
|
||||
}
|
||||
|
||||
@R|kotlin/annotation/Target|() @R|kotlin/annotation/MustBeDocumented|() @R|kotlin/SinceKotlin|(version = String(1.4)) public final annotation class DeprecatedSinceKotlin : R|kotlin/Annotation| {
|
||||
public final val errorSince: R|kotlin/String|
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
public final val hiddenSince: R|kotlin/String|
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
public final val warningSince: R|kotlin/String|
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
public constructor(warningSince: R|kotlin/String| = STUB, errorSince: R|kotlin/String| = STUB, hiddenSince: R|kotlin/String| = STUB): R|kotlin/DeprecatedSinceKotlin|
|
||||
|
||||
}
|
||||
|
||||
public final enum class DeprecationLevel : R|kotlin/Enum<kotlin/DeprecationLevel>| {
|
||||
private constructor(): R|kotlin/DeprecationLevel|
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
class C(val map: MutableMap<String, Any>) {
|
||||
// NB: this does not work because of @LowPriorityInOverloadResolution not deserialized (KT-37228)
|
||||
var foo by <!AMBIGUITY!>map<!>
|
||||
var foo by map
|
||||
}
|
||||
|
||||
var bar by <!AMBIGUITY!>hashMapOf<String, Any>()<!>
|
||||
var bar by hashMapOf<String, Any>()
|
||||
@@ -7,19 +7,19 @@ FILE: simpleDelegatedToMap.kt
|
||||
public final val map: R|kotlin/collections/MutableMap<kotlin/String, kotlin/Any>| = R|<local>/map|
|
||||
public get(): R|kotlin/collections/MutableMap<kotlin/String, kotlin/Any>|
|
||||
|
||||
public final var foo: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>by R|<local>/map|
|
||||
public get(): <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]> {
|
||||
^ this@R|/C|.D|/C.foo|.<Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#(this@R|/C|, ::R|/C.foo|)
|
||||
public final var foo: R|kotlin/Any|by R|<local>/map|
|
||||
public get(): R|kotlin/Any| {
|
||||
^ this@R|/C|.D|/C.foo|.R|kotlin/collections/getValue|<R|kotlin/Any|, R|kotlin/Any|>(this@R|/C|, ::R|/C.foo|)
|
||||
}
|
||||
public set(<set-?>: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>): R|kotlin/Unit| {
|
||||
this@R|/C|.D|/C.foo|.<Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#(this@R|/C|, ::R|/C.foo|, R|<local>/foo|)
|
||||
public set(<set-?>: R|kotlin/Any|): R|kotlin/Unit| {
|
||||
this@R|/C|.D|/C.foo|.R|kotlin/collections/setValue|<R|kotlin/Any|>(this@R|/C|, ::R|/C.foo|, R|<local>/foo|)
|
||||
}
|
||||
|
||||
}
|
||||
public final var bar: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>by R|kotlin/collections/hashMapOf|<R|kotlin/String|, R|kotlin/Any|>()
|
||||
public get(): <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]> {
|
||||
^ D|/bar|.<Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#(Null(null), ::R|/bar|)
|
||||
public final var bar: R|ft<kotlin/Any, kotlin/Any?>!|by R|kotlin/collections/hashMapOf|<R|kotlin/String|, R|kotlin/Any|>()
|
||||
public get(): R|ft<kotlin/Any, kotlin/Any?>!| {
|
||||
^ D|/bar|.R|kotlin/collections/getValue|<R|ft<kotlin/Any, kotlin/Any?>!|, R|ft<kotlin/Any, kotlin/Any?>!|>(Null(null), ::R|/bar|)
|
||||
}
|
||||
public set(<set-?>: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>): R|kotlin/Unit| {
|
||||
D|/bar|.<Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#(Null(null), ::R|/bar|, R|<local>/bar|)
|
||||
public set(<set-?>: R|ft<kotlin/Any, kotlin/Any?>!|): R|kotlin/Unit| {
|
||||
D|/bar|.R|kotlin/collections/setValue|<R|ft<kotlin/Any, kotlin/Any?>!|>(Null(null), ::R|/bar|, R|<local>/bar|)
|
||||
}
|
||||
|
||||
@@ -1794,6 +1794,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/classVsPackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compatibilityResolveWithVarargAndOperatorCall.kt")
|
||||
public void testCompatibilityResolveWithVarargAndOperatorCall() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/compatibilityResolveWithVarargAndOperatorCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("constraintFromLHSWithCorrectDirection.kt")
|
||||
public void testConstraintFromLHSWithCorrectDirection() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/constraintFromLHSWithCorrectDirection.kt");
|
||||
@@ -1804,6 +1809,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/constraintFromLHSWithCorrectDirectionError.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("correctCandidateWithCompatibilityForSeveralCandidates.kt")
|
||||
public void testCorrectCandidateWithCompatibilityForSeveralCandidates() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/correctCandidateWithCompatibilityForSeveralCandidates.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("correctInfoAfterArrayLikeCall.kt")
|
||||
public void testCorrectInfoAfterArrayLikeCall() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/correctInfoAfterArrayLikeCall.kt");
|
||||
@@ -1914,6 +1924,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/noAmbiguityWhenAllReferencesAreInapplicable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noCompatibilityResolveWithProressiveModeForNI.kt")
|
||||
public void testNoCompatibilityResolveWithProressiveModeForNI() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/noCompatibilityResolveWithProressiveModeForNI.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noExceptionOnRedCodeWithArrayLikeCall.kt")
|
||||
public void testNoExceptionOnRedCodeWithArrayLikeCall() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/noExceptionOnRedCodeWithArrayLikeCall.kt");
|
||||
@@ -1939,6 +1954,21 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/referenceAdaptationCompatibility.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("referenceAdaptationHasDependencyOnApi14.kt")
|
||||
public void testReferenceAdaptationHasDependencyOnApi14() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/referenceAdaptationHasDependencyOnApi14.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("referenceToCompanionObjectMemberViaClassName.kt")
|
||||
public void testReferenceToCompanionObjectMemberViaClassName() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/referenceToCompanionObjectMemberViaClassName.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("referenceToCompanionObjectMemberViaClassNameCompatibility.kt")
|
||||
public void testReferenceToCompanionObjectMemberViaClassNameCompatibility() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/referenceToCompanionObjectMemberViaClassNameCompatibility.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("rewriteAtSliceOnGetOperator.kt")
|
||||
public void testRewriteAtSliceOnGetOperator() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/rewriteAtSliceOnGetOperator.kt");
|
||||
@@ -1964,6 +1994,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/typealiases.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unitAdaptationForReferenceCompatibility.kt")
|
||||
public void testUnitAdaptationForReferenceCompatibility() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/unitAdaptationForReferenceCompatibility.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unused.kt")
|
||||
public void testUnused() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/unused.kt");
|
||||
@@ -1974,6 +2009,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/whitespacesInExpression.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("withQuestionMarks.kt")
|
||||
public void testWithQuestionMarks() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/withQuestionMarks.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/callableReference/bound")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -2559,6 +2599,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedReferenceAgainstKCallable.kt")
|
||||
public void testAdaptedReferenceAgainstKCallable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/adaptedReferenceAgainstKCallable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedReferenceAgainstReflectionType.kt")
|
||||
public void testAdaptedReferenceAgainstReflectionType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/adaptedReferenceAgainstReflectionType.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInResolve() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/callableReference/resolve"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
@@ -2623,6 +2673,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/commonSupertypeFromReturnTypesOfCallableReference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compatibilityWarningOnReferenceAgainstReflectiveType.kt")
|
||||
public void testCompatibilityWarningOnReferenceAgainstReflectiveType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/compatibilityWarningOnReferenceAgainstReflectiveType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("constructor.kt")
|
||||
public void testConstructor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/constructor.kt");
|
||||
@@ -2708,6 +2763,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/multipleOutersAndMultipleCallableReferences.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedReferenceCallAgainstExpectedType.kt")
|
||||
public void testNestedReferenceCallAgainstExpectedType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/nestedReferenceCallAgainstExpectedType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noAmbiguityBetweenTopLevelAndMemberProperty.kt")
|
||||
public void testNoAmbiguityBetweenTopLevelAndMemberProperty() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/noAmbiguityBetweenTopLevelAndMemberProperty.kt");
|
||||
@@ -2718,6 +2778,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/noFakeDescriptorForObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overloadAmbiguityForSimpleLastExpressionOfBlock.kt")
|
||||
public void testOverloadAmbiguityForSimpleLastExpressionOfBlock() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/overloadAmbiguityForSimpleLastExpressionOfBlock.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overloads.kt")
|
||||
public void testOverloads() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/overloads.kt");
|
||||
@@ -2748,6 +2813,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/resolveEqualsOperatorWithAnyExpectedType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("resolveReferenceAgainstKFunctionAndKPrpoerty.kt")
|
||||
public void testResolveReferenceAgainstKFunctionAndKPrpoerty() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/resolveReferenceAgainstKFunctionAndKPrpoerty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("resolveTwoReferencesAgainstGenerics.kt")
|
||||
public void testResolveTwoReferencesAgainstGenerics() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/resolveTwoReferencesAgainstGenerics.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valVsFun.kt")
|
||||
public void testValVsFun() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/valVsFun.kt");
|
||||
@@ -3816,6 +3891,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/fieldAsClassDelegate.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("fieldInitialization.kt")
|
||||
public void testFieldInitialization() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/fieldInitialization.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("infiniteLoops.kt")
|
||||
public void testInfiniteLoops() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/infiniteLoops.kt");
|
||||
@@ -4626,6 +4706,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/coroutines"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("suspendInvokeInsideTry.kt")
|
||||
public void testSuspendInvokeInsideTry() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/coroutines/suspendInvokeInsideTry.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendInvokeInsideWhen.kt")
|
||||
public void testSuspendInvokeInsideWhen() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/coroutines/suspendInvokeInsideWhen.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/coroutines/callableReference")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -6131,6 +6221,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/overloadResolutionForSeveralProvideDelegates.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("provideDelegateOnFunctionalTypeWithThis.kt")
|
||||
public void testProvideDelegateOnFunctionalTypeWithThis() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateOnFunctionalTypeWithThis.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("provideDelegateOperatorDeclaration.kt")
|
||||
public void testProvideDelegateOperatorDeclaration() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateOperatorDeclaration.kt");
|
||||
@@ -6465,6 +6560,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedHidden.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("deprecatedHiddenOnCallableReferenceArgument.kt")
|
||||
public void testDeprecatedHiddenOnCallableReferenceArgument() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedHiddenOnCallableReferenceArgument.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("deprecatedInheritance.kt")
|
||||
public void testDeprecatedInheritance() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedInheritance.kt");
|
||||
@@ -6584,6 +6684,64 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
public void testWarningOnConstructorErrorOnClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/deprecated/warningOnConstructorErrorOnClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class DeprecatedSinceKotlin extends AbstractFirOldFrontendDiagnosticsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInDeprecatedSinceKotlin() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("checkValuesAreParseableAsVersion.kt")
|
||||
public void testCheckValuesAreParseableAsVersion() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/checkValuesAreParseableAsVersion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("deprecatedSinceKotlinDeclaration.kt")
|
||||
public void testDeprecatedSinceKotlinDeclaration() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinDeclaration.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("deprecatedSinceKotlinHiddenOnReferenceArgument.kt")
|
||||
public void testDeprecatedSinceKotlinHiddenOnReferenceArgument() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinHiddenOnReferenceArgument.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("deprecatedSinceKotlinOutsideKotlinPackage.kt")
|
||||
public void testDeprecatedSinceKotlinOutsideKotlinPackage() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinOutsideKotlinPackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("deprecatedSinceKotlinWithoutArguments.kt")
|
||||
public void testDeprecatedSinceKotlinWithoutArguments() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinWithoutArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("error.kt")
|
||||
public void testError() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/error.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("hidden.kt")
|
||||
public void testHidden() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("messageFromDeprecatedAnnotation.kt")
|
||||
public void testMessageFromDeprecatedAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/messageFromDeprecatedAnnotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("warning.kt")
|
||||
public void testWarning() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/warning.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/duplicateJvmSignature")
|
||||
@@ -7969,6 +8127,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/funInterface/noCompatibilityResolveForFunInterfaces.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("prohibitFunInterfaceConstructorReferences.kt")
|
||||
public void testProhibitFunInterfaceConstructorReferences() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/funInterface/prohibitFunInterfaceConstructorReferences.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("resolveFunInterfaceWithoutMainMethod.kt")
|
||||
public void testResolveFunInterfaceWithoutMainMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/funInterface/resolveFunInterfaceWithoutMainMethod.kt");
|
||||
@@ -9931,6 +10094,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/inference/commonSuperTypeOfErrorTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compatibilityResolveWhenVariableHasComplexIntersectionType.kt")
|
||||
public void testCompatibilityResolveWhenVariableHasComplexIntersectionType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/compatibilityResolveWhenVariableHasComplexIntersectionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("completeInferenceIfManyFailed.kt")
|
||||
public void testCompleteInferenceIfManyFailed() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/completeInferenceIfManyFailed.kt");
|
||||
@@ -9966,6 +10134,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/inference/dependantOnVarianceNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("equalitySubstitutionInsideNonInvariantType.kt")
|
||||
public void testEqualitySubstitutionInsideNonInvariantType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/equalitySubstitutionInsideNonInvariantType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("expectedTypeAdditionalTest.kt")
|
||||
public void testExpectedTypeAdditionalTest() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/expectedTypeAdditionalTest.kt");
|
||||
@@ -10076,6 +10249,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/inference/intersectionTypeMultipleBoundsAsReceiver.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("intersectionTypesWithContravariantTypes.kt")
|
||||
public void testIntersectionTypesWithContravariantTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/intersectionTypesWithContravariantTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("intersectionWithEnum.kt")
|
||||
public void testIntersectionWithEnum() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/intersectionWithEnum.kt");
|
||||
@@ -10261,6 +10439,21 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/inference/resolveWithUnknownLambdaParameterType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("returningLambdaInSuspendContext.kt")
|
||||
public void testReturningLambdaInSuspendContext() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/returningLambdaInSuspendContext.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleLambdaInCallWithAnotherLambdaWithBuilderInference.kt")
|
||||
public void testSimpleLambdaInCallWithAnotherLambdaWithBuilderInference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/simpleLambdaInCallWithAnotherLambdaWithBuilderInference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("skipedUnresolvedInBuilderInferenceWithStubReceiverType.kt")
|
||||
public void testSkipedUnresolvedInBuilderInferenceWithStubReceiverType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/skipedUnresolvedInBuilderInferenceWithStubReceiverType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starApproximation.kt")
|
||||
public void testStarApproximation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/starApproximation.kt");
|
||||
@@ -10398,6 +10591,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturedTypeWithTypeVariableSubtyping.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("capturingFromArgumentOfFlexibleType.kt")
|
||||
public void testCapturingFromArgumentOfFlexibleType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturingFromArgumentOfFlexibleType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("expectedTypeMismatchWithInVariance.kt")
|
||||
public void testExpectedTypeMismatchWithInVariance() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/expectedTypeMismatchWithInVariance.kt");
|
||||
@@ -10491,6 +10689,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitReference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("coercionToUnitWithNothingType.kt")
|
||||
public void testCoercionToUnitWithNothingType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitWithNothingType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("coercionWithExpectedType.kt")
|
||||
public void testCoercionWithExpectedType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionWithExpectedType.kt");
|
||||
@@ -10511,6 +10714,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionWithoutExpectedType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("coerctionToUnitForATypeWithUpperBound.kt")
|
||||
public void testCoerctionToUnitForATypeWithUpperBound() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/coercionToUnit/coerctionToUnitForATypeWithUpperBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("coersionWithAnonymousFunctionsAndUnresolved.kt")
|
||||
public void testCoersionWithAnonymousFunctionsAndUnresolved() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/coercionToUnit/coersionWithAnonymousFunctionsAndUnresolved.kt");
|
||||
@@ -10818,6 +11026,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
public void testTakingExtensibilityFromDeclarationOfAnonymousFunction() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/takingExtensibilityFromDeclarationOfAnonymousFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("wrongVariableFixationOrder.kt")
|
||||
public void testWrongVariableFixationOrder() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/wrongVariableFixationOrder.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("wrongVariableFixationOrder2.kt")
|
||||
public void testWrongVariableFixationOrder2() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/wrongVariableFixationOrder2.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11164,6 +11382,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/inference/nothingType/nothingWithCallableReference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nullableExpectedTypeFromVariable.kt")
|
||||
public void testNullableExpectedTypeFromVariable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/nothingType/nullableExpectedTypeFromVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("platformNothingAsUsefulConstraint.kt")
|
||||
public void testPlatformNothingAsUsefulConstraint() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/nothingType/platformNothingAsUsefulConstraint.kt");
|
||||
@@ -11173,6 +11396,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
public void testReifiedParameterWithRecursiveBound() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/nothingType/reifiedParameterWithRecursiveBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("specialCallWithMaterializeAndExpectedType.kt")
|
||||
public void testSpecialCallWithMaterializeAndExpectedType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/nothingType/specialCallWithMaterializeAndExpectedType.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/inference/publicApproximation")
|
||||
@@ -13631,6 +13859,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/sam/compatibilityResolveToOuterScopeForKotlinFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("conversionForDerivedGenericClass.kt")
|
||||
public void testConversionForDerivedGenericClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/sam/conversionForDerivedGenericClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("conversionsWithNestedGenerics.kt")
|
||||
public void testConversionsWithNestedGenerics() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/sam/conversionsWithNestedGenerics.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("enhancedSamConstructor.kt")
|
||||
public void testEnhancedSamConstructor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.kt");
|
||||
@@ -13651,6 +13889,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/sam/kt37920.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt39630.kt")
|
||||
public void testKt39630() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/sam/kt39630.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("privateCandidatesWithWrongArguments.kt")
|
||||
public void testPrivateCandidatesWithWrongArguments() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/sam/privateCandidatesWithWrongArguments.kt");
|
||||
@@ -13661,6 +13904,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/sam/recursiveSamsAndInvoke.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("referenceToSamFunctionAgainstExpectedType.kt")
|
||||
public void testReferenceToSamFunctionAgainstExpectedType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/sam/referenceToSamFunctionAgainstExpectedType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("samOnTypeParameter.kt")
|
||||
public void testSamOnTypeParameter() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/sam/samOnTypeParameter.kt");
|
||||
@@ -15241,6 +15489,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/oldInference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("secondNamed.kt")
|
||||
public void testSecondNamed() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/secondNamed.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/simple.kt");
|
||||
@@ -19523,6 +19776,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/samConversions/checkSamConversionsAreDisabledByDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("conversionOnLambdaAsLastExpression.kt")
|
||||
public void testConversionOnLambdaAsLastExpression() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/samConversions/conversionOnLambdaAsLastExpression.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("DisabledForKTSimple.kt")
|
||||
public void testDisabledForKTSimple() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/samConversions/DisabledForKTSimple.kt");
|
||||
@@ -19538,6 +19796,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/samConversions/GenericSubstitutionKT.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaMemberAgainstExtension.kt")
|
||||
public void testJavaMemberAgainstExtension() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/samConversions/javaMemberAgainstExtension.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("OverloadPriority.kt")
|
||||
public void testOverloadPriority() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/samConversions/OverloadPriority.kt");
|
||||
@@ -21362,6 +21625,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/smartcastOnSameFieldOfDifferentInstances.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("smartcastToNothingAfterCheckingForNull.kt")
|
||||
public void testSmartcastToNothingAfterCheckingForNull() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/smartcastToNothingAfterCheckingForNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("thisWithLabel.kt")
|
||||
public void testThisWithLabel() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/thisWithLabel.kt");
|
||||
@@ -24429,6 +24697,64 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/unitConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class UnitConversion extends AbstractFirOldFrontendDiagnosticsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInUnitConversion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/unitConversion"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("chainedFunSuspendUnitConversion.kt")
|
||||
public void testChainedFunSuspendUnitConversion() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/unitConversion/chainedFunSuspendUnitConversion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("chainedFunUnitConversion.kt")
|
||||
public void testChainedFunUnitConversion() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/unitConversion/chainedFunUnitConversion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("chainedUnitSuspendConversion.kt")
|
||||
public void testChainedUnitSuspendConversion() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/unitConversion/chainedUnitSuspendConversion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noUnitConversionForGenericTypeFromArrow.kt")
|
||||
public void testNoUnitConversionForGenericTypeFromArrow() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/unitConversion/noUnitConversionForGenericTypeFromArrow.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noUnitConversionOnReturningGenericFunctionalType.kt")
|
||||
public void testNoUnitConversionOnReturningGenericFunctionalType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/unitConversion/noUnitConversionOnReturningGenericFunctionalType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unitConversionCompatibility.kt")
|
||||
public void testUnitConversionCompatibility() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/unitConversion/unitConversionCompatibility.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unitConversionDisabledForSimpleArguments.kt")
|
||||
public void testUnitConversionDisabledForSimpleArguments() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/unitConversion/unitConversionDisabledForSimpleArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unitConversionForAllKinds.kt")
|
||||
public void testUnitConversionForAllKinds() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/unitConversion/unitConversionForAllKinds.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unitConversionForSubtypes.kt")
|
||||
public void testUnitConversionForSubtypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/unitConversion/unitConversionForSubtypes.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/varargs")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -24491,6 +24817,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/varargs/assigningSingleElementsInNamedFormFunDeprecation_before.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inferredNullableArrayAsVararg.kt")
|
||||
public void testInferredNullableArrayAsVararg() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/varargs/inferredNullableArrayAsVararg.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt1781.kt")
|
||||
public void testKt1781() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/varargs/kt1781.kt");
|
||||
|
||||
@@ -561,6 +561,52 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi
|
||||
public void testTarget8() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target8.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/allCompatibility")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class AllCompatibility extends AbstractFirOldFrontendDiagnosticsTestWithStdlib {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInAllCompatibility() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/allCompatibility"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("specialization.kt")
|
||||
public void testSpecialization() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/allCompatibility/specialization.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class JvmDefaultWithoutCompatibility extends AbstractFirOldFrontendDiagnosticsTestWithStdlib {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInJvmDefaultWithoutCompatibility() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("target6.kt")
|
||||
public void testTarget6() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("target8.kt")
|
||||
public void testTarget8() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("target8Disabled.kt")
|
||||
public void testTarget8Disabled() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8Disabled.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmField")
|
||||
@@ -1835,6 +1881,11 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/factoryPattern/overloadByLambdaReturnType_enabled_no_annotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("referenceWithTheSameNameAsContainingProperty.kt")
|
||||
public void testReferenceWithTheSameNameAsContainingProperty() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/factoryPattern/referenceWithTheSameNameAsContainingProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("resolutionInOldInference.kt")
|
||||
public void testResolutionInOldInference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/factoryPattern/resolutionInOldInference.kt");
|
||||
|
||||
@@ -93,7 +93,13 @@ class FirJvmSerializerExtension @JvmOverloads constructor(
|
||||
writeVersionRequirementForJvmDefaultIfNeeded(klass, proto, versionRequirementTable)
|
||||
|
||||
if (jvmDefaultMode.forAllMethodsWithBody && klass is FirRegularClass && klass.classKind == ClassKind.INTERFACE) {
|
||||
proto.setExtension(JvmProtoBuf.jvmClassFlags, JvmFlags.getClassFlags(true))
|
||||
proto.setExtension(
|
||||
JvmProtoBuf.jvmClassFlags,
|
||||
JvmFlags.getClassFlags(
|
||||
jvmDefaultMode.forAllMethodsWithBody,
|
||||
JvmDefaultMode.ALL_COMPATIBILITY == jvmDefaultMode
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1284,9 +1284,9 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/boxingOptimization/kt6842.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("maxMinBy.kt")
|
||||
public void testMaxMinBy() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/boxingOptimization/maxMinBy.kt");
|
||||
@TestMetadata("maxMinByOrNull.kt")
|
||||
public void testMaxMinByOrNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/boxingOptimization/maxMinByOrNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nullCheck.kt")
|
||||
@@ -1707,6 +1707,16 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
public void testLackOfNullCheckOnNullableInsideBuild() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/lackOfNullCheckOnNullableInsideBuild.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("substituteStubTypeIntoCR.kt")
|
||||
public void testSubstituteStubTypeIntoCR() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/substituteStubTypeIntoCR.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("substituteStubTypeIntolambdaParameterDescriptor.kt")
|
||||
public void testSubstituteStubTypeIntolambdaParameterDescriptor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builderInference/substituteStubTypeIntolambdaParameterDescriptor.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods")
|
||||
@@ -2090,6 +2100,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/noReflectionForAdaptedCallableReferencesWithSuspendConversion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("referenceToVarargWithDefaults.kt")
|
||||
public void testReferenceToVarargWithDefaults() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/referenceToVarargWithDefaults.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("reflectionForVarargAsArray.kt")
|
||||
public void testReflectionForVarargAsArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/reflectionForVarargAsArray.kt");
|
||||
@@ -2685,6 +2700,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/callableReference/function/privateClassMember.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("referenceToCompanionMember.kt")
|
||||
public void testReferenceToCompanionMember() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/function/referenceToCompanionMember.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("sortListOfStrings.kt")
|
||||
public void testSortListOfStrings() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/function/sortListOfStrings.kt");
|
||||
@@ -5097,9 +5117,9 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/contracts/exception.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("field.kt")
|
||||
public void testField() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/contracts/field.kt");
|
||||
@TestMetadata("fieldReadInConstructor.kt")
|
||||
public void testFieldReadInConstructor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/contracts/fieldReadInConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("forLoop.kt")
|
||||
@@ -5117,6 +5137,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/contracts/lambdaParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("listAppend.kt")
|
||||
public void testListAppend() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/contracts/listAppend.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valInWhen.kt")
|
||||
public void testValInWhen() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/contracts/valInWhen.kt");
|
||||
@@ -9567,6 +9592,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/genericDelegateWithNoAdditionalInfo.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericProvideDelegateOnNumberLiteral.kt")
|
||||
public void testGenericProvideDelegateOnNumberLiteral() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/genericProvideDelegateOnNumberLiteral.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("hostCheck.kt")
|
||||
public void testHostCheck() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/hostCheck.kt");
|
||||
@@ -10366,6 +10396,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/enum/kt2350.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt38996.kt")
|
||||
public void testKt38996() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/enum/kt38996.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt7257.kt")
|
||||
public void testKt7257() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/enum/kt7257.kt");
|
||||
@@ -11200,6 +11235,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/funInterface/basicFunInterfaceConversion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("basicFunInterfaceConversionClash.kt")
|
||||
public void testBasicFunInterfaceConversionClash() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/funInterface/basicFunInterfaceConversionClash.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("castFromAny.kt")
|
||||
public void testCastFromAny() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/funInterface/castFromAny.kt");
|
||||
@@ -11235,6 +11275,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/funInterface/multimodule.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonAbstractMethod.kt")
|
||||
public void testNonAbstractMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/funInterface/nonAbstractMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nullableSam.kt")
|
||||
public void testNullableSam() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/funInterface/nullableSam.kt");
|
||||
@@ -12325,6 +12370,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("approximateNonTopLevelCapturedTypes.kt")
|
||||
public void testApproximateNonTopLevelCapturedTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/approximateNonTopLevelCapturedTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("builderInference.kt")
|
||||
public void testBuilderInference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference.kt");
|
||||
@@ -12385,6 +12435,16 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/inference/lastExpressionOfLambdaWithNothingConstraint.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noNothingValueInsideSpecialCall.kt")
|
||||
public void testNoNothingValueInsideSpecialCall() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/noNothingValueInsideSpecialCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("plusAssignInsideLambda.kt")
|
||||
public void testPlusAssignInsideLambda() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unsafeVarianceCodegen.kt")
|
||||
public void testUnsafeVarianceCodegen() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/unsafeVarianceCodegen.kt");
|
||||
@@ -13023,6 +13083,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/noReturnTypeMangling.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noReturnTypeManglingJvmName.kt")
|
||||
public void testNoReturnTypeManglingJvmName() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/noReturnTypeManglingJvmName.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nullableEqeqNonNull.kt")
|
||||
public void testNullableEqeqNonNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/nullableEqeqNonNull.kt");
|
||||
@@ -14487,6 +14552,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
public void testTostring() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/intrinsics/tostring.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("trimMarginWithBlankString.kt")
|
||||
public void testTrimMarginWithBlankString() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/intrinsics/trimMarginWithBlankString.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ir")
|
||||
@@ -14501,6 +14571,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousClassLeak.kt")
|
||||
public void testAnonymousClassLeak() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ir/anonymousClassLeak.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObjectInForLoopIteratorAndBody.kt")
|
||||
public void testAnonymousObjectInForLoopIteratorAndBody() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ir/anonymousObjectInForLoopIteratorAndBody.kt");
|
||||
@@ -14551,6 +14626,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/ir/kt29833.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt40083.kt")
|
||||
public void testKt40083() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ir/kt40083.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("objectClass.kt")
|
||||
public void testObjectClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ir/objectClass.kt");
|
||||
@@ -15268,6 +15348,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/jvm8/defaults/kt14243_prop.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt40920.kt")
|
||||
public void testKt40920() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvm8/defaults/kt40920.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("oneImplementation.kt")
|
||||
public void testOneImplementation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvm8/defaults/oneImplementation.kt");
|
||||
@@ -15400,6 +15485,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgsViaAnonymousObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("funInterface.kt")
|
||||
public void testFunInterface() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/funInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inheritedFunctionWithDefaultParameters.kt")
|
||||
public void testInheritedFunctionWithDefaultParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedFunctionWithDefaultParameters.kt");
|
||||
@@ -15657,6 +15747,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/defaultArgsViaAnonymousObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("funInterface.kt")
|
||||
public void testFunInterface() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/funInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inheritedFunctionWithDefaultParameters.kt")
|
||||
public void testInheritedFunctionWithDefaultParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedFunctionWithDefaultParameters.kt");
|
||||
@@ -15682,6 +15777,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/kt14243_2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt40920.kt")
|
||||
public void testKt40920() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/kt40920.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("privateFunInInterface.kt")
|
||||
public void testPrivateFunInInterface() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/privateFunInInterface.kt");
|
||||
@@ -15719,6 +15819,24 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/delegationBy/simpleProperty.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/specialization")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Specialization extends AbstractFirBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSpecialization() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/specialization"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("basic.kt")
|
||||
public void testBasic() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/specialization/basic.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/jvm8/defaults/noDelegation")
|
||||
@@ -15843,6 +15961,26 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/jvm8/javaDefaults/invokeDefaultViaSuper.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt40920.kt")
|
||||
public void testKt40920() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvm8/javaDefaults/kt40920.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt40920_java.kt")
|
||||
public void testKt40920_java() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_java.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt40920_java2.kt")
|
||||
public void testKt40920_java2() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_java2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt40920_map.kt")
|
||||
public void testKt40920_map() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_map.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("longChainOfKotlinExtendsFromJavaWithDefault.kt")
|
||||
public void testLongChainOfKotlinExtendsFromJavaWithDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvm8/javaDefaults/longChainOfKotlinExtendsFromJavaWithDefault.kt");
|
||||
@@ -26033,6 +26171,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/mapping/types"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("allSupertypes.kt")
|
||||
public void testAllSupertypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/mapping/types/allSupertypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("annotationConstructorParameters.kt")
|
||||
public void testAnnotationConstructorParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/mapping/types/annotationConstructorParameters.kt");
|
||||
@@ -26048,6 +26191,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/reflection/mapping/types/constructors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("createType.kt")
|
||||
public void testCreateType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/mapping/types/createType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericArrayElementType.kt")
|
||||
public void testGenericArrayElementType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/mapping/types/genericArrayElementType.kt");
|
||||
|
||||
@@ -113,6 +113,10 @@ class FirJavaConstructor @FirImplementationDetail constructor(
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirConstructor {
|
||||
return this
|
||||
}
|
||||
|
||||
override var containerSource: DeserializedContainerSource? = null
|
||||
|
||||
override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef) {
|
||||
|
||||
@@ -6,10 +6,8 @@
|
||||
package org.jetbrains.kotlin.fir
|
||||
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys.CONTENT_ROOTS
|
||||
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY
|
||||
import org.jetbrains.kotlin.cli.common.config.KotlinSourceRoot
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
|
||||
@@ -17,9 +15,6 @@ import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
import java.io.FileOutputStream
|
||||
import java.io.PrintStream
|
||||
import kotlin.system.measureNanoTime
|
||||
@@ -87,7 +82,7 @@ class NonFirResolveModularizedTotalKotlinTest : AbstractModularizedTest() {
|
||||
|
||||
}
|
||||
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
|
||||
if (location != null)
|
||||
print(location.toString())
|
||||
print(":")
|
||||
|
||||
@@ -84,7 +84,6 @@ private class FirCallArgumentsProcessor(private val function: FirFunction<*>) {
|
||||
if (state == State.VARARG_POSITION) {
|
||||
completeVarargPositionArguments()
|
||||
}
|
||||
state = State.NAMED_ONLY_ARGUMENTS
|
||||
|
||||
processNamedArgument(argument, argumentName)
|
||||
}
|
||||
@@ -125,6 +124,8 @@ private class FirCallArgumentsProcessor(private val function: FirFunction<*>) {
|
||||
addDiagnostic(NamedArgumentNotAllowed(argument, function))
|
||||
}
|
||||
|
||||
val stateAllowsMixedNamedAndPositionArguments = state != State.NAMED_ONLY_ARGUMENTS
|
||||
state = State.NAMED_ONLY_ARGUMENTS
|
||||
val parameter = findParameterByName(argument, name) ?: return
|
||||
|
||||
result[parameter]?.let {
|
||||
@@ -134,7 +135,7 @@ private class FirCallArgumentsProcessor(private val function: FirFunction<*>) {
|
||||
|
||||
result[parameter] = ResolvedCallArgument.SimpleArgument(argument)
|
||||
|
||||
if (parameters.getOrNull(currentPositionedParameterIndex) == parameter) {
|
||||
if (stateAllowsMixedNamedAndPositionArguments && parameters.getOrNull(currentPositionedParameterIndex) == parameter) {
|
||||
state = State.POSITION_ARGUMENTS
|
||||
currentPositionedParameterIndex++
|
||||
}
|
||||
|
||||
@@ -99,7 +99,13 @@ class FirCallCompletionResultsWriterTransformer(
|
||||
data: ExpectedArgumentType?,
|
||||
): CompositeTransformResult<FirStatement> {
|
||||
val calleeReference = qualifiedAccessExpression.calleeReference as? FirNamedReferenceWithCandidate
|
||||
?: return qualifiedAccessExpression.compose()
|
||||
?: return run {
|
||||
if (mode == Mode.DelegatedPropertyCompletion) {
|
||||
val typeUpdater = TypeUpdaterForDelegateArguments()
|
||||
qualifiedAccessExpression.transformSingle(typeUpdater, null)
|
||||
}
|
||||
qualifiedAccessExpression.compose()
|
||||
}
|
||||
val result = prepareQualifiedTransform(qualifiedAccessExpression, calleeReference)
|
||||
.transformExplicitReceiver(integerApproximator, null)
|
||||
val typeRef = result.typeRef as FirResolvedTypeRef
|
||||
|
||||
@@ -18,7 +18,6 @@ import org.jetbrains.kotlin.fir.resolve.ResolutionMode
|
||||
import org.jetbrains.kotlin.fir.resolve.ScopeSession
|
||||
import org.jetbrains.kotlin.fir.resolve.firProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.*
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.TransformImplicitType
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.contracts.runContractResolveForLocalClass
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirAccessorSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
||||
@@ -86,9 +85,9 @@ fun <F : FirClass<F>> F.runContractAndBodiesResolutionForLocalClass(
|
||||
components.session, components.scopeSession,
|
||||
implicitBodyResolveComputationSession,
|
||||
FirResolvePhase.BODY_RESOLVE,
|
||||
outerBodyResolveContext = newContext,
|
||||
implicitTypeOnly = false,
|
||||
returnTypeCalculator
|
||||
returnTypeCalculator,
|
||||
outerBodyResolveContext = newContext
|
||||
)
|
||||
|
||||
val graphBuilder = components.context.dataFlowAnalyzerContext.graphBuilder
|
||||
|
||||
@@ -108,7 +108,6 @@ class FirIntegerOperator @FirImplementationDetail constructor(
|
||||
FirDeclarationOrigin.Synthetic,
|
||||
returnTypeRef,
|
||||
receiverTypeRef,
|
||||
typeParameters = mutableListOf(),
|
||||
valueParameters = mutableListOf(),
|
||||
body = null,
|
||||
status,
|
||||
@@ -117,6 +116,7 @@ class FirIntegerOperator @FirImplementationDetail constructor(
|
||||
kind.operatorName,
|
||||
symbol,
|
||||
annotations = mutableListOf(),
|
||||
typeParameters = mutableListOf(),
|
||||
) {
|
||||
enum class Kind(val unary: Boolean, val operatorName: Name) {
|
||||
PLUS(false, OperatorNameConventions.PLUS),
|
||||
|
||||
@@ -64,4 +64,6 @@ abstract class FirAnonymousFunction : FirFunction<FirAnonymousFunction>, FirExpr
|
||||
abstract override fun <D> transformControlFlowGraphReference(transformer: FirTransformer<D>, data: D): FirAnonymousFunction
|
||||
|
||||
abstract override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirAnonymousFunction
|
||||
|
||||
abstract override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirAnonymousFunction
|
||||
}
|
||||
|
||||
@@ -64,4 +64,6 @@ abstract class FirConstructor : FirPureAbstractElement(), FirFunction<FirConstru
|
||||
abstract override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirConstructor
|
||||
|
||||
abstract fun <D> transformDelegatedConstructor(transformer: FirTransformer<D>, data: D): FirConstructor
|
||||
|
||||
abstract override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirConstructor
|
||||
}
|
||||
|
||||
@@ -57,4 +57,6 @@ abstract class FirErrorFunction : FirPureAbstractElement(), FirFunction<FirError
|
||||
abstract override fun <D> transformControlFlowGraphReference(transformer: FirTransformer<D>, data: D): FirErrorFunction
|
||||
|
||||
abstract override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirErrorFunction
|
||||
|
||||
abstract override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirErrorFunction
|
||||
}
|
||||
|
||||
@@ -55,4 +55,6 @@ interface FirFunction<F : FirFunction<F>> : FirCallableDeclaration<F>, FirTarget
|
||||
fun <D> transformControlFlowGraphReference(transformer: FirTransformer<D>, data: D): FirFunction<F>
|
||||
|
||||
fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirFunction<F>
|
||||
|
||||
fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirFunction<F>
|
||||
}
|
||||
|
||||
@@ -60,6 +60,8 @@ abstract class FirPropertyAccessor : FirPureAbstractElement(), FirFunction<FirPr
|
||||
|
||||
abstract override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirPropertyAccessor
|
||||
|
||||
abstract override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirPropertyAccessor
|
||||
|
||||
abstract override fun <D> transformContractDescription(transformer: FirTransformer<D>, data: D): FirPropertyAccessor
|
||||
|
||||
abstract fun <D> transformStatus(transformer: FirTransformer<D>, data: D): FirPropertyAccessor
|
||||
|
||||
@@ -62,6 +62,8 @@ abstract class FirSimpleFunction : FirPureAbstractElement(), FirFunction<FirSimp
|
||||
|
||||
abstract override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirSimpleFunction
|
||||
|
||||
abstract override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirSimpleFunction
|
||||
|
||||
abstract override fun <D> transformStatus(transformer: FirTransformer<D>, data: D): FirSimpleFunction
|
||||
|
||||
abstract override fun <D> transformContractDescription(transformer: FirTransformer<D>, data: D): FirSimpleFunction
|
||||
|
||||
@@ -69,7 +69,7 @@ internal class FirAnonymousFunctionImpl(
|
||||
transformReceiverTypeRef(transformer, data)
|
||||
transformControlFlowGraphReference(transformer, data)
|
||||
transformValueParameters(transformer, data)
|
||||
body = body?.transformSingle(transformer, data)
|
||||
transformBody(transformer, data)
|
||||
typeRef = typeRef.transformSingle(transformer, data)
|
||||
label = label?.transformSingle(transformer, data)
|
||||
typeParameters.transformInplace(transformer, data)
|
||||
@@ -101,6 +101,11 @@ internal class FirAnonymousFunctionImpl(
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirAnonymousFunctionImpl {
|
||||
body = body?.transformSingle(transformer, data)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
|
||||
resolvePhase = newResolvePhase
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ internal class FirConstructorImpl(
|
||||
transformStatus(transformer, data)
|
||||
transformAnnotations(transformer, data)
|
||||
transformDelegatedConstructor(transformer, data)
|
||||
body = body?.transformSingle(transformer, data)
|
||||
transformBody(transformer, data)
|
||||
return this
|
||||
}
|
||||
|
||||
@@ -113,6 +113,11 @@ internal class FirConstructorImpl(
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirConstructorImpl {
|
||||
body = body?.transformSingle(transformer, data)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
|
||||
resolvePhase = newResolvePhase
|
||||
}
|
||||
|
||||
@@ -90,6 +90,10 @@ internal class FirErrorFunctionImpl(
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirErrorFunctionImpl {
|
||||
return this
|
||||
}
|
||||
|
||||
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
|
||||
resolvePhase = newResolvePhase
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ internal class FirPrimaryConstructor(
|
||||
transformStatus(transformer, data)
|
||||
transformAnnotations(transformer, data)
|
||||
transformDelegatedConstructor(transformer, data)
|
||||
body = body?.transformSingle(transformer, data)
|
||||
transformBody(transformer, data)
|
||||
return this
|
||||
}
|
||||
|
||||
@@ -113,6 +113,11 @@ internal class FirPrimaryConstructor(
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirPrimaryConstructor {
|
||||
body = body?.transformSingle(transformer, data)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
|
||||
resolvePhase = newResolvePhase
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ open class FirPropertyAccessorImpl @FirImplementationDetail constructor(
|
||||
transformReturnTypeRef(transformer, data)
|
||||
transformControlFlowGraphReference(transformer, data)
|
||||
transformValueParameters(transformer, data)
|
||||
body = body?.transformSingle(transformer, data)
|
||||
transformBody(transformer, data)
|
||||
transformContractDescription(transformer, data)
|
||||
transformStatus(transformer, data)
|
||||
transformAnnotations(transformer, data)
|
||||
@@ -96,6 +96,11 @@ open class FirPropertyAccessorImpl @FirImplementationDetail constructor(
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirPropertyAccessorImpl {
|
||||
body = body?.transformSingle(transformer, data)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformContractDescription(transformer: FirTransformer<D>, data: D): FirPropertyAccessorImpl {
|
||||
contractDescription = contractDescription.transformSingle(transformer, data)
|
||||
return this
|
||||
|
||||
@@ -72,7 +72,7 @@ open class FirSimpleFunctionImpl @FirImplementationDetail constructor(
|
||||
transformReceiverTypeRef(transformer, data)
|
||||
transformControlFlowGraphReference(transformer, data)
|
||||
transformValueParameters(transformer, data)
|
||||
body = body?.transformSingle(transformer, data)
|
||||
transformBody(transformer, data)
|
||||
transformStatus(transformer, data)
|
||||
transformContractDescription(transformer, data)
|
||||
transformAnnotations(transformer, data)
|
||||
@@ -100,6 +100,11 @@ open class FirSimpleFunctionImpl @FirImplementationDetail constructor(
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirSimpleFunctionImpl {
|
||||
body = body?.transformSingle(transformer, data)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformStatus(transformer: FirTransformer<D>, data: D): FirSimpleFunctionImpl {
|
||||
status = status.transformSingle(transformer, data)
|
||||
return this
|
||||
|
||||
@@ -109,6 +109,10 @@ class FirSyntheticPropertyAccessor(
|
||||
throw AssertionError("Transformation of synthetic property accessor isn't supported")
|
||||
}
|
||||
|
||||
override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirPropertyAccessor {
|
||||
throw AssertionError("Transformation of synthetic property accessor isn't supported")
|
||||
}
|
||||
|
||||
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
|
||||
throw AssertionError("Mutation of synthetic property accessor isn't supported")
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ dependencies {
|
||||
Platform[192].orHigher {
|
||||
runtimeOnly(intellijCoreDep()) { includeJars("jdom") }
|
||||
}
|
||||
implementation(kotlin("reflect"))
|
||||
implementation(project(":kotlin-reflect"))
|
||||
}
|
||||
|
||||
val writeCopyright by task<WriteCopyrightToFile> {
|
||||
|
||||
@@ -100,7 +100,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
+controlFlowGraphReferenceField
|
||||
+symbol("FirFunctionSymbol", "F")
|
||||
+fieldList(valueParameter, withReplace = true).withTransform()
|
||||
+body(nullable = true)
|
||||
+body(nullable = true).withTransform()
|
||||
}
|
||||
|
||||
errorFunction.configure {
|
||||
|
||||
@@ -42,6 +42,7 @@ import org.jetbrains.kotlin.load.kotlin.PackagePartProvider
|
||||
import org.jetbrains.kotlin.load.kotlin.VirtualFileFinderFactory
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.ImplicitsExtensionsResolutionFilter
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolver
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmDiagnosticComponents
|
||||
import org.jetbrains.kotlin.resolve.jvm.multiplatform.OptionalAnnotationPackageFragmentProvider
|
||||
@@ -63,7 +64,8 @@ fun createContainerForLazyResolveWithJava(
|
||||
languageVersionSettings: LanguageVersionSettings,
|
||||
useBuiltInsProvider: Boolean,
|
||||
configureJavaClassFinder: (StorageComponentContainer.() -> Unit)? = null,
|
||||
javaClassTracker: JavaClassesTracker? = null
|
||||
javaClassTracker: JavaClassesTracker? = null,
|
||||
implicitsResolutionFilter: ImplicitsExtensionsResolutionFilter? = null,
|
||||
): StorageComponentContainer = createContainer("LazyResolveWithJava", JvmPlatformAnalyzerServices) {
|
||||
configureModule(moduleContext, jvmPlatform, JvmPlatformAnalyzerServices, bindingTrace, languageVersionSettings)
|
||||
|
||||
@@ -73,6 +75,7 @@ fun createContainerForLazyResolveWithJava(
|
||||
useInstance(moduleContentScope)
|
||||
useInstance(packagePartProvider)
|
||||
useInstance(declarationProviderFactory)
|
||||
useInstanceIfNotNull(implicitsResolutionFilter)
|
||||
|
||||
useInstance(VirtualFileFinderFactory.getInstance(moduleContext.project).create(moduleContentScope))
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ import org.jetbrains.kotlin.load.java.lazy.ModuleClassResolverImpl
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaClass
|
||||
import org.jetbrains.kotlin.load.kotlin.PackagePartProvider
|
||||
import org.jetbrains.kotlin.platform.jvm.isJvm
|
||||
import org.jetbrains.kotlin.platform.jvm.isJvm
|
||||
import org.jetbrains.kotlin.resolve.CodeAnalyzerInitializer
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.resolve.TargetEnvironment
|
||||
@@ -39,7 +38,9 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactory
|
||||
|
||||
class JvmPlatformParameters(
|
||||
val packagePartProviderFactory: (ModuleContent<*>) -> PackagePartProvider,
|
||||
val moduleByJavaClass: (JavaClass) -> ModuleInfo?
|
||||
val moduleByJavaClass: (JavaClass) -> ModuleInfo?,
|
||||
// params: referenced module info of target class, context module info of current resolver
|
||||
val resolverForReferencedModule: ((ModuleInfo, ModuleInfo) -> ResolverForModule?)? = null,
|
||||
) : PlatformAnalysisParameters
|
||||
|
||||
|
||||
@@ -64,13 +65,22 @@ class JvmResolverForModuleFactory(
|
||||
)
|
||||
|
||||
val moduleClassResolver = ModuleClassResolverImpl { javaClass ->
|
||||
val referencedClassModule = (platformParameters as JvmPlatformParameters).moduleByJavaClass(javaClass)
|
||||
// We don't have full control over idea resolve api so we allow for a situation which should not happen in Kotlin.
|
||||
// For example, type in a java library can reference a class declared in a source root (is valid but rare case)
|
||||
// Providing a fallback strategy in this case can hide future problems, so we should at least log to be able to diagnose those
|
||||
val referencedClassModule = platformParameters.moduleByJavaClass(javaClass)
|
||||
// A type in a java library can reference a class declared in a source root (is valid but rare case).
|
||||
// Resolving such a class with Kotlin resolver for libraries is guaranteed to fail, as libraries can't
|
||||
// have dependencies on the source roots. The chain of resolvers (sources -> libraries -> sdk) exists to prevent
|
||||
// potentially slow repetitive analysis of the same libraries after modifications in sources. The only way to mitigate
|
||||
// this restriction currently is to manually configure resolution anchors for known source-dependent libraries in a project.
|
||||
// See also KT-24309
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val resolverForReferencedModule = referencedClassModule?.let { resolverForProject.tryGetResolverForModule(it as M) }
|
||||
val resolverForReferencedModule = referencedClassModule?.let { referencedModuleInfo ->
|
||||
if (platformParameters.resolverForReferencedModule != null) {
|
||||
platformParameters.resolverForReferencedModule.invoke(referencedModuleInfo, moduleInfo)
|
||||
} else {
|
||||
resolverForProject.tryGetResolverForModule(referencedModuleInfo as M)
|
||||
}
|
||||
}
|
||||
|
||||
val resolverForModule = resolverForReferencedModule?.takeIf {
|
||||
referencedClassModule.platform.isJvm() || referencedClassModule.platform == null
|
||||
@@ -110,12 +120,12 @@ class JvmResolverForModuleFactory(
|
||||
)
|
||||
|
||||
providersForModule +=
|
||||
PackageFragmentProviderExtension.getInstances(project)
|
||||
.mapNotNull {
|
||||
it.getPackageFragmentProvider(
|
||||
project, moduleDescriptor, moduleContext.storageManager, trace, moduleInfo, lookupTracker
|
||||
)
|
||||
}
|
||||
PackageFragmentProviderExtension.getInstances(project)
|
||||
.mapNotNull {
|
||||
it.getPackageFragmentProvider(
|
||||
project, moduleDescriptor, moduleContext.storageManager, trace, moduleInfo, lookupTracker
|
||||
)
|
||||
}
|
||||
|
||||
return ResolverForModule(CompositePackageFragmentProvider(providersForModule), container)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.resolve.jvm.annotations
|
||||
|
||||
import org.jetbrains.kotlin.config.JvmDefaultMode
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotated
|
||||
@@ -19,6 +20,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
|
||||
|
||||
val JVM_DEFAULT_FQ_NAME = FqName("kotlin.jvm.JvmDefault")
|
||||
val JVM_DEFAULT_NO_COMPATIBILITY_FQ_NAME = FqName("kotlin.jvm.JvmDefaultWithoutCompatibility")
|
||||
val JVM_OVERLOADS_FQ_NAME = FqName("kotlin.jvm.JvmOverloads")
|
||||
val JVM_SYNTHETIC_ANNOTATION_FQ_NAME = FqName("kotlin.jvm.JvmSynthetic")
|
||||
|
||||
@@ -64,6 +66,10 @@ fun CallableMemberDescriptor.isCompiledToJvmDefault(jvmDefault: JvmDefaultMode):
|
||||
fun CallableMemberDescriptor.hasJvmDefaultAnnotation(): Boolean =
|
||||
DescriptorUtils.getDirectMember(this).annotations.hasAnnotation(JVM_DEFAULT_FQ_NAME)
|
||||
|
||||
fun DeclarationDescriptor.hasJvmDefaultNoCompatibilityAnnotation(): Boolean =
|
||||
this.annotations.hasAnnotation(JVM_DEFAULT_NO_COMPATIBILITY_FQ_NAME)
|
||||
|
||||
|
||||
fun CallableMemberDescriptor.hasPlatformDependentAnnotation(): Boolean =
|
||||
DescriptorUtils.getDirectMember(this).annotations.hasAnnotation(PLATFORM_DEPENDENT_ANNOTATION_FQ_NAME)
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user