Commit Graph

1096 Commits

Author SHA1 Message Date
Epix
18a1dc3440
Fix comments on jump instructions with AUX (#808)
It seems like for jump instructions that include an AUX 32-bit word,
that index is included as part of the jump offset.
2023-02-09 06:12:58 -08:00
vegorov-rbx
c5555c6573
News about string interpolation feature and a syntax page update (#829)
News can be viewed
[here](https://vegorov-rbx.github.io/luau/2023/02/02/luau-string-interpolation.html)
And syntax can be viewed
[here](https://vegorov-rbx.github.io/luau/syntax#string-interpolation)

Note that link appears to be broken in the news section. It goes to
`https://vegorov-rbx.github.io/syntax#string-interpolation` instead of
`https://vegorov-rbx.github.io/luau/syntax#string-interpolation`
The link I use in the source is `/syntax#string-interpolation` but the
root 'offset' is different on Luau website (doesn't have extra 'luau'
folder) and on my GitHub pages.
Hope this is ok. But if GitHub page masters know how to avoid this,
please let me know.

---------

Co-authored-by: Alan Jeffrey <403333+asajeffrey@users.noreply.github.com>
Co-authored-by: Alexander McCord <11488393+alexmccord@users.noreply.github.com>
2023-02-03 11:41:13 -08:00
vegorov-rbx
62483d40f0
Sync to upstream/release/562 (#828)
* Fixed rare use-after-free in analysis during table unification

A lot of work these past months went into two new Luau components:
* A near full rewrite of the typechecker using a new deferred constraint
resolution system
* Native code generation for AoT/JiT compilation of VM bytecode into x64
(avx)/arm64 instructions

Both of these components are far from finished and we don't provide
documentation on building and using them at this point.
However, curious community members expressed interest in learning about
changes that go into these components each week, so we are now listing
them here in the 'sync' pull request descriptions.

---
New typechecker can be enabled by setting
DebugLuauDeferredConstraintResolution flag to 'true'.
It is considered unstable right now, so try it at your own risk.
Even though it already provides better type inference than the current
one in some cases, our main goal right now is to reach feature parity
with current typechecker.
Features which improve over the capabilities of the current typechecker
are marked as '(NEW)'.

Changes to new typechecker:
* Regular for loop index and parameters are now typechecked
* Invalid type annotations on local variables are ignored to improve
autocomplete
* Fixed missing autocomplete type suggestions for function arguments
* Type reduction is now performed to produce simpler types to be
presented to the user (error messages, custom LSPs)
* Internally, complex types like '((number | string) & ~(false?)) |
string' can be produced, which is just 'string | number' when simplified
* Fixed spots where support for unknown and never types was missing
* (NEW) Length operator '#' is now valid to use on top table type, this
type comes up when doing typeof(x) == "table" guards and isn't available
in current typechecker

---
Changes to native code generation:
* Additional math library fast calls are now lowered to x64: math.ldexp,
math.round, math.frexp, math.modf, math.sign and math.clamp
2023-02-03 11:26:13 -08:00
Vyacheslav Egorov
c76dd1ce9f Merge branch 'upstream' into merge 2023-02-03 14:34:42 +02:00
Vyacheslav Egorov
f49f073621 Merge branch 'master' into merge 2023-02-03 14:34:37 +02:00
Vyacheslav Egorov
dba2936823 Sync to upstream/release/562 2023-02-03 14:34:12 +02:00
Andy Friesen
f763f4c948
Sync to upstream/release/561 (#820)
* Fix a potential debugger crash by adding checks for invalid stack
index values

---------

Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
2023-01-27 14:28:31 -08:00
Andy Friesen
523db5eaca Another GCC fix. 2023-01-27 14:15:57 -08:00
Andy Friesen
b7af49c8b5 Fix signed/unsigned comparison warnings on GCC. 2023-01-27 14:04:10 -08:00
Andy Friesen
a17481baca Merge branch 'upstream' into merge 2023-01-27 13:29:29 -08:00
Andy Friesen
7c5dd3c263 Merge branch 'master' into merge 2023-01-27 13:29:24 -08:00
Andy Friesen
53d03f94f7 Sync to upstream/release/561 2023-01-27 13:28:45 -08:00
vegorov-rbx
4a2e8013c7
Sync to upstream/release/560 (#810)
* For autocomplete, additional information is included in Scope for type
alias name locations and names of imported modules
* Improved autocomplete suggestions in 'for' and 'while' loop headers
* String match functions return types are now optional strings and
numbers because match is not guaranteed at runtime
* Fixed build issue on gcc 11 and up (Fixes
https://github.com/Roblox/luau/issues/806)
2023-01-20 12:27:03 -08:00
Vyacheslav Egorov
b0b7dfb714 Fix a few style changes that went out-of-sync 2023-01-20 14:18:59 +02:00
Vyacheslav Egorov
7a43ae3b37 Merge branch 'upstream' into merge 2023-01-20 14:16:10 +02:00
Vyacheslav Egorov
652f31958d Merge branch 'master' into merge 2023-01-20 14:03:22 +02:00
Vyacheslav Egorov
eec289ad1b Sync to upstream/release/560 2023-01-20 14:02:39 +02:00
Harold Cindy
729bc44729
Fix lua_*upvalue() when upvalue names aren't in debug info (#787)
`lua_getupvalue()` and `lua_setupvalue()` don't behave as expected when
working with Lua closure whose `Proto` has no debug info. The code
currently uses `sizeupvalues` to do bounds checking of upvalue indices,
but that's the size of the upvalue _names_ array. It will always be `0`
if the `Proto` doesn't have debug info.

This uses `nups` instead, and just returns `""` as the upvalue name if
we don't have one, same as for C closures.

Co-authored-by: Harold Cindy <HaroldCindy@users.noreply.github.com>
2023-01-18 06:00:13 -08:00
Andy Friesen
a5c6a38b10
Sync to upstream/release/559 (#804)
* Fix autocompletion of if-then-else expressions
* Fix a potential crash surrounding improper use of `%*` in a string
format specifier
* All Python scripts now invoke Python via `python3` rather than
`python`.
* Improved error handling for string interpolation with too many
arguments.

Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
2023-01-13 14:10:01 -08:00
Andy Friesen
efaf15ef7c Merge branch 'upstream' into merge 2023-01-13 12:38:14 -08:00
Andy Friesen
b1000a6889 Merge branch 'master' into merge 2023-01-13 12:38:09 -08:00
Andy Friesen
96c1cafff2 Sync to upstream/release/559 2023-01-13 12:36:28 -08:00
JohnnyMorganz
0af10417cd
Attach definition location to TableType (#801)
Having the location where the table type is defined is useful for
tracking other info such as documentation comments, or pointing back
through "Go To Definition" functionality etc.

This adds in the required info
2023-01-12 06:21:25 -08:00
JohnnyMorganz
86494918f5
Pass string content to autocomplete callback (#800)
Closes #718 

We pass an extra `contents` parameter to the string callback function to
provide contextual information for autocomplete.

Because we support both string literals and simple interpolated strings,
we pass it through as a `std::string` value.

This is a breaking change
2023-01-11 08:28:11 -08:00
vegorov-rbx
be52bd91e4
Sync to upstream/release/558 (#796)
* Fixed garbage data in module scopes when type graph is not retained
* LOP_MOVE with the same source and target registers is no longer
generated (Fixes https://github.com/Roblox/luau/issues/793)
2023-01-06 13:14:35 -08:00
vegorov-rbx
685ca02a30
Keep using ubuntu-20.04 in GitHub Actions (and clang++-10 in coverage) (#795)
### Problem
ubuntu-latest was updated to 22.04 which removes clang++-10 we used for
coverage stats and creates a pre-compiled binary that requires a glibc
upgrade https://github.com/Roblox/luau/issues/773

### Solution
Pin to ubuntu-20.04 using multi-value matrix configurations.
In coverage configuration, we use clang++-10 once again.
2023-01-06 12:17:25 -08:00
Vyacheslav Egorov
a2365f2adf Fix build warning 2023-01-06 18:31:52 +02:00
Vyacheslav Egorov
5db9675537 Smaller recursion limit to not hit stack overflow in debug on Windows 2023-01-06 18:30:05 +02:00
Vyacheslav Egorov
cf45ce6960 Merge branch 'upstream' into merge 2023-01-06 18:10:33 +02:00
Vyacheslav Egorov
5e3fbc4ba1 Merge branch 'master' into merge 2023-01-06 18:10:31 +02:00
Vyacheslav Egorov
36f5009026 Sync to upstream/release/558 2023-01-06 18:07:19 +02:00
vegorov-rbx
75a2e95714
Sync to upstream/release/557 (#794)
* Fixed unions of `nil` types displaying as `?`
* Internal normalization now handles class types which can make
previously failing (incorrectly) sub-typing checks to succeed
2023-01-04 12:53:17 -08:00
Vyacheslav Egorov
1958676f29 Re-using uncleared normalizer in unsafe 2023-01-04 14:45:18 +02:00
Vyacheslav Egorov
ee364a33b4 Fixed iterator invalidation issue 2023-01-04 00:31:14 +02:00
Vyacheslav Egorov
c48b4d7228 Merge branch 'upstream' into merge 2023-01-03 19:49:36 +02:00
Vyacheslav Egorov
11e129ff00 Merge branch 'master' into merge 2023-01-03 19:49:30 +02:00
Vyacheslav Egorov
9958d23caa Sync to upstream/release/557 2023-01-03 19:33:19 +02:00
Andy Friesen
fb2f146123
Sync to upstream/release/556 (#782)
* The AST JSON encoder will now stringify infinity and NaN according to the JSON5 spec using the tokens `Infinity`, `-Infinity`, and `NaN`.
* Improve autocompletion of table keys if the type of that key is a union of string singletons.
2022-12-09 11:57:01 -08:00
Andy Friesen
1197bcd5c7 Merge branch 'upstream' into merge 2022-12-09 10:08:20 -08:00
Andy Friesen
4ba102f304 Merge branch 'master' into merge 2022-12-09 10:08:16 -08:00
Andy Friesen
abe6768a1d Sync to upstream/release/556 2022-12-09 10:07:25 -08:00
Alex Orlenko
e9d4ee7a33
Make pseudo-indices relative to LUAI_MAXCSTACK (#766)
This is useful in particular if redefine `LUAI_MAXCSTACK` to a higher
value than the current one (8000).
Ie. passing `-D LUAI_MAXCSTACK=1000000` would not work as overlaps with
`LUA_REGISTRYINDEX` and below.
2022-12-06 11:20:24 -08:00
vegorov-rbx
4e6ae32625
Luau Recap: November 2022 (#764)
Co-authored-by: Andy Friesen <andy.friesen@gmail.com>
2022-12-02 10:23:20 -08:00
vegorov-rbx
59ae47db43
Sync to upstream/release/555 (#768)
* Type mismatch errors now mention if unification failed in covariant or
invariant context, to explain why sometimes derived class can't be
converted to base class or why `T` can't be converted into `T?` and so
on
* Class type indexing is no longer an error in non-strict mode (still an
error in strict mode)
* Fixed cyclic type packs not being displayed in the type
* Added an error when unrelated types are compared with `==`/`~=`
* Fixed false positive errors involving sub-type tests an `never` type
* Fixed miscompilation of multiple assignment statements (Fixes
https://github.com/Roblox/luau/issues/754)
* Type inference stability improvements
2022-12-02 10:09:59 -08:00
vegorov-rbx
91302d1d4c
Fix coverage github action by using clang++ without a specific version (#769)
Github fails to find clang++-10.
Since we install llvm without a specific version number, we shouldn't
use clang++-10 with a version number.

I tried installing llvm-10, but that package is not available on github
(any more?).
2022-12-02 10:08:55 -08:00
Vyacheslav Egorov
6cd507dff0 Work-around for gcc 2022-12-02 18:22:01 +02:00
Vyacheslav Egorov
f10b294d62 What even is this 2022-12-02 15:46:09 +02:00
Vyacheslav Egorov
621d21d4c2 Merge branch 'upstream' into merge 2022-12-02 12:58:55 +02:00
Vyacheslav Egorov
471ec75a60 Merge branch 'master' into merge 2022-12-02 12:56:19 +02:00
Vyacheslav Egorov
fc459699da Sync to upstream/release/555 2022-12-02 12:46:05 +02:00