|
| 1 | +# 0.15.0 |
| 2 | + |
| 3 | +2023-01-20 |
| 4 | + |
| 5 | +This release features commits by Li Jin, Carl Lei, Yang Li, |
| 6 | +Pierre Chapuis, @lenscas, Stéphane Veyret, and Hisham Muhammad. |
| 7 | + |
| 8 | +# What's New |
| 9 | + |
| 10 | +### Language |
| 11 | + |
| 12 | +* Type-only `require`: |
| 13 | + * Adds new syntax for requiring a module's exported type |
| 14 | + without generating a `require()` call in the output Lua: |
| 15 | + `local type MyType = require("mytype")` -- circular |
| 16 | + definitions of `local type`-required types are allowed, |
| 17 | + as long as the type is only referenced but its contents |
| 18 | + are not dereferenced. |
| 19 | +* New variable attribute `<total>`: |
| 20 | + * It declares a const variable with a table where the |
| 21 | + domain of its keys are totally declared. |
| 22 | + * This check can only be applied when a literal table is given |
| 23 | + at the time of variable initialization, and only for table types |
| 24 | + with well-known finite domains: maps with enum keys, maps with |
| 25 | + boolean keys, records. |
| 26 | + * Note that the requirement is that keys are declared: they may |
| 27 | + still be explicitly declared to be nil. |
| 28 | +* Type inference improvements: |
| 29 | + * Improved flow-typing in `if` blocks - if a block ends |
| 30 | + with `return`, then the remainder of the function can |
| 31 | + infer the negation of its condition. |
| 32 | + * In contexts where the expected type of an expression |
| 33 | + is known (e.g. assignments, declarations with explicit |
| 34 | + type signatures), the return type a function call can |
| 35 | + now determine the type argument of a function. |
| 36 | + * In particular, `local x: T = setmetatable({}, mt)` |
| 37 | + can now infer that `{}` is `T` without a cast. |
| 38 | + * When initializing a union with a value, that value |
| 39 | + is now used by the flow-typing engine to narrow the |
| 40 | + variable's concrete known type. |
| 41 | +* Local functions can be forward-declared with a `local` |
| 42 | + variable declaration and then implemented with bare |
| 43 | + `function` notation, more similarly to how record functions |
| 44 | + (and Lua functions) work. |
| 45 | +* Handling of `.` and index notations is now more consistent |
| 46 | + for both maps and records: |
| 47 | + * Map keys can now use `.`-notation like records, and |
| 48 | + get the same checks (e.g. if a key type is a valid enum) |
| 49 | + * `__index` metamethod works for `.`-notation as well. |
| 50 | +* Some stricter checks: |
| 51 | + * Unused type arguments in function signatures are now |
| 52 | + flagged as an error. |
| 53 | + * Using the `#` operator on a numeric-keyed map now produces a |
| 54 | + warning, and on a non-numeric-keyed map it produces an error. |
| 55 | + * Redeclaration of boolean keys in a map literal are |
| 56 | + now an error. |
| 57 | + * Cannot declare a union between multiple tuple types |
| 58 | + as these can't be discriminated. |
| 59 | + * Cannot redeclare a record method with different type |
| 60 | + signatures; produces a warning when redeclaring with |
| 61 | + the same type signature. |
| 62 | +* Standard library improvements: |
| 63 | + * `pcall` and `xpcall` have vararg return types |
| 64 | + |
| 65 | +### Fixes |
| 66 | + |
| 67 | +* Fixed check between `or` expression and nominal unions. |
| 68 | +* Fixed function call return values when returning |
| 69 | + unions with type arguments. (#604) |
| 70 | +* Fixed an error when exporting type aliases. (#586) |
| 71 | +* `__call` metamethods that are declared using a type alias |
| 72 | + now resolve correctly. (#605) |
| 73 | +* Generic return types are more consistenly checked, |
| 74 | + potentially reporting errors that went undetected before. |
| 75 | +* Fixed type variable name conflicts in record functions, |
| 76 | + ensuring nested uses of generic record functions using |
| 77 | + type variables don't cause conflicts. (#560) |
| 78 | +* Fixed the inference of type arguments in return values. (#512) |
| 79 | +* Fixed the error message for redefined functions. (#566) |
| 80 | +* Fixed a case where a userdata record type is not |
| 81 | + resolved properly. (#585) |
| 82 | +* Fixed some issues with the `<close>` attribute. |
| 83 | +* `tl warnings` no longer misses some warning types. |
| 84 | + |
| 85 | +### Code generation |
| 86 | + |
| 87 | +* Report error on unterminated long comments instead of |
| 88 | + generating invalid code. |
| 89 | +* Cleaner code is produced for `is nil` checks. |
| 90 | + |
| 91 | +### API |
| 92 | + |
| 93 | +API changes for more consistent processing of syntax errors: |
| 94 | + |
| 95 | +* `tl.lex` changed: it now returns an `{Error}` array instead |
| 96 | + of a list of error Tokens. |
| 97 | + * from `function tl.lex(input: string): {Token}, {Token}` |
| 98 | + * to `function tl.lex(input: string, filename: string): {Token}, {Error}` |
| 99 | +* `tl.parse_program` changed: it no longer returns the first |
| 100 | + integer argument, which as always ignored by every caller. |
| 101 | + * from `function tl.parse_program(tokens: {Token}, errs: {Error}, filename: string): integer, Node, {string}` |
| 102 | + * to `function tl.parse_program(tokens: {Token}, errs: {Error}, filename: string): Node, {string}` |
| 103 | +* `tl.parse` is a new function that combines |
| 104 | + `tl.lex` and `tl.parse_program` the right way, avoiding previous |
| 105 | + mistakes; this is the preferred function to use moving forward. |
| 106 | + * signature: `function tl.parse(input: string, filename: string): Node, {Error}, {string}` |
| 107 | + |
| 108 | +### Tooling |
| 109 | + |
| 110 | +* Better handling of newlines on Windows. |
| 111 | +* `tl types`: in function calls of polymorphic functions, now |
| 112 | + the return type of the resolved function is reported. |
| 113 | +* More informative pretty-print of polymorphic function signatures |
| 114 | + in error messages. |
| 115 | +* More informative error message for field assignment failures. |
| 116 | +* Improved error message for inconsistent fields (#576) |
| 117 | +* The parser now does some lookahead heuristics to provide nicer |
| 118 | + error messages. |
| 119 | +* The compiler now detects mis-aligned `end` keywords when reporting |
| 120 | + about unmatched blocks, which helps pointing to the place where a |
| 121 | + mistake actually occurred, instead of the end of the file. |
| 122 | +* For debugging the compiler itself: |
| 123 | + * new environment variable mode `TL_DEBUG=1` inspects AST nodes |
| 124 | + and types as program is compiled. |
| 125 | + * `TL_DEBUG` with a negative value `-x` will run like `TL_DEBUG=1` |
| 126 | + but halt the compiler after processing input line `x`. |
| 127 | + |
1 | 128 | # 0.14.1
|
2 | 129 |
|
3 | 130 | 2022-08-23
|
@@ -454,7 +581,7 @@ This new release does not include big language changes, but includes a lot of
|
454 | 581 | new stuff! The new `tl types` infrastructure for IDE tooling, `build.tl`
|
455 | 582 | support in `tl build`, code generation options, and tons of bugfixes.
|
456 | 583 |
|
457 |
| -This release features commits by Corey Williamson, lenscas, Patrick |
| 584 | +This release features commits by Corey Williamson, @lenscas, Patrick |
458 | 585 | Desaulniers and Hisham Muhammad.
|
459 | 586 |
|
460 | 587 | ## What's New
|
|
0 commit comments