Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next version! #732

Merged
merged 224 commits into from
Oct 7, 2024
Merged

Next version! #732

merged 224 commits into from
Oct 7, 2024

Commits on Aug 31, 2024

  1. make type system more nominal, except for unions

    Instead of treating nominal records nominally and all other nominal
    types structurally, with this commit we treat all nominal types
    nominally except for unions, which are treated structurally.
    
    Give this branch a try in your codebase and let me know your impressions!
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    58701af View commit details
    Browse the repository at this point in the history
  2. don't infer table literal as the first table type of a union

    Now that unions may contain multiple table types, only infer
    a table literal into the table type of a union if there's
    a single table type in a union.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    79c9b09 View commit details
    Browse the repository at this point in the history
  3. macroexp: initial commit

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    c46dee5 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d36733c View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    800cc79 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    8d11028 View commit details
    Browse the repository at this point in the history
  7. __is: accept unions over multiple tables that declare __is metamethod

    Accordingly, accept `is` checks on table types that declare `__is`.
    
    We disallow unions mixing tables with and without `__is`. This is a limitation
    because to lift it we would have to implement code that transforms this
    
    ```
    local u = R1 | R2 | {number} -- R1 and R2 have __is, {number} doesn't
    
    if u is {number} then
       -- ...
    end
    ```
    
    into (effectively)
    
    ```
    local u = R1 | R2 | {number} -- R1 and R2 have __is, {number} doesn't
    
    if not (u is R1 or u is R2) then
       -- ...
    end
    ```
    
    In other words, "is" testing for the one table/userdata item without __is
    would have to be defined in terms of the negation of the disjunction of
    all the other cases.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    11acc34 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    7decf46 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    e3bf9fd View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    bf791d1 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    a40d062 View commit details
    Browse the repository at this point in the history
  12. add magic type @self

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    621a3f0 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    db02a91 View commit details
    Browse the repository at this point in the history
  14. interfaces: add "is <interface_list>" to record syntax

    Also check that types referenced in `is` exist.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    d34d144 View commit details
    Browse the repository at this point in the history
  15. interfaces: is_record_type

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    0b494bf View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    8f20b6e View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    559d6c2 View commit details
    Browse the repository at this point in the history
  18. interfaces/records: move arrayrecord to is {...}

    This avoids a grammar ambiguity in the `where` clause, where a following `{T}`
    would be mistaken as being part of the `where` expression.
    
    We still support a `{T}` at the top of the record declaration if there is no
    `is` clause, but not in the middle of the field list anymore.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    9726088 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    27124cf View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    bdc937f View commit details
    Browse the repository at this point in the history
  21. interfaces: prevent assignment to interfaces and types

    Interfaces are abstract, so they cannot be assigned to, unlike record fields,
    which are concrete values when records are used as prototypes.
    
    We already prevented assignment overwriting top-level records. This commit
    also extends the restriction to nested records, for consistency.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    bf75403 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    9a5aeb4 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    f034cf1 View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    d62c0e1 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    997d289 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    51a0be2 View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    44bdf19 View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    7f3fd80 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    3583627 View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    3b25cdb View commit details
    Browse the repository at this point in the history
  31. remove "tl build"

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    3a81bd0 View commit details
    Browse the repository at this point in the history
  32. remove node.type

    * Node objects no longer carry a `.type` attribute. This was
      redundant with the return values produced by the node visitors,
      which are then available in the traversal as the `children`
      array. The idea is that the logic of resolving types should
      follow the single-pass flow of traversal, instead of having
      to track the code of visitors that peek into the tree structure
      (or worse, modify it after the fact as they go).
    * Because of that, the collection of types for `tl types` has
      changed: instead of always collecting a symbol table during
      type checking, one needs to enable `report_types = true` in
      the `env`, which then performs the collection and summarization
      of the data reported by `tl types` in place. This makes the
      overall process more efficient for both `tl check` and `tl types`.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    4896aee View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    5658b9a View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    c54e4f5 View commit details
    Browse the repository at this point in the history
  35. remove "nestedtype"

    Apparently we don't need it anymore!
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    8a49055 View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    988e45c View commit details
    Browse the repository at this point in the history
  37. avoid setting (or updating!) typename directly

    This is to ensure that there is always a consistent correspondence between a
    typeid and its typename (that is, if the typename changes, we update the
    typeid as well).
    
    With consistency between typeids and typenames, we would _almost_ be able to
    cache type comparison judgements based on typeids alone. We're not able to do
    it just because type comparisons such as is_a and same_type have one possible
    side-effect: inferring typevars.
    
    From my experiments, in the current state of the code there's no real
    performance gain by caching type comparisons, but it would be nice to be able
    to do it for better understandability -- intuitively, type comparisons should
    be a pure operation.
    
    In any case, the changes in this commit should make it easier to reason about
    and debug the code in the long term.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    fe33c75 View commit details
    Browse the repository at this point in the history
  38. Configuration menu
    Copy the full SHA
    be6a19e View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    8aaf3de View commit details
    Browse the repository at this point in the history
  40. Configuration menu
    Copy the full SHA
    94a8368 View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    5aebc64 View commit details
    Browse the repository at this point in the history
  42. macroexp: adjust yend

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    b55294f View commit details
    Browse the repository at this point in the history
  43. remove node.rtype

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    180394b View commit details
    Browse the repository at this point in the history
  44. improve ipairs error message

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    80e41bd View commit details
    Browse the repository at this point in the history
  45. Configuration menu
    Copy the full SHA
    b428197 View commit details
    Browse the repository at this point in the history
  46. refactor: flatten tuple

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    660f741 View commit details
    Browse the repository at this point in the history
  47. abstract checks for macroexp and interfaces

    Ensure is_abstract is always set for interface typetypes by
    using new_typetype constructor.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    f651782 View commit details
    Browse the repository at this point in the history
  48. fixup use macroexp

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    e3a22d8 View commit details
    Browse the repository at this point in the history
  49. refactor: reduce confusion in Type instances

    * `Type` is no longer a `{Type}` - this was being used only for
      "tuple" types; now those have an explicit `.tuple` attribute.
    * Split `Node`'s `.decltype` into three different attributes:
      `.argtype` for "argument", `.itemtype` for "table_item" and
      `.decltuple` for variable lists.
    * Add `TupleType` alias; this is not enforced as a  subtype at
      this point. It is only being used for documentation.
    * Type object constructors such as `a_function` are now stricter
      about expecting "tuple" entries. This caught a few mistakes.
    * More consistent tuple usage: function calls always return a
      "tuple" or an "invalid". Arguments and expected returns are
      always passed in as a "tuple". Special function handlers are
      adjusted accordingly.
    * Explicit assignments of `.y` and `.x` are replaced by `type_at`
      wrapper, which uses a `Where`.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    2780503 View commit details
    Browse the repository at this point in the history
  50. Configuration menu
    Copy the full SHA
    305ef38 View commit details
    Browse the repository at this point in the history
  51. visit_type: minor refactor

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    0f8311c View commit details
    Browse the repository at this point in the history
  52. Configuration menu
    Copy the full SHA
    d9117f0 View commit details
    Browse the repository at this point in the history
  53. interfaces: subtype checking

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    da234d5 View commit details
    Browse the repository at this point in the history
  54. Configuration menu
    Copy the full SHA
    f7ac7de View commit details
    Browse the repository at this point in the history
  55. Configuration menu
    Copy the full SHA
    f5ea5e5 View commit details
    Browse the repository at this point in the history
  56. Configuration menu
    Copy the full SHA
    179e669 View commit details
    Browse the repository at this point in the history
  57. wip subtype interface rework

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    9e99670 View commit details
    Browse the repository at this point in the history
  58. refactor: display_typevar

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    a357282 View commit details
    Browse the repository at this point in the history
  59. resolve_interface_type

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    2dbdefa View commit details
    Browse the repository at this point in the history
  60. Configuration menu
    Copy the full SHA
    5c0f475 View commit details
    Browse the repository at this point in the history
  61. Configuration menu
    Copy the full SHA
    7d9434a View commit details
    Browse the repository at this point in the history
  62. Configuration menu
    Copy the full SHA
    69a5393 View commit details
    Browse the repository at this point in the history
  63. Configuration menu
    Copy the full SHA
    f0ad383 View commit details
    Browse the repository at this point in the history
  64. Configuration menu
    Copy the full SHA
    45d20e9 View commit details
    Browse the repository at this point in the history
  65. minor tweaks

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    0fbb2d7 View commit details
    Browse the repository at this point in the history
  66. Configuration menu
    Copy the full SHA
    0428560 View commit details
    Browse the repository at this point in the history
  67. Configuration menu
    Copy the full SHA
    318c7b7 View commit details
    Browse the repository at this point in the history
  68. Configuration menu
    Copy the full SHA
    30650c3 View commit details
    Browse the repository at this point in the history
  69. Configuration menu
    Copy the full SHA
    b6534e5 View commit details
    Browse the repository at this point in the history
  70. Configuration menu
    Copy the full SHA
    36e8ea3 View commit details
    Browse the repository at this point in the history
  71. more efficient nominal check

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    c54a112 View commit details
    Browse the repository at this point in the history
  72. TupleType, InvalidType

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    0954829 View commit details
    Browse the repository at this point in the history
  73. simplify is_total check a bit

    The implementation of the <total> attribute remains messy,
    but at least this restrict the is_total field to actual
    records and maps (and not nominals).
    
    The <total> feature for records should go away once we have
    nilable/non-nilable fields.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    af519c6 View commit details
    Browse the repository at this point in the history
  74. Configuration menu
    Copy the full SHA
    5768abf View commit details
    Browse the repository at this point in the history
  75. Configuration menu
    Copy the full SHA
    fd02195 View commit details
    Browse the repository at this point in the history
  76. Configuration menu
    Copy the full SHA
    cc9c029 View commit details
    Browse the repository at this point in the history
  77. refactor: declname and is_alias_node

    Rename non-nominal-type use of names to declname,
    and rename Node.is_alias to Node.is_alias_node
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    f556501 View commit details
    Browse the repository at this point in the history
  78. Configuration menu
    Copy the full SHA
    9845b79 View commit details
    Browse the repository at this point in the history
  79. remove Node.is_alias_node

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    19a3a04 View commit details
    Browse the repository at this point in the history
  80. Configuration menu
    Copy the full SHA
    30739c3 View commit details
    Browse the repository at this point in the history
  81. UnresolvedType

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    94059b9 View commit details
    Browse the repository at this point in the history
  82. LiteralTableItemType

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    476573b View commit details
    Browse the repository at this point in the history
  83. Configuration menu
    Copy the full SHA
    25e667e View commit details
    Browse the repository at this point in the history
  84. TypeAliasType

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    0938c21 View commit details
    Browse the repository at this point in the history
  85. TypeDeclType

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    4293ee1 View commit details
    Browse the repository at this point in the history
  86. StringType

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    7031282 View commit details
    Browse the repository at this point in the history
  87. Configuration menu
    Copy the full SHA
    69f7a4b View commit details
    Browse the repository at this point in the history
  88. remove is_self from Type

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    55be243 View commit details
    Browse the repository at this point in the history
  89. Configuration menu
    Copy the full SHA
    b2fe2c9 View commit details
    Browse the repository at this point in the history
  90. Configuration menu
    Copy the full SHA
    fd7538f View commit details
    Browse the repository at this point in the history
  91. Configuration menu
    Copy the full SHA
    20fa3d8 View commit details
    Browse the repository at this point in the history
  92. tl: use new_env

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    59e5fe1 View commit details
    Browse the repository at this point in the history
  93. language flag: feat-arity=on/off

    Enable or disable the behavior of '?' argument annotations,
    providing backwards compatibility with existing codebases.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    94cf23c View commit details
    Browse the repository at this point in the history
  94. Configuration menu
    Copy the full SHA
    a5e1415 View commit details
    Browse the repository at this point in the history
  95. fix select signature

    fperrad authored and hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    8f8408e View commit details
    Browse the repository at this point in the history
  96. Makefile: allow testing with different interpreter values

    This will allow me to more easily run local tests with my
    hacked `lua-no-tailcalls` interpreter binary.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    93126f4 View commit details
    Browse the repository at this point in the history
  97. typecodes: drop mask entries

    See #733.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    aed4035 View commit details
    Browse the repository at this point in the history
  98. Configuration menu
    Copy the full SHA
    c17be97 View commit details
    Browse the repository at this point in the history
  99. Where: make it an interface

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    e7a1966 View commit details
    Browse the repository at this point in the history
  100. Type: remove xend and yend

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    ea7d841 View commit details
    Browse the repository at this point in the history
  101. Configuration menu
    Copy the full SHA
    cbbb8f1 View commit details
    Browse the repository at this point in the history
  102. refactor: use to_structural to resolve nominals

    ...instead of the overkill of resolve_tuple_and_nominal everywhere.
    Only resolve tuples where needed (and we're still possibly overdoing it.)
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    d79e47f View commit details
    Browse the repository at this point in the history
  103. Configuration menu
    Copy the full SHA
    4487f80 View commit details
    Browse the repository at this point in the history
  104. Configuration menu
    Copy the full SHA
    84c5b8d View commit details
    Browse the repository at this point in the history
  105. more integer in stdlib signatures

    Co-Authored-By: Hisham Muhammad <[email protected]>
    fperrad and hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    867a659 View commit details
    Browse the repository at this point in the history
  106. Configuration menu
    Copy the full SHA
    123635b View commit details
    Browse the repository at this point in the history
  107. _G: reserve a typeid

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    25f64b5 View commit details
    Browse the repository at this point in the history
  108. Configuration menu
    Copy the full SHA
    7ecb0bc View commit details
    Browse the repository at this point in the history
  109. Configuration menu
    Copy the full SHA
    946f2b7 View commit details
    Browse the repository at this point in the history
  110. Configuration menu
    Copy the full SHA
    775cc2a View commit details
    Browse the repository at this point in the history
  111. unite: removing duplicates via t.found should be enough

    This avoids resolve_nominal which needs state lookup.
    With this change, unite() should work looking at the given
    Type objects only.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    bba12c4 View commit details
    Browse the repository at this point in the history
  112. Configuration menu
    Copy the full SHA
    c2dc259 View commit details
    Browse the repository at this point in the history
  113. move module_name logic out of type_check

    it is now handled by the parts that deal with module names:
    `require` and the package loader.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    5a6fb5f View commit details
    Browse the repository at this point in the history
  114. Configuration menu
    Copy the full SHA
    52aa5f6 View commit details
    Browse the repository at this point in the history
  115. Configuration menu
    Copy the full SHA
    8793fe5 View commit details
    Browse the repository at this point in the history
  116. Configuration menu
    Copy the full SHA
    c6b0302 View commit details
    Browse the repository at this point in the history
  117. big code reorganization: TypeChecker record

    Several big changes, that were done in tandem, and which
    would be too troublesome to break into separate commits.
    The goal here is to ultimately be able to break tl.tl
    into multiple files (because its size started hitting
    limits in both Lua 5.1 (number of upvalues) and Lua 5.4
    (number of locals). Here's a high-level summary of the
    changes:
    
    * new Errors record, encapsulating error-reporting concerns;
    
    * all Type occurrences have unique objects reporting their
      locations (no more singletons for base types such as BOOLEAN
      and INVALID);
    
    * some enums renamed for more consistency across Gen and Feat
      options;
    
    * TypeCheckOptions and EnvOptions tables reorganized for
      easier forwarding of options across them;
    
    * simplifications in the various function signatures
      of the public API;
    
    * all Types and Nodes store filename, line and column
      location (`f`, `y`, `x`);
    
    * Scope is now a record containing the variables map and
      unresolved items -- no more "@unresolved" pseudo-variable
      and `unresolved` pseudo-type for storing this data in
      the symbols table;
    
    * `type_check` now uses a TypeChecker object for storing all state, instead of
      relying on closures and function nesting (that's a bit sad is it ended up
      spreading `self:` and extra function arguments everywhere, but I guess state
      management will be more explicit for others reading the code now...);
    
    * all Fact objects have a Where location as well, and supressions of
      inference data in error messages for widened-back types is marked
      explicitly with `no_infer` instead of missing a `w` field;
    
    * general simplification of the sourcing of error locations (though
      I would still like to improve that further);
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    0d3c682 View commit details
    Browse the repository at this point in the history
  118. Configuration menu
    Copy the full SHA
    4ead134 View commit details
    Browse the repository at this point in the history
  119. fix: lax arity of returns in function literals

    The unwanted difference between the types for `f` and `g` in
    the regression test from this commit was observed when fixing
    the issue #736.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    30515ef View commit details
    Browse the repository at this point in the history
  120. fix: let lax mode perform emptytable key-value inference as normal

    Do not over-constrain types with `unknown`, let `assert_is_a`
    perform the check when t2 is `unresolved_emptytable_value`.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    9701800 View commit details
    Browse the repository at this point in the history
  121. Configuration menu
    Copy the full SHA
    705b61e View commit details
    Browse the repository at this point in the history
  122. Configuration menu
    Copy the full SHA
    3fb26dc View commit details
    Browse the repository at this point in the history
  123. Configuration menu
    Copy the full SHA
    5bb3716 View commit details
    Browse the repository at this point in the history
  124. Configuration menu
    Copy the full SHA
    823a893 View commit details
    Browse the repository at this point in the history
  125. Accept __lt and __le for > and >= operators.

    As in Lua, "A comparison a > b is translated to b < a and a >= b is translated
    to b <= a."
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    da75aa2 View commit details
    Browse the repository at this point in the history
  126. Configuration menu
    Copy the full SHA
    73f104f View commit details
    Browse the repository at this point in the history
  127. fix: do not crash when comparing type defined with 'function'

    Using the plain 'function' type needs to define 'min_arity'.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    90f2a1e View commit details
    Browse the repository at this point in the history
  128. Configuration menu
    Copy the full SHA
    8d6b589 View commit details
    Browse the repository at this point in the history
  129. we can now reexport nested types

    Fixes #765.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    e85ac75 View commit details
    Browse the repository at this point in the history
  130. add the code output to the io.open function (#769)

    Updated definition for io.open function to expose the 3rd parameter containing the returning code as integer
    
    * Add the code output to the io.open function
    * generate the tl.lua
    V1K1NGbg authored and hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    15c1bff View commit details
    Browse the repository at this point in the history
  131. Configuration menu
    Copy the full SHA
    9326efd View commit details
    Browse the repository at this point in the history
  132. Configuration menu
    Copy the full SHA
    d121f2e View commit details
    Browse the repository at this point in the history
  133. Configuration menu
    Copy the full SHA
    222b8c1 View commit details
    Browse the repository at this point in the history
  134. tests: add regression test to function call check crash

    Add another regression test to a bug fixed in
    f97625d
    
    Co-Authored-By: Victor Ilchev <[email protected]>
    hishamhm and V1K1NGbg committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    a1dcf79 View commit details
    Browse the repository at this point in the history
  135. standard library: special-case tuple support for table.unpack

    Add special cases for tuples of sizes up to 5.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    3995c24 View commit details
    Browse the repository at this point in the history
  136. docs/tutorial.md: fix typo

    Co-authored-by: Darren Jennings <[email protected]>
    hishamhm and darrenjennings committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    91afcc8 View commit details
    Browse the repository at this point in the history
  137. Configuration menu
    Copy the full SHA
    d0856b5 View commit details
    Browse the repository at this point in the history
  138. local type require() accepts dot notation for nested record

    `local type MyType = require("module").MyType` is now valid.
    
    Closes #778.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    5f85333 View commit details
    Browse the repository at this point in the history
  139. fix: delay resolution of type arguments

    Ideally we need to recurse type arguments and propagate
    those. But since they are arriving in typevar_resolver
    as nominal, we're just renaming the existing typeargs
    (see `HACK` in source), and test cases. This is most
    likely wrong, hope it doesn't break anything else!
    
    Closes #777.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    448fe84 View commit details
    Browse the repository at this point in the history
  140. stricter checks for shadowing of type arguments

    Produces an error when using a base type as a type argument,
    and a warning when using another variable name. We can be
    stricter with type arguments because those exist only in
    Teal's type world. We can't be as strict with redeclarations
    in general because record types also exist as concrete Lua
    objects (example: the "string" table in the standard library).
    
    Fixes #764.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    9736418 View commit details
    Browse the repository at this point in the history
  141. Configuration menu
    Copy the full SHA
    49c2f4e View commit details
    Browse the repository at this point in the history
  142. fix: localizing a record does not make the new local a type

    This allows for a pattern where we can localize a record
    and load and alternative implementation on top of it.
    
    Fixes #759.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    ccb5081 View commit details
    Browse the repository at this point in the history
  143. Configuration menu
    Copy the full SHA
    7ae8974 View commit details
    Browse the repository at this point in the history
  144. Configuration menu
    Copy the full SHA
    877e785 View commit details
    Browse the repository at this point in the history
  145. interfaces: enforce them to be abstract

    Fixes #757.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    71cc244 View commit details
    Browse the repository at this point in the history
  146. fix: do not close nested types too early

    Closes #775.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    93c83ba View commit details
    Browse the repository at this point in the history
  147. fix: avoid crash in is check

    This makes me think if this should happen implicitly...
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    1d2dffd View commit details
    Browse the repository at this point in the history
  148. fix: string equality check

    This triggered during debugging because show_type for
    two string with the same typeid didn't match.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    06d6778 View commit details
    Browse the repository at this point in the history
  149. use unknown only in lax mode

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    8b0fe09 View commit details
    Browse the repository at this point in the history
  150. Configuration menu
    Copy the full SHA
    7cbedd2 View commit details
    Browse the repository at this point in the history
  151. Configuration menu
    Copy the full SHA
    0478bd4 View commit details
    Browse the repository at this point in the history
  152. Configuration menu
    Copy the full SHA
    f8d5665 View commit details
    Browse the repository at this point in the history
  153. Configuration menu
    Copy the full SHA
    bbe6c07 View commit details
    Browse the repository at this point in the history
  154. Configuration menu
    Copy the full SHA
    a12249f View commit details
    Browse the repository at this point in the history
  155. fix propagation of type arguments

    Fixes #777.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    f84fede View commit details
    Browse the repository at this point in the history
  156. self: introduce self type

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    4a829b0 View commit details
    Browse the repository at this point in the history
  157. self: use self type

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    b6d5d7b View commit details
    Browse the repository at this point in the history
  158. Configuration menu
    Copy the full SHA
    30e603a View commit details
    Browse the repository at this point in the history
  159. tests: add test case using self

    See #756.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    1b27f3e View commit details
    Browse the repository at this point in the history
  160. fix: self heuristic: ensure that non-nominal types are detected

    The heuristic was only comparing against nominal types; if
    a non-nominal type such as `(self: integer)` was used, it was
    silently accepted as a method and promoted to the `self` type.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    333b9e8 View commit details
    Browse the repository at this point in the history
  161. Configuration menu
    Copy the full SHA
    a4a780f View commit details
    Browse the repository at this point in the history
  162. Configuration menu
    Copy the full SHA
    8c2d4c6 View commit details
    Browse the repository at this point in the history
  163. tests: add regression test for #752.

    Thanks @svermeulen for the report!
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    ee5c8fc View commit details
    Browse the repository at this point in the history
  164. Configuration menu
    Copy the full SHA
    2ff0df4 View commit details
    Browse the repository at this point in the history
  165. Configuration menu
    Copy the full SHA
    6430aaa View commit details
    Browse the repository at this point in the history
  166. fix: tl types: never trigger ICE on bad files

    This matches the behavior of master.
    
    Can't make a simple regression test for this one because that
    would be dependent on unspecified behaviors of the parser and
    type-checker.
    
    Fixes #795.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    234ee2a View commit details
    Browse the repository at this point in the history
  167. fix: do not infer type variables as boolean in boolean contexts

    Introduces a special internal type, to be used only as the node.expected
    type in boolean contexts such as `if _ then`. It behaves exactly like
    boolean except that type variables do not infer to it.
    
    See #768.
    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    d12f534 View commit details
    Browse the repository at this point in the history
  168. Configuration menu
    Copy the full SHA
    b8b5bb8 View commit details
    Browse the repository at this point in the history
  169. Configuration menu
    Copy the full SHA
    7a6a19f View commit details
    Browse the repository at this point in the history
  170. pragma: arity on/off

    hishamhm committed Aug 31, 2024
    Configuration menu
    Copy the full SHA
    1b12d76 View commit details
    Browse the repository at this point in the history

Commits on Sep 2, 2024

  1. docs: pragmas (#798)

    Proofreading by Thijs Schreijer
    
    Co-authored-by: Thijs Schreijer <[email protected]>
    hishamhm and Tieske authored Sep 2, 2024
    Configuration menu
    Copy the full SHA
    e5ee053 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6719333 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a84ac18 View commit details
    Browse the repository at this point in the history
  4. lexer: # is an operator

    hishamhm committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    dc15bc4 View commit details
    Browse the repository at this point in the history
  5. optional arity: lax arg check in functions with feat-arity off

    This might be too lax, but it does revert back to accepting
    assignments that were valid in Teal 0.15.
    hishamhm committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    1dd8f9e View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    e49ac8b View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    d04fa0f View commit details
    Browse the repository at this point in the history
  8. lexer: simplify TokenKind

    hishamhm committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    3cc78b6 View commit details
    Browse the repository at this point in the history

Commits on Sep 3, 2024

  1. metatables: check metamethod types in metatable definition

    Add special-case behavior to specialize a type `metatable<R>` using the
    definition of `metamethod` entries from `R` (and not just a type-variable
    application of `R` into the definition of `global record metatable<T>` from
    the standard library definition.
    
    See tests in spec/declaration/metatable_spec.lua for examples of the added
    checks.
    
    Fixes #633.
    
    (At least the extent of it that can be resolved at this time,
    without explicit `nil` support -- a good explanation as to why
    the second case isn't resolved is given by @bjornbm in
    #633 (comment) :
    
    "the record definition defines what keys/values are valid, but not that they
    are defined (or more generally perhaps the values may be nil, since nil is a
    valid value of every type). What is checked is that values for the defined
    keys have the right type, and that no other keys are added to the record.
    hishamhm committed Sep 3, 2024
    Configuration menu
    Copy the full SHA
    fcdd861 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    fe86b72 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ed93fb3 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    86b01a7 View commit details
    Browse the repository at this point in the history

Commits on Sep 4, 2024

  1. Configuration menu
    Copy the full SHA
    6861032 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    311fcd1 View commit details
    Browse the repository at this point in the history
  3. parser: minor refactor

    hishamhm committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    6d6d5d4 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f5a1d51 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    73faece View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    9a89cf0 View commit details
    Browse the repository at this point in the history
  7. minor cleanup

    hishamhm committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    98044e3 View commit details
    Browse the repository at this point in the history
  8. refactor: remove TypeAliasType (unify with TypeDeclType)

    The TypeAliasType is now a case of TypeDeclType, where
    `is_alias` is true, and `def` is always a NominalType
    (asserts are sprinkled in the code to check this).
    hishamhm committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    8f89ec7 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    64de559 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    65a904e View commit details
    Browse the repository at this point in the history

Commits on Sep 5, 2024

  1. Configuration menu
    Copy the full SHA
    775ceda View commit details
    Browse the repository at this point in the history

Commits on Sep 6, 2024

  1. Configuration menu
    Copy the full SHA
    ae05702 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    34193b7 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    96baa3d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    bcaac58 View commit details
    Browse the repository at this point in the history
  5. infer_at: minor cleanup

    hishamhm committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    033681e View commit details
    Browse the repository at this point in the history

Commits on Sep 8, 2024

  1. Configuration menu
    Copy the full SHA
    373e06d View commit details
    Browse the repository at this point in the history

Commits on Sep 9, 2024

  1. refactor: ensure_not_method

    hishamhm committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    b783313 View commit details
    Browse the repository at this point in the history
  2. refactor: are_same_nominals

    hishamhm committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    cb33692 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    7a117b9 View commit details
    Browse the repository at this point in the history

Commits on Sep 10, 2024

  1. Configuration menu
    Copy the full SHA
    f157d84 View commit details
    Browse the repository at this point in the history
  2. tests: add #cli tag in spec/cli tests

    This makes it easy to skip those tests when a faster busted
    run is desired in exchange of completeness.
    hishamhm committed Sep 10, 2024
    Configuration menu
    Copy the full SHA
    9e7c645 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ece9e50 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1c3ba3d View commit details
    Browse the repository at this point in the history

Commits on Sep 18, 2024

  1. Configuration menu
    Copy the full SHA
    8f63a86 View commit details
    Browse the repository at this point in the history
  2. fix: do not infer typevars on failed poly match

    In `assert(f:read("a"))`, the return type of the failed poly match of
    `file:read` was matching the `A` typevar of `assert`. We now reset
    the temporary scope of a call typecheck fully when backtracking to
    test different poly entries (previously we were backtracking only
    the poly's own typeargs).
    hishamhm committed Sep 18, 2024
    Configuration menu
    Copy the full SHA
    f0d714e View commit details
    Browse the repository at this point in the history
  3. string.gsub: accept functions with no returns

    Note that we're doing a little hack here, but notating the
    return type as vararg, as a stand-in for something like a `?`
    in the return type. I guess we need `min_arity` calculations
    in the return types as well.
    
    Also fix the declaration of `gsub` because Lua does not accept
    functions that return booleans, but it does accept numbers.
    hishamhm committed Sep 18, 2024
    Configuration menu
    Copy the full SHA
    cfc986c View commit details
    Browse the repository at this point in the history
  4. improve inference of nested emptytables

    See #732 (comment)
    
    > There is one remaining tricky error triggering in the day12 for which I
    > already found a workaround (but which would merit a nicer solution since this
    > uncovered the fact that my empty-table inference does not backpropagate
    > correctly in the case of map[c1][c2] = true). I'll try to code a solution
    > quickly, otherwise I'll document the edge case in the testsuite and go with
    > the workaround.
    
    This is the workaround, and the documentation of the edge case is in the
    test case included in this commit.
    hishamhm committed Sep 18, 2024
    Configuration menu
    Copy the full SHA
    ccd2417 View commit details
    Browse the repository at this point in the history

Commits on Sep 19, 2024

  1. Configuration menu
    Copy the full SHA
    58ebd4b View commit details
    Browse the repository at this point in the history
  2. fix: can assign an emptytable to an emptytable

    This should also avoid inferring types as `{} | {}`.
    hishamhm committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    af5aed5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d8965fa View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b618edb View commit details
    Browse the repository at this point in the history

Commits on Sep 21, 2024

  1. types: reports record functions in record field list

    Also, strip typedecls from type report, and represent records
    in the "str" field by their declared name.
    
    Thanks @pdesaulniers for the report!
    hishamhm committed Sep 21, 2024
    Configuration menu
    Copy the full SHA
    6117c8c View commit details
    Browse the repository at this point in the history

Commits on Oct 3, 2024

  1. Configuration menu
    Copy the full SHA
    78c08f9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    74a44d3 View commit details
    Browse the repository at this point in the history

Commits on Oct 7, 2024

  1. Configuration menu
    Copy the full SHA
    d05df56 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    737a987 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ab9bf51 View commit details
    Browse the repository at this point in the history
  4. docs: macro expressions

    hishamhm committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    2c5219f View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    4fa35a4 View commit details
    Browse the repository at this point in the history
  6. docs: self type

    hishamhm committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    e289caf View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    261dacd View commit details
    Browse the repository at this point in the history