seaofvoices / darklua

A command line tool that transforms Lua code
https://darklua.com/
MIT License
78 stars 10 forks source link

Support Luau types #129

Closed jeparlefrancais closed 11 months ago

jeparlefrancais commented 11 months ago

Closes #40

Finally, darklua will be able to handle type annotations.

Coming next before releasing this is the strip luau types rule to make sure current behavior of darklua is retained which is to remove all types.

github-actions[bot] commented 11 months ago

Coverage after merging support-luau-types into main will be

86.82%

Coverage Report for Changed Files
FileStmtsBranchesFuncsLinesUncovered Lines
src
   ast_converter.rs87.49%100%88.57%87.44%1002, 1021, 1051, 1075, 1092, 1124–1126, 1141, 1153, 1169, 1211, 1233–1235, 1245, 1250–1252, 1267, 1278, 1408–1410, 1471–1473, 1524–1526, 1550–1553, 1588–1590, 1618–1620, 1624–1626, 1689–1690, 1719–1721, 1728–1730, 1749–1751, 1767–1769, 1774–1776, 1837, 1842–1844, 1864, 1870–1872, 1877–1879, 1912–1917, 1941–1943, 1969, 2032, 2050–2052, 2088–2090, 2096–2099, 2129, 2143, 2147–2149, 218–220, 2203–2205, 2217–2219, 2223–2225, 2259, 2334, 2342–2344, 235, 2353, 236, 2364–2366, 237, 2380, 2387–2389, 2419–2421, 2437, 2441, 2464–2466, 2478–2480, 2499–2501, 2556–2558, 2565, 265–267, 2755, 2828–2835, 2837–2844, 2846–2856, 2865, 2867–2872, 2875, 2900–2902, 2913–2915, 2932–2934, 484, 499–501, 536–538, 546, 560, 576–578, 580–581, 583–585, 598–600, 604, 613–615, 656, 667–669, 675–677, 696, 709, 720, 807, 811–813, 896, 911, 920, 932, 944, 964, 981, 985–988
   parser.rs99.26%100%74.19%99.53%37, 43, 55–59, 66
src/generator
   dense.rs87.88%100%90.11%87.66%1008–1016, 1018–1024, 1026–1034, 1039, 1048, 1060–1063, 1067–1070, 147–148, 150, 164–165, 167, 250–252, 331, 50–55, 567–569, 57–59, 6, 61–63, 638, 65–69, 843, 861, 878, 904–911, 945–949, 960–968, 970–976, 978, 987–988, 993, 999
   mod.rs98.62%100%100%98.51%340, 356, 360
   readable.rs95.47%100%94.34%95.58%1068, 1092–1096, 1147, 1201–1209, 1211–1217, 1219, 1254, 1264, 1273, 1282, 1291, 192–193, 198, 203, 221–222, 46–51, 53, 58, 612–613
   token_based.rs89.91%100%92.90%89.64%10, 1000–1003, 1006, 1008–1017, 1020–1021, 1037–1038, 1052–1054, 1068–1070, 1079–1081, 1090–1092, 1101–1103, 124–125, 1251, 1321, 1358–1366, 141–142, 1448–1457, 1482–1484, 1486–1488, 1505–1514, 154–155, 1589, 176–177, 197–199, 2034–2035, 2061–2065, 2094–2098, 2105–2109, 2311, 2315, 2328, 239, 291–295, 367–368, 374, 386, 420–421, 443–444, 460–461, 503, 576–577, 586–587, 593–594, 600, 612, 638–639, 672–673, 741–742, 768–769, 778–779, 785–786, 79, 792, 804, 829–830, 871–872, 932–939, 954–955, 964–965, 972, 985–992, 994–999
   utils.rs95.03%100%96.77%94.83%106, 293–296, 30–31, 33, 35, 59, 69, 79, 89
src/nodes
   function_body.rs98.23%100%96.30%98.49%
   identifier.rs93.62%100%89.47%94.67%58–60
   typed_identifier.rs91.23%100%90.91%91.30%59–62, 67, 74, 88
src/nodes/expressions
   binary.rs94.89%100%95.56%94.79%55, 57, 65–67, 69–71, 75–76, 85
   function.rs91.24%100%90%91.56%123–125, 215–218, 41–44, 90
   mod.rs71.05%100%73.68%70.39%129–131, 135–137, 141–143, 147–149, 153–155, 159–161, 165–167, 177–179, 183–185, 261, 307–310, 312, 85–90, 92–96
   prefix.rs66%100%75%63.16%23, 25–27, 39–41, 58–60, 76–78
   type_cast.rs75%100%72.22%75.86%61–64, 67–70, 79–82
src/nodes/statements
   function.rs87.47%100%85.29%87.96%123–125, 174–183, 36–40, 406–409, 41, 410–414, 42–43
   generic_for.rs81.48%100%78.57%82.09%180–186, 50–62
   local_assign.rs95.53%100%92.86%95.97%116–119, 219, 52–53, 55–56
   local_function.rs94.14%100%91.07%94.93%117–121, 43–45
   mod.rs100%100%100%100%
   numeric_for.rs81.60%100%75.86%82.84%158–160, 183–188, 47–56
   type_declaration.rs48.58%100%60%46.70%120–122, 13–14, 140–142, 144–149, 15, 150, 152–159, 16, 160, 162–165, 168–169, 17, 171–177, 179, 18, 180–187, 189, 19, 190–192, 195–196, 21–22, 225–229, 23, 230–231, 233–239, 24, 240–241, 243–246, 249, 25, 250, 26–27, 37–43
src/nodes/types
   array.rs52.50%100%50%53.33%43–46, 49–52, 61–64, 74–77, 79–82, 89–92
   expression_type.rs51.19%100%50%51.56%43–46, 49–52, 61–64, 75–79, 81–85, 93–97
   function.rs63.67%100%67.19%62.71%100–105, 197–205, 276–282, 285–291, 303–309, 321–328, 330–337, 348–355, 52–54, 72–78, 81–87, 99
   generics.rs64.99%100%59.84%66.23%100–103, 105–107, 110–112, 115–117, 120–122, 125–127, 129–131, 133–135, 137–139, 141–143, 156–158, 169–175, 177–183, 193–199, 28, 283–286, 289, 29, 290–292, 30, 301–304, 330–332, 359–364, 366–371, 380–385, 43–45, 455, 47, 470–472, 474, 48, 482, 49, 493–495, 497, 50–52, 537–539, 54–55, 552–555, 558–559, 56, 560–561, 57, 570–573, 58, 584–586, 59, 590–592, 596–598, 602–604, 68–73, 781–785, 788–789, 791–797
   intersection.rs73.61%100%70.59%74.55%