tsc-ts 0.0.10 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (379) hide show
  1. package/README.md +1 -1
  2. package/bin/tsc-ts.js +70 -1
  3. package/dist/api/compiler/ast-utilities.d.ts +19 -1
  4. package/dist/api/compiler/ast-utilities.js +180 -95
  5. package/dist/api/compiler/ast.d.ts +29 -18
  6. package/dist/api/compiler/ast.js +1040 -1007
  7. package/dist/api/compiler/astnav.js +15 -15
  8. package/dist/api/compiler/binder-utilities.js +186 -186
  9. package/dist/api/compiler/binder.js +290 -263
  10. package/dist/api/compiler/character-codes.js +2 -2
  11. package/dist/api/compiler/checker-calls.js +173 -123
  12. package/dist/api/compiler/checker-classes.d.ts +14 -3
  13. package/dist/api/compiler/checker-classes.js +136 -91
  14. package/dist/api/compiler/checker-contextual.d.ts +20 -0
  15. package/dist/api/compiler/checker-contextual.js +175 -62
  16. package/dist/api/compiler/checker-declaration-order.js +79 -79
  17. package/dist/api/compiler/checker-declarations.d.ts +1 -0
  18. package/dist/api/compiler/checker-declarations.js +160 -136
  19. package/dist/api/compiler/checker-declared-types.js +67 -65
  20. package/dist/api/compiler/checker-decorators.js +77 -77
  21. package/dist/api/compiler/checker-deprecation.d.ts +8 -3
  22. package/dist/api/compiler/checker-deprecation.js +76 -55
  23. package/dist/api/compiler/checker-destructuring.js +47 -45
  24. package/dist/api/compiler/checker-elaboration.js +24 -24
  25. package/dist/api/compiler/checker-emit-helpers.js +4 -4
  26. package/dist/api/compiler/checker-emit-resolver.d.ts +4 -2
  27. package/dist/api/compiler/checker-emit-resolver.js +25 -13
  28. package/dist/api/compiler/checker-evaluator.js +9 -9
  29. package/dist/api/compiler/checker-expressions.js +258 -212
  30. package/dist/api/compiler/checker-functions.js +113 -107
  31. package/dist/api/compiler/checker-generated-code.d.ts +0 -11
  32. package/dist/api/compiler/checker-generated-code.js +28 -52
  33. package/dist/api/compiler/checker-grammar.d.ts +1 -0
  34. package/dist/api/compiler/checker-grammar.js +469 -438
  35. package/dist/api/compiler/checker-heritage.js +91 -93
  36. package/dist/api/compiler/checker-inference.d.ts +77 -5
  37. package/dist/api/compiler/checker-inference.js +487 -113
  38. package/dist/api/compiler/checker-iteration.d.ts +0 -10
  39. package/dist/api/compiler/checker-iteration.js +35 -52
  40. package/dist/api/compiler/checker-javascript.js +14 -14
  41. package/dist/api/compiler/checker-jsdoc.d.ts +8 -10
  42. package/dist/api/compiler/checker-jsdoc.js +67 -58
  43. package/dist/api/compiler/checker-jsx.js +107 -89
  44. package/dist/api/compiler/checker-members.d.ts +9 -2
  45. package/dist/api/compiler/checker-members.js +210 -74
  46. package/dist/api/compiler/checker-modules.d.ts +15 -6
  47. package/dist/api/compiler/checker-modules.js +469 -309
  48. package/dist/api/compiler/checker-narrowing.js +273 -189
  49. package/dist/api/compiler/checker-object-literals.js +25 -22
  50. package/dist/api/compiler/checker-operators.js +126 -118
  51. package/dist/api/compiler/checker-overloads.js +27 -27
  52. package/dist/api/compiler/checker-property-access.js +59 -55
  53. package/dist/api/compiler/checker-services.d.ts +1 -0
  54. package/dist/api/compiler/checker-services.js +222 -210
  55. package/dist/api/compiler/checker-signatures.js +65 -49
  56. package/dist/api/compiler/checker-source-file.d.ts +5 -0
  57. package/dist/api/compiler/checker-source-file.js +154 -130
  58. package/dist/api/compiler/checker-statements.js +33 -32
  59. package/dist/api/compiler/checker-super.js +50 -50
  60. package/dist/api/compiler/checker-symbol-types.js +109 -93
  61. package/dist/api/compiler/checker-symbols.d.ts +13 -1
  62. package/dist/api/compiler/checker-symbols.js +264 -149
  63. package/dist/api/compiler/checker-type-factory.d.ts +5 -0
  64. package/dist/api/compiler/checker-type-factory.js +190 -46
  65. package/dist/api/compiler/checker-type-nodes.d.ts +1 -0
  66. package/dist/api/compiler/checker-type-nodes.js +179 -141
  67. package/dist/api/compiler/checker-type-operators.d.ts +2 -0
  68. package/dist/api/compiler/checker-type-operators.js +110 -63
  69. package/dist/api/compiler/checker-types.d.ts +80 -3
  70. package/dist/api/compiler/checker-types.js +121 -2
  71. package/dist/api/compiler/checker-unused.js +114 -118
  72. package/dist/api/compiler/checker-utilities.js +11 -11
  73. package/dist/api/compiler/checker.d.ts +97 -31
  74. package/dist/api/compiler/checker.js +149 -35
  75. package/dist/api/compiler/command-line.d.ts +1 -3
  76. package/dist/api/compiler/command-line.js +47 -44
  77. package/dist/api/compiler/compile-program.d.ts +24 -4
  78. package/dist/api/compiler/compile-program.js +53 -26
  79. package/dist/api/compiler/diagnostic-messages.d.ts +1849 -1774
  80. package/dist/api/compiler/diagnostic-messages.js +128 -122
  81. package/dist/api/compiler/diagnostics.js +7 -7
  82. package/dist/api/compiler/emitter.d.ts +7 -1
  83. package/dist/api/compiler/emitter.js +53 -11
  84. package/dist/api/compiler/expr-record.d.ts +11 -0
  85. package/dist/api/compiler/expr-record.js +53 -0
  86. package/dist/api/compiler/file-include.d.ts +2 -1
  87. package/dist/api/compiler/file-include.js +11 -7
  88. package/dist/api/compiler/file-loader.d.ts +10 -0
  89. package/dist/api/compiler/file-loader.js +138 -41
  90. package/dist/api/compiler/identifier-name.d.ts +9 -0
  91. package/dist/api/compiler/identifier-name.js +10 -0
  92. package/dist/api/compiler/instantiation.d.ts +7 -0
  93. package/dist/api/compiler/instantiation.js +101 -49
  94. package/dist/api/compiler/jsdoc.js +27 -25
  95. package/dist/api/compiler/link-tables.d.ts +48 -18
  96. package/dist/api/compiler/link-tables.js +80 -37
  97. package/dist/api/compiler/locales/cs-CZ.d.ts +1 -1
  98. package/dist/api/compiler/locales/cs-CZ.js +1 -1
  99. package/dist/api/compiler/locales/de-DE.d.ts +1 -1
  100. package/dist/api/compiler/locales/de-DE.js +1 -1
  101. package/dist/api/compiler/locales/es-ES.d.ts +1 -1
  102. package/dist/api/compiler/locales/es-ES.js +1 -1
  103. package/dist/api/compiler/locales/fr-FR.d.ts +1 -1
  104. package/dist/api/compiler/locales/fr-FR.js +1 -1
  105. package/dist/api/compiler/locales/it-IT.d.ts +1 -1
  106. package/dist/api/compiler/locales/it-IT.js +1 -1
  107. package/dist/api/compiler/locales/ja-JP.d.ts +1 -1
  108. package/dist/api/compiler/locales/ja-JP.js +1 -1
  109. package/dist/api/compiler/locales/ko-KR.d.ts +1 -1
  110. package/dist/api/compiler/locales/ko-KR.js +1 -1
  111. package/dist/api/compiler/locales/pl-PL.d.ts +1 -1
  112. package/dist/api/compiler/locales/pl-PL.js +1 -1
  113. package/dist/api/compiler/locales/pt-BR.d.ts +1 -1
  114. package/dist/api/compiler/locales/pt-BR.js +1 -1
  115. package/dist/api/compiler/locales/ru-RU.d.ts +1 -1
  116. package/dist/api/compiler/locales/ru-RU.js +1 -1
  117. package/dist/api/compiler/locales/tr-TR.d.ts +1 -1
  118. package/dist/api/compiler/locales/tr-TR.js +1 -1
  119. package/dist/api/compiler/locales/zh-CN.d.ts +1 -1
  120. package/dist/api/compiler/locales/zh-CN.js +1 -1
  121. package/dist/api/compiler/locales/zh-TW.d.ts +1 -1
  122. package/dist/api/compiler/locales/zh-TW.js +1 -1
  123. package/dist/api/compiler/module-resolution-types.js +6 -6
  124. package/dist/api/compiler/module-resolution.d.ts +10 -1
  125. package/dist/api/compiler/module-resolution.js +115 -84
  126. package/dist/api/compiler/module-specifiers.d.ts +15 -0
  127. package/dist/api/compiler/module-specifiers.js +24 -18
  128. package/dist/api/compiler/name-resolver.js +74 -65
  129. package/dist/api/compiler/node-builder-names.d.ts +11 -3
  130. package/dist/api/compiler/node-builder-names.js +210 -90
  131. package/dist/api/compiler/node-builder-pseudo.js +29 -31
  132. package/dist/api/compiler/node-builder-reuse.js +23 -22
  133. package/dist/api/compiler/node-builder.d.ts +18 -1
  134. package/dist/api/compiler/node-builder.js +191 -102
  135. package/dist/api/compiler/option-declarations.d.ts +2 -6
  136. package/dist/api/compiler/option-declarations.js +315 -375
  137. package/dist/api/compiler/options.d.ts +15 -33
  138. package/dist/api/compiler/options.js +21 -54
  139. package/dist/api/compiler/output-paths.d.ts +4 -1
  140. package/dist/api/compiler/output-paths.js +6 -11
  141. package/dist/api/compiler/package-json.d.ts +3 -3
  142. package/dist/api/compiler/package-json.js +11 -10
  143. package/dist/api/compiler/parser.d.ts +42 -20
  144. package/dist/api/compiler/parser.js +318 -224
  145. package/dist/api/compiler/path.d.ts +9 -0
  146. package/dist/api/compiler/path.js +20 -3
  147. package/dist/api/compiler/printer/emit-context.d.ts +3 -1
  148. package/dist/api/compiler/printer/emit-context.js +16 -1
  149. package/dist/api/compiler/printer/factory-base.d.ts +2 -2
  150. package/dist/api/compiler/printer/factory-base.js +7 -3
  151. package/dist/api/compiler/printer/factory.js +6 -3
  152. package/dist/api/compiler/printer/helpers.js +10 -1
  153. package/dist/api/compiler/printer/name-generator.d.ts +1 -1
  154. package/dist/api/compiler/printer/name-generator.js +35 -16
  155. package/dist/api/compiler/printer/printer.d.ts +1 -0
  156. package/dist/api/compiler/printer/printer.js +306 -283
  157. package/dist/api/compiler/printer/utilities.js +149 -147
  158. package/dist/api/compiler/program-checker.d.ts +8 -2
  159. package/dist/api/compiler/program-checker.js +84 -34
  160. package/dist/api/compiler/program-utilities.d.ts +3 -1
  161. package/dist/api/compiler/program-utilities.js +28 -15
  162. package/dist/api/compiler/program.d.ts +2 -0
  163. package/dist/api/compiler/program.js +69 -57
  164. package/dist/api/compiler/pseudo-bigint.d.ts +2 -0
  165. package/dist/api/compiler/pseudo-bigint.js +18 -0
  166. package/dist/api/compiler/regexp-checker.d.ts +1 -1
  167. package/dist/api/compiler/regexp-checker.js +93 -76
  168. package/dist/api/compiler/relations.d.ts +27 -4
  169. package/dist/api/compiler/relations.js +337 -180
  170. package/dist/api/compiler/reparser.js +64 -59
  171. package/dist/api/compiler/scanner.d.ts +27 -2
  172. package/dist/api/compiler/scanner.js +181 -150
  173. package/dist/api/compiler/shared-results.d.ts +696 -0
  174. package/dist/api/compiler/shared-results.js +2905 -0
  175. package/dist/api/compiler/sourcemap.js +2 -2
  176. package/dist/api/compiler/symbol-accessibility.js +87 -74
  177. package/dist/api/compiler/symbol.d.ts +22 -13
  178. package/dist/api/compiler/symbol.js +15 -1
  179. package/dist/api/compiler/syntax-kind.d.ts +198 -197
  180. package/dist/api/compiler/transformers/alias-references.js +247 -139
  181. package/dist/api/compiler/transformers/async-utilities.js +25 -25
  182. package/dist/api/compiler/transformers/async.d.ts +0 -1
  183. package/dist/api/compiler/transformers/async.js +64 -77
  184. package/dist/api/compiler/transformers/class-fields.d.ts +1 -0
  185. package/dist/api/compiler/transformers/class-fields.js +81 -78
  186. package/dist/api/compiler/transformers/commonjs-module.js +18 -15
  187. package/dist/api/compiler/transformers/const-enum-inliner.js +1 -1
  188. package/dist/api/compiler/transformers/declarations-diagnostics.js +247 -244
  189. package/dist/api/compiler/transformers/declarations-pseudo.js +100 -100
  190. package/dist/api/compiler/transformers/declarations-resolver.d.ts +0 -3
  191. package/dist/api/compiler/transformers/declarations-syntactic.d.ts +1 -2
  192. package/dist/api/compiler/transformers/declarations-syntactic.js +134 -156
  193. package/dist/api/compiler/transformers/declarations-tracker.js +18 -18
  194. package/dist/api/compiler/transformers/declarations.d.ts +4 -1
  195. package/dist/api/compiler/transformers/declarations.js +307 -239
  196. package/dist/api/compiler/transformers/decorator-metadata.d.ts +1 -1
  197. package/dist/api/compiler/transformers/decorator-metadata.js +53 -45
  198. package/dist/api/compiler/transformers/decorator-utilities.js +24 -24
  199. package/dist/api/compiler/transformers/destructuring.js +19 -18
  200. package/dist/api/compiler/transformers/emit-resolver.js +1 -1
  201. package/dist/api/compiler/transformers/es-decorators.js +55 -55
  202. package/dist/api/compiler/transformers/external-module-info.js +3 -3
  203. package/dist/api/compiler/transformers/for-await.js +25 -25
  204. package/dist/api/compiler/transformers/import-elision.js +14 -14
  205. package/dist/api/compiler/transformers/jsx.js +12 -12
  206. package/dist/api/compiler/transformers/legacy-decorators.js +17 -17
  207. package/dist/api/compiler/transformers/module.js +8 -8
  208. package/dist/api/compiler/transformers/named-evaluation.js +4 -4
  209. package/dist/api/compiler/transformers/object-rest-spread.js +20 -20
  210. package/dist/api/compiler/transformers/optional-chain.js +10 -10
  211. package/dist/api/compiler/transformers/reference-resolver.d.ts +12 -1
  212. package/dist/api/compiler/transformers/reference-resolver.js +131 -69
  213. package/dist/api/compiler/transformers/runtime-syntax.js +35 -31
  214. package/dist/api/compiler/transformers/subtree-facts.js +47 -47
  215. package/dist/api/compiler/transformers/syntax-facts.js +56 -58
  216. package/dist/api/compiler/transformers/type-eraser.js +73 -66
  217. package/dist/api/compiler/transformers/type-serialization.js +24 -24
  218. package/dist/api/compiler/transformers/using.js +12 -12
  219. package/dist/api/compiler/transformers/utilities.js +77 -77
  220. package/dist/api/compiler/transformers/visitor-base.js +172 -172
  221. package/dist/api/compiler/transformers/visitor-hooks.js +6 -2
  222. package/dist/api/compiler/tsconfig.d.ts +10 -2
  223. package/dist/api/compiler/tsconfig.js +136 -48
  224. package/dist/api/compiler/type-printer.js +40 -3
  225. package/dist/api/compiler/types.d.ts +2 -1
  226. package/dist/api/library/ast.generated.d.ts +42 -39
  227. package/dist/api/library/ast.generated.js +1 -1
  228. package/dist/api/library/compiler-options.generated.d.ts +111 -100
  229. package/dist/api/library/compiler-options.generated.js +1 -1
  230. package/dist/api/library/disk.js +12 -1
  231. package/dist/api/library/enums.generated.d.ts +206 -206
  232. package/dist/api/library/enums.generated.js +206 -206
  233. package/dist/api/library/nodes.js +26 -26
  234. package/package.json +9 -9
  235. package/src/compiler/ast-utilities.ts +99 -7
  236. package/src/compiler/ast.ts +74 -38
  237. package/src/compiler/binder.ts +39 -4
  238. package/src/compiler/cgroup.ts +157 -0
  239. package/src/compiler/character-codes.ts +2 -2
  240. package/src/compiler/checker-calls.ts +76 -8
  241. package/src/compiler/checker-classes.ts +80 -25
  242. package/src/compiler/checker-contextual.ts +110 -1
  243. package/src/compiler/checker-declarations.ts +31 -4
  244. package/src/compiler/checker-declared-types.ts +8 -5
  245. package/src/compiler/checker-decorators.ts +1 -1
  246. package/src/compiler/checker-deprecation.ts +29 -8
  247. package/src/compiler/checker-destructuring.ts +10 -3
  248. package/src/compiler/checker-emit-helpers.ts +1 -0
  249. package/src/compiler/checker-emit-resolver.ts +16 -6
  250. package/src/compiler/checker-expressions.ts +95 -47
  251. package/src/compiler/checker-functions.ts +21 -6
  252. package/src/compiler/checker-generated-code.ts +2 -22
  253. package/src/compiler/checker-grammar.ts +133 -60
  254. package/src/compiler/checker-heritage.ts +22 -21
  255. package/src/compiler/checker-inference.ts +514 -87
  256. package/src/compiler/checker-iteration.ts +18 -31
  257. package/src/compiler/checker-javascript.ts +1 -1
  258. package/src/compiler/checker-jsdoc.ts +50 -27
  259. package/src/compiler/checker-jsx.ts +28 -5
  260. package/src/compiler/checker-members.ts +197 -55
  261. package/src/compiler/checker-modules.ts +332 -65
  262. package/src/compiler/checker-narrowing.ts +98 -19
  263. package/src/compiler/checker-object-literals.ts +3 -0
  264. package/src/compiler/checker-operators.ts +11 -4
  265. package/src/compiler/checker-property-access.ts +7 -2
  266. package/src/compiler/checker-services.ts +39 -12
  267. package/src/compiler/checker-signatures.ts +15 -1
  268. package/src/compiler/checker-source-file.ts +39 -13
  269. package/src/compiler/checker-statements.ts +3 -2
  270. package/src/compiler/checker-symbol-types.ts +29 -6
  271. package/src/compiler/checker-symbols.ts +158 -15
  272. package/src/compiler/checker-type-factory.ts +173 -35
  273. package/src/compiler/checker-type-nodes.ts +46 -3
  274. package/src/compiler/checker-type-operators.ts +83 -26
  275. package/src/compiler/checker-types.ts +147 -4
  276. package/src/compiler/checker-unused.ts +9 -14
  277. package/src/compiler/checker.ts +175 -41
  278. package/src/compiler/command-line.ts +28 -28
  279. package/src/compiler/compile-program.ts +59 -25
  280. package/src/compiler/decoder.ts +15 -5
  281. package/src/compiler/diagnostic-messages.ts +1973 -1892
  282. package/src/compiler/doctor-report.ts +133 -0
  283. package/src/compiler/emitter.ts +57 -8
  284. package/src/compiler/encoder.ts +23 -8
  285. package/src/compiler/expr-record.ts +59 -0
  286. package/src/compiler/file-include.ts +9 -3
  287. package/src/compiler/file-loader.ts +139 -32
  288. package/src/compiler/help.ts +10 -14
  289. package/src/compiler/identifier-name.ts +13 -0
  290. package/src/compiler/incremental.ts +86 -18
  291. package/src/compiler/init.ts +2 -7
  292. package/src/compiler/instantiation.ts +77 -22
  293. package/src/compiler/jsdoc.ts +7 -3
  294. package/src/compiler/link-tables.ts +82 -37
  295. package/src/compiler/locales/cs-CZ.ts +1 -1
  296. package/src/compiler/locales/de-DE.ts +1 -1
  297. package/src/compiler/locales/es-ES.ts +1 -1
  298. package/src/compiler/locales/fr-FR.ts +1 -1
  299. package/src/compiler/locales/it-IT.ts +1 -1
  300. package/src/compiler/locales/ja-JP.ts +1 -1
  301. package/src/compiler/locales/ko-KR.ts +1 -1
  302. package/src/compiler/locales/pl-PL.ts +1 -1
  303. package/src/compiler/locales/pt-BR.ts +1 -1
  304. package/src/compiler/locales/ru-RU.ts +1 -1
  305. package/src/compiler/locales/tr-TR.ts +1 -1
  306. package/src/compiler/locales/zh-CN.ts +1 -1
  307. package/src/compiler/locales/zh-TW.ts +1 -1
  308. package/src/compiler/module-resolution.ts +44 -8
  309. package/src/compiler/module-specifiers.ts +62 -20
  310. package/src/compiler/name-resolver.ts +9 -1
  311. package/src/compiler/node-builder-names.ts +236 -54
  312. package/src/compiler/node-builder-pseudo.ts +4 -7
  313. package/src/compiler/node-builder-reuse.ts +5 -4
  314. package/src/compiler/node-builder.ts +130 -31
  315. package/src/compiler/option-declarations.ts +33 -103
  316. package/src/compiler/options.ts +23 -62
  317. package/src/compiler/output-paths.ts +5 -18
  318. package/src/compiler/package-entrypoints.ts +345 -0
  319. package/src/compiler/package-json.ts +4 -4
  320. package/src/compiler/parallel-check.ts +543 -147
  321. package/src/compiler/parallel-emit.ts +4 -4
  322. package/src/compiler/parser.ts +166 -47
  323. package/src/compiler/path.ts +22 -2
  324. package/src/compiler/printer/emit-context.ts +16 -0
  325. package/src/compiler/printer/factory-base.ts +10 -3
  326. package/src/compiler/printer/factory.ts +7 -3
  327. package/src/compiler/printer/helpers.ts +10 -1
  328. package/src/compiler/printer/name-generator.ts +24 -2
  329. package/src/compiler/printer/printer.ts +39 -16
  330. package/src/compiler/printer/utilities.ts +8 -2
  331. package/src/compiler/program-checker.ts +53 -5
  332. package/src/compiler/program-utilities.ts +23 -10
  333. package/src/compiler/program.ts +13 -1
  334. package/src/compiler/pseudo-bigint.ts +17 -0
  335. package/src/compiler/regexp-checker.ts +63 -30
  336. package/src/compiler/relations.ts +233 -77
  337. package/src/compiler/reparser.ts +14 -5
  338. package/src/compiler/run-config.ts +1383 -0
  339. package/src/compiler/run-record-read.ts +87 -0
  340. package/src/compiler/run-records.ts +575 -0
  341. package/src/compiler/scanner.ts +166 -120
  342. package/src/compiler/shared-results.ts +3144 -0
  343. package/src/compiler/show-config.ts +18 -1
  344. package/src/compiler/sourcemap.ts +2 -2
  345. package/src/compiler/symbol-accessibility.ts +26 -3
  346. package/src/compiler/symbol.ts +31 -14
  347. package/src/compiler/syntax-kind.ts +188 -187
  348. package/src/compiler/thread-entry.ts +22 -3
  349. package/src/compiler/transformers/alias-references.ts +123 -4
  350. package/src/compiler/transformers/async.ts +2 -17
  351. package/src/compiler/transformers/class-fields.ts +13 -12
  352. package/src/compiler/transformers/commonjs-module.ts +11 -7
  353. package/src/compiler/transformers/declarations-diagnostics.ts +5 -3
  354. package/src/compiler/transformers/declarations-pseudo.ts +2 -4
  355. package/src/compiler/transformers/declarations-resolver.ts +0 -3
  356. package/src/compiler/transformers/declarations-syntactic.ts +1 -21
  357. package/src/compiler/transformers/declarations.ts +136 -49
  358. package/src/compiler/transformers/decorator-metadata.ts +9 -1
  359. package/src/compiler/transformers/destructuring.ts +4 -3
  360. package/src/compiler/transformers/external-module-info.ts +1 -1
  361. package/src/compiler/transformers/jsx.ts +2 -1
  362. package/src/compiler/transformers/reference-resolver.ts +83 -19
  363. package/src/compiler/transformers/runtime-syntax.ts +6 -1
  364. package/src/compiler/transformers/syntax-facts.ts +2 -7
  365. package/src/compiler/transformers/type-eraser.ts +10 -1
  366. package/src/compiler/transformers/type-serialization.ts +3 -2
  367. package/src/compiler/transformers/visitor-base.ts +2 -1
  368. package/src/compiler/transformers/visitor-hooks.ts +9 -4
  369. package/src/compiler/tsc-build.ts +67 -6
  370. package/src/compiler/tsc-cli.ts +35 -4
  371. package/src/compiler/tsc-compile.ts +220 -10
  372. package/src/compiler/tsc-watch.ts +97 -47
  373. package/src/compiler/tsconfig.ts +176 -19
  374. package/src/compiler/type-printer.ts +36 -2
  375. package/src/compiler/types.ts +2 -1
  376. package/src/library/ast.generated.ts +57 -41
  377. package/src/library/compiler-options.generated.ts +117 -103
  378. package/src/library/disk.ts +10 -1
  379. package/src/library/enums.generated.ts +196 -196
@@ -43,6 +43,7 @@ import {
43
43
  newTypeMapper,
44
44
  SimpleTypeMapper,
45
45
  TypeListCache,
46
+ getMappedType,
46
47
  } from './checker-types.js';
47
48
  import {
48
49
  IntersectionFlags,
@@ -87,6 +88,7 @@ import {
87
88
  type Symbol,
88
89
  SymbolFlags,
89
90
  } from './symbol.js';
91
+ import { symbolToString } from './type-printer.js';
90
92
 
91
93
  // ---- Mappers that need the checker
92
94
 
@@ -104,8 +106,8 @@ export class CompositeTypeMapper extends TypeMapper {
104
106
  }
105
107
 
106
108
  map(type: Type): Type {
107
- const t1 = this.m1.map(type);
108
- return t1 !== type ? instantiateType(this.c, t1, this.m2) : this.m2.map(type);
109
+ const t1 = getMappedType(type, this.m1);
110
+ return t1 !== type ? instantiateType(this.c, t1, this.m2) : getMappedType(type, this.m2);
109
111
  }
110
112
  }
111
113
 
@@ -202,23 +204,37 @@ export function instantiateTypeWithAlias(
202
204
  }
203
205
  if (!could && (type.alias === undefined || !aliasCouldContainTypeVariables(c, type))) return type;
204
206
  if (c.instantiationDepth === 100 || c.instantiationCount >= 5000000) {
205
- // Probably infinitely expanding generic types; stop with the error type.
206
- c.error(c.currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
207
+ // Probably infinitely expanding generic types; stop with the error type, naming the types whose
208
+ // instantiations nest three or more times.
209
+ const circularTypeNames = getCircularTypeNames(c);
210
+ if (circularTypeNames.length === 1)
211
+ c.error(c.currentNode, Diagnostics.Instantiations_of_type_0_appear_infinitely_circular, circularTypeNames[0]!);
212
+ else if (circularTypeNames.length > 1)
213
+ c.error(
214
+ c.currentNode,
215
+ Diagnostics.Instantiations_of_the_following_types_appear_infinitely_circular_Colon_0,
216
+ quotedAndCommaSeparated(circularTypeNames),
217
+ );
218
+ else c.error(c.currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
207
219
  return c.errorType;
208
220
  }
209
- const depth = c.activeMapperDepth;
210
- const activeMappers = c.activeMappers;
211
- let index = depth - 1;
212
- while (index >= 0 && activeMappers[index]! !== mapper) index--;
221
+ const depth = c.activeMapperDepth | 0;
222
+ const mapperId = mapper.id | 0;
223
+ let index = (depth - 1) | 0;
224
+ while (index >= 0 && c.activeMapperIds[index]! !== mapperId) index = (index - 1) | 0;
213
225
  if (index === -1) {
214
226
  // A newly active mapper has no cached instantiations; its cache is created when a nested
215
227
  // instantiation with the same mapper stores one.
216
- if (depth < activeMappers.length) {
217
- activeMappers[depth] = mapper;
228
+ if (depth === c.activeMapperIds.length) {
229
+ const grown = new Int32Array(depth * 2);
230
+ grown.set(c.activeMapperIds);
231
+ c.activeMapperIds = grown;
232
+ }
233
+ c.activeMapperIds[depth] = mapperId;
234
+ if (depth < c.activeMapperCaches.length) {
218
235
  c.activeMapperCaches[depth] = undefined;
219
236
  c.activeMapperAliasCaches[depth] = undefined;
220
237
  } else {
221
- activeMappers.push(mapper);
222
238
  c.activeMapperCaches.push(undefined);
223
239
  c.activeMapperAliasCaches.push(undefined);
224
240
  }
@@ -236,7 +252,11 @@ export function instantiateTypeWithAlias(
236
252
  }
237
253
  c.instantiationCount++;
238
254
  c.totalInstantiations++;
239
- c.instantiationDepth++;
255
+ const instantiationDepth = c.instantiationDepth;
256
+ const instantiationStack = c.instantiationStack;
257
+ if (instantiationDepth < instantiationStack.length) instantiationStack[instantiationDepth] = type;
258
+ else instantiationStack.push(type);
259
+ c.instantiationDepth = instantiationDepth + 1;
240
260
  const result = instantiateTypeWorker(c, type, mapper, alias);
241
261
  if (index === -1) {
242
262
  // The mapper's slot stays until it is reused; its caches are released now.
@@ -274,6 +294,32 @@ export function instantiateTypeWithAlias(
274
294
  return result;
275
295
  }
276
296
 
297
+ /**
298
+ * The names of the types that are instantiated three or more times on the current instantiation stack, by
299
+ * their alias where they have one, in the order they reach the third, each once.
300
+ */
301
+ function getCircularTypeNames(c: Checker): string[] {
302
+ const counts = new Map<Type, number>();
303
+ const names: string[] = [];
304
+ const stack = c.instantiationStack;
305
+ for (let i = 0; i < c.instantiationDepth; i++) {
306
+ const t = stack[i]!;
307
+ const count = (counts.get(t) ?? 0) + 1;
308
+ counts.set(t, count);
309
+ if (count !== 3) continue;
310
+ const symbol = t.alias !== undefined ? t.alias.symbol : t.symbol;
311
+ if (symbol === undefined || symbol.name.length === 0 || symbol.name.charCodeAt(0) === 0xfffe) continue;
312
+ const name = symbolToString(c, symbol);
313
+ if (!names.includes(name)) names.push(name);
314
+ }
315
+ return names;
316
+ }
317
+
318
+ /** `'a', 'b', 'c'`. */
319
+ export function quotedAndCommaSeparated(items: readonly string[]): string {
320
+ return items.map((item) => "'" + item + "'").join(', ');
321
+ }
322
+
277
323
  function aliasCouldContainTypeVariables(c: Checker, type: Type): boolean {
278
324
  const alias = type.alias;
279
325
  if (alias === undefined || alias.typeArguments.length === 0) return false;
@@ -358,7 +404,7 @@ function isNonGenericTopLevelType(type: Type): boolean {
358
404
 
359
405
  function instantiateTypeWorker(c: Checker, type: Type, mapper: TypeMapper, alias: TypeAlias | undefined): Type {
360
406
  const flags = type.flags;
361
- if ((flags & TypeFlags.TypeParameter) !== 0) return mapper.map(type);
407
+ if ((flags & TypeFlags.TypeParameter) !== 0) return getMappedType(type, mapper);
362
408
  if ((flags & TypeFlags.Object) !== 0) {
363
409
  const objectFlags = type.objectFlags;
364
410
  if ((objectFlags & (ObjectFlags.Reference | ObjectFlags.Anonymous | ObjectFlags.Mapped)) === 0) return type;
@@ -447,7 +493,7 @@ function getObjectTypeInstantiation(
447
493
  mapper: TypeMapper,
448
494
  alias: TypeAlias | undefined,
449
495
  ): Type {
450
- if ((type.objectFlags & ObjectFlags.Reference) === 0 && c.withoutOuterTypeParameters.get(type.id) !== 0) return type;
496
+ if ((type.objectFlags & ObjectFlags.Reference) === 0 && c.withoutOuterTypeParameters.has(type.id)) return type;
451
497
  let declaration: Node;
452
498
  if ((type.objectFlags & ObjectFlags.Reference) !== 0) declaration = (type as TypeReference).node!;
453
499
  else if ((type.objectFlags & ObjectFlags.InstantiationExpressionType) !== 0)
@@ -483,7 +529,7 @@ function getObjectTypeInstantiation(
483
529
  links.outerTypeParameters = typeParameters;
484
530
  }
485
531
  if (typeParameters.length === 0) {
486
- if ((type.objectFlags & ObjectFlags.Reference) === 0) c.withoutOuterTypeParameters.set(type.id, 1);
532
+ if ((type.objectFlags & ObjectFlags.Reference) === 0) c.withoutOuterTypeParameters.add(type.id);
487
533
  return type;
488
534
  }
489
535
  // The type arguments, mapped as `combineTypeMappers(c, type.mapper, mapper)` maps them, into a
@@ -491,10 +537,10 @@ function getObjectTypeInstantiation(
491
537
  const typeMapper = type.mapper;
492
538
  const mapped = c.freeTypeLists.pop() ?? [];
493
539
  for (const tp of typeParameters) {
494
- if (typeMapper === undefined) mapped.push(mapper.map(tp));
540
+ if (typeMapper === undefined) mapped.push(getMappedType(tp, mapper));
495
541
  else {
496
- const t1 = typeMapper.map(tp);
497
- mapped.push(t1 !== tp ? instantiateType(c, t1, mapper) : mapper.map(tp));
542
+ const t1 = getMappedType(tp, typeMapper);
543
+ mapped.push(t1 !== tp ? instantiateType(c, t1, mapper) : getMappedType(tp, mapper));
498
544
  }
499
545
  }
500
546
  const newAlias = alias ?? instantiateTypeAlias(c, type.alias, mapper);
@@ -804,10 +850,19 @@ export function instantiateSymbol(c: Checker, symbol: Symbol, mapper: TypeMapper
804
850
  * is resolved yet, so lazily instantiated members record it when tsgo would instantiate them.
805
851
  */
806
852
  export function keepsSymbolUnderInstantiation(c: Checker, symbol: Symbol, mapper: TypeMapper): boolean {
807
- const symbolId = getSymbolId(symbol);
808
- if (mapper.mapsThisOnly() && isThisless(symbol)) return true;
809
- // A resolved type that can't change under instantiation keeps the symbol.
810
- const type = c.symbolTypes.get(symbolId);
853
+ if (mapper.mapsThisOnly() && isThisless(symbol)) {
854
+ getSymbolId(symbol);
855
+ return true;
856
+ }
857
+ return keepsSymbolTypeUnderInstantiation(c, symbol);
858
+ }
859
+
860
+ /**
861
+ * Whether the resolved type of `symbol` (and its write type) can't change under instantiation, so that
862
+ * `instantiateSymbol` keeps it whatever the mapper. Once true, it stays true: types are resolved once.
863
+ */
864
+ export function keepsSymbolTypeUnderInstantiation(c: Checker, symbol: Symbol): boolean {
865
+ const type = c.symbolTypes.get(getSymbolId(symbol));
811
866
  if (type !== undefined && !couldContainTypeVariables(c, type)) {
812
867
  if ((symbol.flags & SymbolFlags.SetAccessor) === 0) return true;
813
868
  const writeType = c.existingSymbolLinks(symbol)?.writeType;
@@ -46,6 +46,7 @@ import {
46
46
  getTagName,
47
47
  getType,
48
48
  type EntityName,
49
+ getText,
49
50
  } from './ast.js';
50
51
  import { isReservedWord, tokenIsIdentifierOrKeyword } from './ast-utilities.js';
51
52
  import { CharacterCodes, isWhiteSpaceLike } from './character-codes.js';
@@ -56,6 +57,7 @@ import { Reparser } from './reparser.js';
56
57
  import { getLeadingCommentRanges, getTrailingCommentRanges } from './scanner.js';
57
58
  import { SyntaxKind } from './syntax-kind.js';
58
59
  import type { CommentRange } from './types.js';
60
+ import { IdentifierName } from './identifier-name.js';
59
61
 
60
62
  const enum JSDocState {
61
63
  BeginningOfLine,
@@ -937,6 +939,7 @@ export class JSDocParser {
937
939
  undefined,
938
940
  SyntaxKind.NamespaceKeyword,
939
941
  typeNameOrNamespaceName,
942
+ undefined,
940
943
  body,
941
944
  );
942
945
  if (nested) jsDocNamespaceNode.flags |= NodeFlags.NestedNamespace;
@@ -1228,16 +1231,17 @@ export class JSDocParser {
1228
1231
  p.parseErrorAtCurrentToken(Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, [
1229
1232
  p.scanner.getTokenText(),
1230
1233
  ]);
1231
- const missing = p.newIdentifier('');
1234
+ const missing = p.newIdentifier(new IdentifierName(''));
1232
1235
  p.finishNode(missing, p.nodePos());
1233
1236
  return missing;
1234
1237
  }
1235
1238
  const pos = p.scanner.getTokenStart();
1236
1239
  const end = p.scanner.getTokenEnd();
1237
1240
  const text = p.scanner.getIdentifierValue();
1241
+ const name = p.scanner.getIdentifierName();
1238
1242
  p.internIdentifier(text);
1239
1243
  p.nextTokenJSDoc();
1240
- const result = p.newIdentifier(text);
1244
+ const result = p.newIdentifier(name);
1241
1245
  p.finishNodeWithEnd(result, pos, end);
1242
1246
  return result;
1243
1247
  }
@@ -1270,7 +1274,7 @@ function textsEqual(a: Node, b: Node): boolean {
1270
1274
  if (
1271
1275
  a instanceof QualifiedName &&
1272
1276
  b instanceof QualifiedName &&
1273
- (a as QualifiedName).right.text === (b as QualifiedName).right.text
1277
+ getText((a as QualifiedName).right) === getText((b as QualifiedName).right)
1274
1278
  ) {
1275
1279
  a = (a as QualifiedName).left;
1276
1280
  b = (b as QualifiedName).left;
@@ -7,8 +7,6 @@
7
7
  // checker that touches part of a program (as each of several parallel checkers does) stores only
8
8
  // the pages it touches.
9
9
 
10
- import type { Symbol } from './symbol.js';
11
-
12
10
  /** Links are stored in pages of 256 ids. */
13
11
  export const enum LinkPaging {
14
12
  Bits = 8,
@@ -203,20 +201,24 @@ const enum IdSetPaging {
203
201
 
204
202
  /** The number of set bits of a 32-bit value. */
205
203
  function bitCount(x: number): number {
206
- x = x - ((x >>> 1) & 0x55555555);
204
+ x = (x - ((x >>> 1) & 0x55555555)) | 0;
207
205
  x = (x & 0x33333333) + ((x >>> 2) & 0x33333333);
208
206
  x = (x + (x >>> 4)) & 0x0f0f0f0f;
209
- return Math.imul(x, 0x01010101) >>> 24;
207
+ // At most 32, so the top byte is the count with either shift; `>>` keeps it an int32.
208
+ return Math.imul(x, 0x01010101) >> 24;
210
209
  }
211
210
 
212
211
  /**
213
- * A page of a `CompactSymbolLinkTable`: one bit per id of the page in eight 32-id words, the number
214
- * of symbols stored before each word, and the symbols in id order. The words are fields, so a
215
- * lookup reads one object before the symbols. The class isn't generic, so natively the words are
216
- * 32-bit fields: every write stores an int32.
212
+ * A page of a `CompactLinkTable`'s presence bits: one bit per id of the page in eight 32-id words, the
213
+ * number of values stored before each word, and the position of the page's values in the table's
214
+ * `values`. The words are fields, so a lookup reads one object before the values. Natively the words
215
+ * are 32-bit fields, since every write stores an int32. A class that is generic or has a generic
216
+ * subclass keeps its number fields as doubles, so the values the bits index are in the table's
217
+ * `values`, not in this class or a subclass.
217
218
  */
218
219
  class CompactLinkPage {
219
- readonly values: Symbol[];
220
+ /** The position of the page's values in the table's `values`. */
221
+ readonly position: number;
220
222
  private w0: number;
221
223
  private w1: number;
222
224
  private w2: number;
@@ -229,8 +231,8 @@ class CompactLinkPage {
229
231
  private before0: number;
230
232
  private before1: number;
231
233
 
232
- constructor() {
233
- this.values = [];
234
+ constructor(position: number) {
235
+ this.position = position | 0;
234
236
  this.w0 = 0;
235
237
  this.w1 = 0;
236
238
  this.w2 = 0;
@@ -297,72 +299,90 @@ class CompactLinkPage {
297
299
  rank(slot: number, bits: number): number {
298
300
  const word = slot >> 5;
299
301
  const before = ((word < 4 ? this.before0 : this.before1) >>> ((word & 3) << 3)) & 0xff;
300
- return before + bitCount(bits & ((1 << (slot & 31)) - 1));
302
+ return (before + bitCount(bits & ((1 << (slot & 31)) - 1))) | 0;
301
303
  }
302
304
 
303
- /** Adds `delta` to the counts of the words after `word`. */
305
+ /**
306
+ * Adds 1 (`delta` 1) or subtracts 1 (`delta` -1) from the counts of the words after `word`, a byte
307
+ * of `before0` or `before1` each. No byte carries or borrows: a count is at most 224, and a count
308
+ * that goes down includes the value removed.
309
+ */
304
310
  shiftCounts(word: number, delta: number): void {
305
- for (let w = word + 1; w < 8; w++) {
306
- const step = delta << ((w & 3) << 3);
307
- if (w < 4) this.before0 = (this.before0 + step) | 0;
308
- else this.before1 = (this.before1 + step) | 0;
309
- }
311
+ // A 1 in each byte of the words after `word`: shifting `0x01010100` left by `word` bytes keeps
312
+ // the bytes above it, and shifts them all out at word 3.
313
+ const low = word < 4 ? 0x01010100 << (word << 3) : 0;
314
+ const high = word < 4 ? 0x01010101 : 0x01010100 << ((word & 3) << 3);
315
+ this.before0 = (this.before0 + Math.imul(low, delta)) | 0;
316
+ this.before1 = (this.before1 + Math.imul(high, delta)) | 0;
310
317
  }
311
318
  }
312
319
 
313
320
  /**
314
- * Symbols by node id, for ids a checker resolves in one in four to one in eight of the ids of the
315
- * pages it touches, as it resolves the identifiers and names of the files it checks. Pages of
316
- * `LinkPaging.Size` ids keep a presence bit per id and only the symbols stored, so a symbol costs
317
- * about one array slot. A `LinkTable` page costs a slot for every id, and a `Map` entry also
318
- * stores its key and a share of the hash buckets. At fewer values per page than that, the page's
319
- * own allocations outweigh what it saves, and a `SparseLinkTable` costs less.
321
+ * Values by node or symbol id, for ids a checker stores a value for in more than about one in
322
+ * sixteen of the ids of the pages it touches: the symbols it resolves for the identifiers and names
323
+ * of the files it checks (one in four to one in eight), the types and signatures it resolves for
324
+ * their type nodes and calls (one in twelve to one in seventeen), and the symbol columns most
325
+ * symbols leave empty, such as the name type of a property (one in ten to one in three with
326
+ * `--checkers 16`, where every checker touches symbols across the whole program). Pages of
327
+ * `LinkPaging.Size` ids keep a presence bit per id and only the values stored, so a value costs
328
+ * about one array slot. A `LinkTable` page costs a slot for every id, and a `Map` entry also stores
329
+ * its key and a share of the hash buckets. At fewer values per page than that, the page's own
330
+ * allocations outweigh what it saves, and a `SparseLinkTable` costs less.
320
331
  */
321
- export class CompactSymbolLinkTable {
332
+ export class CompactLinkTable<T> {
333
+ /**
334
+ * The pages by `id >> LinkPaging.Bits`, up to the highest page stored; undefined where a page stores
335
+ * nothing. A checker stores values in a few percent of the pages of a large program, so the values
336
+ * are kept apart, one list for each page stored, rather than in a second slot per page.
337
+ */
322
338
  readonly pages: (CompactLinkPage | undefined)[] = [];
323
- /** The number of symbols stored. */
339
+ /** The values of each page stored, in id order, at the page's `position`. */
340
+ readonly values: T[][] = [];
341
+ /** The number of values stored. */
324
342
  size = 0;
325
343
 
326
- get(id: number): Symbol | undefined {
327
- const page = this.pages[id >> LinkPaging.Bits];
344
+ get(id: number): T | undefined {
345
+ const index = id >> LinkPaging.Bits;
346
+ const page = this.pages[index];
328
347
  if (page === undefined) return undefined;
329
348
  const slot = id & LinkPaging.Mask;
330
349
  const bits = page.word(slot >> 5);
331
350
  if ((bits & (1 << (slot & 31))) === 0) return undefined;
332
- return page.values[page.rank(slot, bits)];
351
+ return this.values[page.position]![page.rank(slot, bits)];
333
352
  }
334
353
 
335
- set(id: number, value: Symbol | undefined): void {
354
+ set(id: number, value: T | undefined): void {
336
355
  const index = id >> LinkPaging.Bits;
337
356
  let page = this.pages[index];
338
357
  if (page === undefined) {
339
358
  if (value === undefined) return;
340
359
  while (this.pages.length <= index) this.pages.push(undefined);
341
- page = new CompactLinkPage();
360
+ page = new CompactLinkPage(this.values.length);
342
361
  this.pages[index] = page;
362
+ this.values.push([]);
343
363
  }
364
+ const values = this.values[page.position]!;
344
365
  const slot = id & LinkPaging.Mask;
345
366
  const word = slot >> 5;
346
367
  const bit = 1 << (slot & 31);
347
368
  const bits = page.word(word);
348
369
  const at = page.rank(slot, bits);
349
- const values = page.values;
350
370
  if ((bits & bit) !== 0) {
351
371
  if (value !== undefined) {
352
372
  values[at] = value;
353
373
  return;
354
374
  }
355
- for (let i = at; i < values.length - 1; i++) values[i] = values[i + 1]!;
356
- values.pop();
375
+ if (at === values.length - 1) values.pop();
376
+ else values.splice(at, 1);
357
377
  page.setWord(word, bits & ~bit);
358
378
  page.shiftCounts(word, -1);
359
379
  this.size--;
360
380
  return;
361
381
  }
362
382
  if (value === undefined) return;
363
- values.push(value);
364
- for (let i = values.length - 1; i > at; i--) values[i] = values[i - 1]!;
365
- values[at] = value;
383
+ // Values are mostly stored in id order, at the end.
384
+ if (at === values.length) values.push(value);
385
+ else values.splice(at, 0, value);
366
386
  page.setWord(word, bits | bit);
367
387
  page.shiftCounts(word, 1);
368
388
  this.size++;
@@ -370,6 +390,31 @@ export class CompactSymbolLinkTable {
370
390
 
371
391
  clear(): void {
372
392
  this.pages.length = 0;
393
+ this.values.length = 0;
373
394
  this.size = 0;
374
395
  }
375
396
  }
397
+
398
+ /**
399
+ * Int32 values by id, zero where none is stored, in a `CompactLinkTable`: pages of
400
+ * `LinkPaging.Size` ids keep a presence bit per id and only the nonzero values. For columns where a
401
+ * checker stores a value for fewer than about one in three of the ids of the pages it touches, such
402
+ * as the reference kinds of the symbols its files reference: an `IntLinkTable` page costs four bytes
403
+ * for every id.
404
+ */
405
+ export class CompactIntLinkTable {
406
+ private readonly table = new CompactLinkTable<number>();
407
+
408
+ get(id: number): number {
409
+ return this.table.get(id) ?? 0;
410
+ }
411
+
412
+ set(id: number, value: number): void {
413
+ value = value | 0;
414
+ this.table.set(id, value === 0 ? undefined : value);
415
+ }
416
+
417
+ clear(): void {
418
+ this.table.clear();
419
+ }
420
+ }