Commit Graph

724 Commits

Author SHA1 Message Date
Aaron Weiss bdf7d8c185
RFC: Expanded Subtyping for Generic Function Types (#641)
[Rendered](https://github.com/aatxe/luau/blob/generic-function-subtyping/rfcs/generic-function-subtyping.md)
2022-09-19 13:42:20 -07:00
Arseny Kapoulkine 8b36409c2c
Update build.yml (#675)
Pass codecov token explicitly, for some reason automatic configuration
stopped working
2022-09-16 11:39:30 -07:00
Arseny Kapoulkine 3d74a8f4d4
Sync to upstream/release/545 (#674)
- Improve type error messages for argument count mismatch in certain
cases
- Fix type checking variadic returns when the type is incompatible which
type checked in certain cases
- Reduce size of upvalue objects by 8 bytes on 64-bit platforms
- Reduce I$ footprint of interpreter by 1.5KB
- Reduce GC pause during atomic stage for programs with a lot of threads
- Remove support for bytecode v2
2022-09-15 15:38:17 -07:00
Petri Häkkinen 6fbea7cc84
Add lua_rawsetfield (#671)
Luau currently has the following functions in the C API for dealing with
tables without invoking metamethods:

lua_rawgetfield
lua_rawget
lua_rawgeti
lua_rawset
lua_rawseti

This change adds the missing function lua_rawsetfield for consistency
and because it's more efficient to use it in place of plain lua_rawset
which requires pushing the key and value separately.

Co-authored-by: Petri Häkkinen <petrih@rmd.remedy.fi>
2022-09-15 08:26:54 -07:00
Allan N Jeremy 366df96393
Feat: Added retry functionality to benchmarks (#667)
Resolves #668 

## The problem
Benchmarks jobs run concurrently for the different operating systems.
This means that when it comes time to push the benchmark results to [the
assigned benchmark results
repo](https://github.com/luau-lang/benchmark-data), there can be two
different jobs trying to push changes at the same time. In such a case,
one of the pushes will fail and we end up missing some benchmark results
data from the workflow run.

## The solution
Whenever a push fails, we need to retry the steps leading up to the push
(checking out the benchmark results repo, storing benchmark results,
pushing the results to [a specific
repo](https://github.com/luau-lang/benchmark-data)).

### Note
There are 3 push attempts before submitting to failure.

## TL;DR
This PR retries pushing benchmark results when they fail to get pushed
(often due to pushing from multiple jobs concurrently)

Co-authored-by: Jamie Kuppens <reshurum@gmail.com>
Co-authored-by: Ignacio Falk <flakolefluk@gmail.com>
2022-09-12 08:45:55 -07:00
Arseny Kapoulkine ce2c3b3a4e
Sync to upstream/release/544 (#669)
- Remove type definitions of
`utf8.nfcnormalize`/`nfdnormalize`/`graphemes` that aren't supported by
standalone Luau library
- Add `lua_costatus` to retrieve extended thread status (similar to
`coroutine.status`)
- Improve GC sweeping performance (2-10% improvement on allocation-heavy
benchmarks)
2022-09-08 15:14:25 -07:00
Alexander McCord b2e357da30
Update title and fix a dead link. (#659)
Originally it was titled "Luau Recap: August 2022" but it got renamed to "Luau Recap: July & August 2022" and we just didn't fix the link here too. Also backports the title change to here too for consistency.
2022-09-04 13:05:25 -07:00
Arseny Kapoulkine ae35ada579
Sync to upstream/release/543 (#657)
- Improve ComparisonPrecedence lint suggestions for three-way comparisons (X < Y < Z)
- Improve type checking stability
- Improve location information for errors when parsing invalid type annotations
- Compiler now generates bytecode version 3 in all configurations
- Improve performance of comparisons against numeric constants on AArch64
2022-09-01 16:14:03 -07:00
Alexander McCord 42c24f98d9
July and August recap (#654)
Co-authored-by: vegorov-rbx <75688451+vegorov-rbx@users.noreply.github.com>
Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
2022-08-31 10:46:06 -07:00
JohnnyMorganz e9e2cba77a
Fix overloaded metamethod in class definitions (#653)
Fixes #652
2022-08-29 08:28:04 -07:00
Arseny Kapoulkine f2b334a4bb Merge branch 'merge' to resynchronize merge tracking history 2022-08-26 12:56:52 -07:00
Arseny Kapoulkine e84bccc5c0
RFC: Prohibit use of interpolated strings in function calls without parentheses (#648)
We've had this restriction in the original RFC, but decided to remove it afterwards. This change puts the restriction back - we need to work through some implications of future support for string-based DSLs together with interpolated strings which may or may not change the behavior here, for example to allow something like

```
local fragment = xml `
  <img src="{self.url}" />
`
```
2022-08-25 14:54:02 -07:00
Arseny Kapoulkine b2f9f53ae3
Sync to upstream/release/542 (#649)
- Fix DeprecatedGlobal warning text in cases when the global is deprecated without a suggested alternative
- Fix an off-by-one error in type error text for incorrect use of string.format
- Reduce stack consumption further during parsing, hopefully eliminating stack overflows during parsing/compilation for good
- Mark interpolated string support as experimental (requires --fflags=LuauInterpolatedStringBaseSupport to enable)
- Simplify garbage collection treatment of upvalues, reducing cache misses during sweeping stage and reducing the cost of upvalue assignment (SETUPVAL); supersedes #643
- Simplify garbage collection treatment of sleeping threads
- Simplify sweeping of alive threads, reducing cache misses during sweeping stage
- Simplify management of string buffers, removing redundant linked list operations
2022-08-25 14:53:50 -07:00
Arseny Kapoulkine 5eb4fb6089 Fix gcc warning 2022-08-25 14:10:12 -07:00
Arseny Kapoulkine 9aa4677829 Merge branch 'upstream' into merge 2022-08-25 13:57:52 -07:00
Arseny Kapoulkine c8adbf2375 Merge branch 'master' into merge 2022-08-25 13:57:43 -07:00
Arseny Kapoulkine 3008da98df Sync to upstream/release/542 2022-08-25 13:55:08 -07:00
boyned//Kampfkarren da9d8e8c60
String interpolation (#614)
Implements the string interpolation RFC (#165).

Adds the string interpolation as per the RFC.

```lua
local name = "world"
print(`Hello {name}!`) -- Hello world!
```

Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
Co-authored-by: Alexander McCord <11488393+alexmccord@users.noreply.github.com>
2022-08-24 12:01:00 -07:00
Alexander McCord 0ce4c45436
RFC: Explicitly support escape sequence in string interpolation literals (#642)
This was implicitly assumed to be supported, but we should really just say so explicitly. If we didn't, there'd be two ways to interpret it: string interpolations are raw strings and escape sequences don't exist for the most part (false), or string interpolations are like strings and escape sequences do exist (true).

Also talks about the ambiguity with `\u{` and that it is defined to take priority and does not terminate the interpolation chunk and starts a new expression, instead it must be a well-formed escape sequence `\u{...}`. It is very unlikely there'd be another escape sequence that also has this same ambiguity problem, so we don't need to worry about this.
2022-08-23 12:03:53 -07:00
JohnnyMorganz a95dff3223
Pass environment scope to autocomplete typechecker (#610)
Fixes a bug where the environment scope is not passed to the autocomplete typechecker, so environment-related types are not provided.

This caused an issue where `getModuleEnvironment` returns `typeChecker.globalScope` when there is no environment. We pass this through to `typeCheckerForAutocomplete.check()` then environmentscope is no longer nullopt and it will use `typeChecker.globalScope` instead of falling back to `typeCheckerForAutocomplete.globalScope`.

This is solved by passing `forAutocomplete` to `getModuleEnvironment` so it falls back to the autocomplete global scope if none found.
2022-08-23 11:53:02 -07:00
Arseny Kapoulkine be2769ad14
Sync to upstream/release/541 (#644)
- Fix autocomplete not suggesting globals defined after the cursor (fixes #622)
- Improve type checker stability
- Reduce parser C stack consumption which fixes some stack overflow crashes on deeply nested sources
- Improve performance of bit32.extract/replace when width is implied (~3% faster chess)
- Improve performance of bit32.extract when field/width are constants (~10% faster base64)
- Heap dump now annotates thread stacks with local variable/function names
2022-08-18 14:32:08 -07:00
Arseny Kapoulkine fcccf1e7d1 Merge branch 'upstream' into merge 2022-08-18 14:07:38 -07:00
Arseny Kapoulkine d614f43ebe Merge branch 'master' into merge 2022-08-18 14:06:14 -07:00
Arseny Kapoulkine b3e6dcecfd Sync to upstream/release/541 2022-08-18 14:04:33 -07:00
Arseny Kapoulkine 0e118b54bb
Update generalized-iteration.md (#640)
Use a more precise pseudocode snippet for __iter handling which matches runtime semantics
2022-08-17 10:02:08 -07:00
XmiliaH 4ded555cc5
Prevent overflow in lua_newuserdatadtor (#639)
In case a large userdata size is passed to lua_newuserdatadtor it might overflow the size resulting in luaU_newudata actually allocating the object without a memory error. This will then result in overwriting part of the metatable pointer of the userdata.
This PR fixes this issue by checking for the overflow and in such cases pass a size value which will cause a memory error in luaU_newudata.
2022-08-16 15:32:48 -07:00
Arseny Kapoulkine cd26f88d56
Update compatibility.md
Add NaN keys from Lua 5.2
2022-08-12 09:10:42 -07:00
Mactavsin b7d126bf99
Fix lint.md formatting (#637)
This pull requests fixes a mistake in lint.md file that causes incorrect formatting of the text:
2022-08-12 07:14:38 -07:00
Arseny Kapoulkine 8b390a33aa
Update benchmark.yml
Switch to bench.json file so that bench-gcc is the only outlier, as everything else is built with clang.
2022-08-11 14:14:32 -07:00
Arseny Kapoulkine f7d8ad0774
Sync to upstream/release/540 (#635)
Also adjust benchmark runs to use config=profile and run clang for all benchmarks + gcc for runtime
2022-08-11 14:01:33 -07:00
Arseny Kapoulkine f1928ddade Adjust benchmark runs to use config=profile and new file names 2022-08-11 13:48:35 -07:00
Arseny Kapoulkine 39bcf23cd6 Merge branch 'upstream' into merge 2022-08-11 13:44:03 -07:00
Arseny Kapoulkine f21ba5d2f2 Merge branch 'master' into merge 2022-08-11 13:43:34 -07:00
Arseny Kapoulkine 106b269885 Sync to upstream/release/540 2022-08-11 13:42:54 -07:00
Arseny Kapoulkine 2c40b7661c
Update lint.md (#634)
Add documentation for IntegerParsing and ComparisonPrecedence lints
2022-08-11 08:42:31 -07:00
JohnnyMorganz e15b0728be
Add autocomplete context to result (#611)
Closes #599 

Not sure if these context definitions are distinct enough, but they work for my use cases.

I repurposed (a majority of) the existing unit tests for this, but if it should live in separate test cases let me know

---
* Add autocomplete context to result

* Update tests

* Remove comments

* Fix expression context issues
2022-08-10 13:04:08 -07:00
Arseny Kapoulkine 1b20fcd43c
Sync to upstream/release/539 (#625) 2022-08-04 15:35:33 -07:00
Arseny Kapoulkine 6d6fd12fee Let's try this 2022-08-04 15:07:49 -07:00
Arseny Kapoulkine 5522631be4 Merge branch 'upstream' into merge 2022-08-04 14:30:15 -07:00
Arseny Kapoulkine 33190f84ae Merge branch 'master' into merge 2022-08-04 14:27:40 -07:00
Arseny Kapoulkine 4a9cfd57a6 Sync to upstream/release/539 2022-08-04 14:27:28 -07:00
boyned//Kampfkarren 4658219df2
Add %* format specifier (#619)
RFC: https://github.com/Roblox/luau/pull/165
2022-08-04 07:22:16 -07:00
Arseny Kapoulkine 2c12badb5c
Update RFC status page 2022-08-03 15:40:57 -07:00
Arseny Kapoulkine 4692c55687
Mark never/unknown types RFC as implemented 2022-08-03 15:40:24 -07:00
Arseny Kapoulkine b39fcc7e77
Mark __len RFC as implemented 2022-08-03 15:38:45 -07:00
Jay Kruer b204981aca
Add Ctrl-C handling to the REPL (#537)
Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
2022-08-02 09:32:22 -07:00
Arseny Kapoulkine d3b566c258
Sync to upstream/release/538 (#616) 2022-07-28 21:24:07 -07:00
Arseny Kapoulkine cdcd6fcbdb Merge branch 'upstream' into merge 2022-07-28 20:46:02 -07:00
Arseny Kapoulkine efcaf05010 Merge branch 'master' into merge 2022-07-28 20:45:57 -07:00
Arseny Kapoulkine 3202869acc Sync to upstream/release/538 2022-07-28 20:41:13 -07:00
Alexander McCord cb16555608
RFC: Disallow `name T` and `name(T)` in future syntactic extensions for type annotations (#589) 2022-07-28 14:48:17 -07:00
Alexander McCord 185370fa1d
RFC: Update the rules on string interpolation in light of feedback (#615)
We make four adjustments in this RFC:

1. `{{` is not allowed. This is likely a valid but poor attempt at escaping coming from C#, Rust, or Python.
2. We now allow `` `this` `` with zero interpolating expressions.
3. We now allow `` f `this` `` also.
4. Explicitly say that `` `this` `` and `` `this {that}` `` are not valid type annotation syntax.
2022-07-28 14:48:05 -07:00
JohnnyMorganz 2a6d1c03ac
Store AstExprFunction in astTypes for stats (#612) 2022-07-25 10:19:21 -07:00
Arseny Kapoulkine 12c5502027
Update performance.md
Update compiler performance metrics to account for O2 and expanding internal codebase
2022-07-22 10:35:03 -07:00
Arseny Kapoulkine 9be7f85be7
Update performance.md (#608)
Mention constant folding for builtins and remove the note about possibly doing inlining in the future because we do do it now!
2022-07-22 07:53:16 -07:00
Arseny Kapoulkine b1cfaf5305
Sync to upstream/release/537 (#607) 2022-07-21 14:16:54 -07:00
Arseny Kapoulkine 2c0be898a1 Merge branch 'upstream' into merge 2022-07-21 13:37:02 -07:00
Arseny Kapoulkine 8f7a1c701b Merge branch 'master' into merge 2022-07-21 13:36:59 -07:00
Arseny Kapoulkine 8e8ae0a01d Sync to upstream/release/537 2022-07-21 13:36:41 -07:00
Arseny Kapoulkine a824b05c9e
Update coverage report to codecov (#606)
Coveralls has had multiple stability issues in the recent while, and codecov seems much better maintained in general.
2022-07-20 15:12:30 -07:00
Arseny Kapoulkine ea7a6c1260
Spell out RFC considerations for library functions more explicitly (#603)
When considering new standard library functions, we essentially need to strongly justify their existence over their implementation in Luau in user library code.

This PR attempts to provide a few axes of consideration; ideally new library functions tick many of the boxes, eg "used often + is more performant + clear unambiguous interface" is an ideal consideration for a library function, whereas if it's merely accelerating a single specific use case for a single application it's unlikely to be a good justification for inclusion.
2022-07-19 08:37:56 -07:00
Matthew Emery 96316c66dc
Documentation of round tie-breaking (#602)
* Update library.md

* Tie-breaking documentation for round
2022-07-18 12:36:23 -07:00
Arseny Kapoulkine 5b2e39c922
Sync to upstream/release/536 (#592) 2022-07-14 15:52:26 -07:00
Arseny Kapoulkine 092e70115e Merge branch 'master' into merge 2022-07-14 15:40:07 -07:00
Arseny Kapoulkine c321668dbc Merge branch 'upstream' into merge 2022-07-14 15:40:05 -07:00
Arseny Kapoulkine 4bd651292d Sync to upstream/release/536 2022-07-14 15:39:35 -07:00
Alex Orlenko e87009f5b2
Add lua_setuserdatatag to update userdata tags (#588) 2022-07-14 12:00:37 -07:00
Andy Friesen a934f742d8
June recap (#583) 2022-07-11 13:21:23 -07:00
Anaminus 6ad8239e32
Improve description of bit32.extract/replace. (#585)
Fix description incorrectly saying that parameter w specifies an upper range. w is actually a width. Proof:

    print(bit32.extract(2^32-1, 3, 4)) -- prints 15, not 1.

Also indicate that the position is 0-based, and that the function will error if the selected range exceeds the allowed bounds.
2022-07-08 10:06:25 -07:00
Arseny Kapoulkine 120a7fab70 Merge branch 'merge' 2022-07-07 18:22:50 -07:00
Arseny Kapoulkine 506d971421
Sync to upstream/release/535 (#584) 2022-07-07 18:22:39 -07:00
Arseny Kapoulkine 42244b14df Merge branch 'upstream' into merge 2022-07-07 18:08:06 -07:00
Arseny Kapoulkine f9e76fc75c Merge branch 'master' into merge 2022-07-07 18:07:30 -07:00
Arseny Kapoulkine 4a95f2201e Sync to upstream/release/535 2022-07-07 18:05:31 -07:00
Allan N Jeremy dbcd5fb28e
build: changed data output to be different for each os (#581)
- macos: data-macos-latest.json
- ubuntu: data-ubuntu-latest.json
- windows: data-windows-latest.json
2022-07-07 08:21:40 -07:00
Alan Jeffrey a7ae439b0f
Document new table type features (#567) 2022-07-05 16:25:09 -05:00
Arseny Kapoulkine 42510bb5c8
Fix test after merging a stale PR (#577) 2022-07-05 11:36:33 -07:00
JohnnyMorganz baa35117bd
Use syntheticName for stringified MetatableTypeVar (#563) 2022-07-05 09:19:54 -07:00
JohnnyMorganz 4d98a16ea8
Store resolved types in `astResolvedTypes` (#574) 2022-07-05 09:08:05 -07:00
JohnnyMorganz 6303ae30c4
Fix op used when stringifying AstExprIndexName (#572)
* Fix op used when stringifying AstExprIndexName

* Remove visualizeWithSelf
2022-07-05 08:59:09 -07:00
Arseny Kapoulkine 2460e38998
bench: Implement luau-analyze and luau --compile benchmarks (#575)
This change adds another file for benchmarking luau-analyze and sets up
benchmarks for both non-strict/strict modes for analysis and all three
optimization levels for compilation performance.

To avoid issues with race conditions on repository update we do all this
in the same job in benchmark.yml.

To be able to benchmark both modes from a single file, luau-analyze
gains --mode argument which allows to override the default typechecking
mode. Not sure if we'll want this to be a hard override on top of the
module-specified mode in the future, but this works for now.
2022-07-05 08:23:09 -07:00
Arseny Kapoulkine 48aa7a5162
bench: Implement first class support for callgrind (#570)
Since callgrind allows to control stats collection from the guest, this
allows us to reset the collection right before the benchmark starts.

This change exposes this to the benchmark runner and integrates
callgrind data parsing into bench.py, so that we can run bench.py with
--callgrind argument and, as long as the runner was built with callgrind
support, we get instruction counts from the run.

We convert instruction counts to seconds using 10G instructions/second
rate; there's no correct way to do this without simulating the full CPU
pipeline but it results in time units on a similar scale to real runs.
2022-07-04 11:13:07 -07:00
Arseny Kapoulkine 6467c855e8
Update compatibility.md (#566)
Update `__len` metamethod (pending the code change that implements this)
2022-06-30 17:07:56 -07:00
Arseny Kapoulkine 2daa6497a1
Sync to upstream/release/534 (#569) 2022-06-30 16:52:43 -07:00
Arseny Kapoulkine 065f2dac40 Merge branch 'upstream' into merge 2022-06-30 16:30:01 -07:00
Arseny Kapoulkine 3f716ea007 Merge branch 'master' into merge 2022-06-30 16:29:59 -07:00
Arseny Kapoulkine 8f040862b1 Sync to upstream/release/534 2022-06-30 16:29:02 -07:00
natteko fc763650d3
Fix broken link in typecheck.md (#568)
Current link redirects to 
https://luau-lang.org/typecheck#Roblox-types (notice the fragment) 
which is effectively the same as https://luau-lang.org/typecheck
What the link *wants* to redirect to is 
https://luau-lang.org/typecheck#roblox-types (notice the change in fragment) 
which is the Roblox types segment of the document
2022-06-30 15:14:49 -07:00
Arseny Kapoulkine ee82f1e997
Update sandbox.md
Since we don't have a formal proof, clarify that we don't have known bugs.
2022-06-28 23:13:13 -07:00
Arseny Kapoulkine c29b803046
Update STATUS.md
Add __len metamethod
2022-06-28 09:08:12 -07:00
Arseny Kapoulkine fd82e92628
RFC: Support `__len` metamethod for tables and `rawlen` function (#536) 2022-06-28 09:06:59 -07:00
Arseny Kapoulkine 13e50a9cac
Update library.md (#564)
Clarify behavior of shifts for out of range values.
2022-06-27 09:05:50 -07:00
Arseny Kapoulkine 4cd0443913
Update benchmark.yml
Cleaner names
2022-06-24 18:30:26 -07:00
Arseny Kapoulkine 9846a6c7b9
Update benchmark.yml
Remove all alert/comment functionality
2022-06-24 18:26:15 -07:00
Arseny Kapoulkine 224d35bc9e
Update benchmark.yml
Attempt to fix Windows and other builds
2022-06-24 18:16:12 -07:00
Allan N Jeremy 5e405b58b3
Added multi-os runners for benchmark & implemented luau analyze (#542) 2022-06-24 09:46:29 -07:00
Arseny Kapoulkine e91d80ee25
Update compatibility.md (#559) 2022-06-23 18:56:19 -07:00
Arseny Kapoulkine 08ab7da4db
Sync to upstream/release/533 (#560) 2022-06-23 18:56:00 -07:00
Arseny Kapoulkine 4bf3ace2a6 Merge branch 'upstream' into merge 2022-06-23 18:45:15 -07:00
Arseny Kapoulkine 8544ca2c54 Merge branch 'master' into merge 2022-06-23 18:45:13 -07:00