Commit Graph

1279 Commits

Author SHA1 Message Date
Vighnesh
68b9214b03 push same change to shared code allocator 2024-10-11 14:51:28 -07:00
Vighnesh
a197f044b5 i messed up the macro syntax again 2024-10-11 14:49:34 -07:00
Vighnesh
ef95ce5266 newline 2024-10-11 14:40:12 -07:00
Vighnesh
39899ade4f macro out the failing tests 2024-10-11 14:33:15 -07:00
Vighnesh-V
34801b9310
Delete tests/.#TypeVar.test.cpp 2024-10-11 14:17:53 -07:00
Vighnesh
70d5a0ede8 newline 2024-10-11 14:16:41 -07:00
Vighnesh
74c1ac33a9 nit - insert new lines 2024-10-11 13:53:08 -07:00
Vighnesh
ee6a45b13b more macro madness 2024-10-11 13:46:54 -07:00
Vighnesh
69776f6fc1 re-add assertion 2024-10-11 13:39:14 -07:00
Vighnesh
f52fe9f351 nit - remove shared code allocator test section that tests self move 2024-10-11 13:22:20 -07:00
Vighnesh
a02bee5acc update -Wmaybe-uninitialized 2024-10-11 13:09:26 -07:00
Vighnesh
5bb24aa888 nit: turn int osize, nsize into size_t 2024-10-11 13:01:31 -07:00
Vighnesh
38d76e658d disable maybe uninitialized error 2024-10-11 12:56:47 -07:00
Vighnesh
0e1504fa52 try a different syntax for disabling warnings 2024-10-11 12:13:24 -07:00
Vighnesh
afa4fa601e try to disable self-move warning 2024-10-11 12:04:28 -07:00
Vighnesh
912798e5c7 Merge branch 'upstream' into merge 2024-10-11 10:05:43 -07:00
Vighnesh
40a054abe8 Merge branch 'master' into merge 2024-10-11 10:02:42 -07:00
Vighnesh
aa2e5c096d Sync to upstream/release/647 2024-10-11 09:38:27 -07:00
Micah
4559ef26b2
Support function attributes in luau-ast (#1466)
Some checks failed
benchmark / callgrind (map[branch:main name:luau-lang/benchmark-data], ubuntu-22.04) (push) Has been cancelled
build / ${{matrix.os.name}} (map[name:macos version:macos-latest]) (push) Has been cancelled
build / ${{matrix.os.name}} (map[name:macos-arm version:macos-14]) (push) Has been cancelled
build / ${{matrix.os.name}} (map[name:ubuntu version:ubuntu-latest]) (push) Has been cancelled
build / windows (Win32) (push) Has been cancelled
build / windows (x64) (push) Has been cancelled
build / coverage (push) Has been cancelled
build / web (push) Has been cancelled
release / ${{matrix.os.name}} (map[name:macos version:macos-latest]) (push) Has been cancelled
release / ${{matrix.os.name}} (map[name:ubuntu version:ubuntu-20.04]) (push) Has been cancelled
release / ${{matrix.os.name}} (map[name:windows version:windows-latest]) (push) Has been cancelled
release / web (push) Has been cancelled
Noticed while using luau-ast that function attributes aren't included in
the output. This PR corrects that.
---------

Co-authored-by: vegorov-rbx <75688451+vegorov-rbx@users.noreply.github.com>
2024-10-08 06:57:41 -07:00
Micah
ae7b07d60f
Rename type field of AstStatTypeAlias in JSON Encoder (#1461)
Some checks failed
benchmark / callgrind (map[branch:main name:luau-lang/benchmark-data], ubuntu-22.04) (push) Has been cancelled
build / ${{matrix.os.name}} (map[name:macos version:macos-latest]) (push) Has been cancelled
build / ${{matrix.os.name}} (map[name:macos-arm version:macos-14]) (push) Has been cancelled
build / ${{matrix.os.name}} (map[name:ubuntu version:ubuntu-latest]) (push) Has been cancelled
build / windows (Win32) (push) Has been cancelled
build / windows (x64) (push) Has been cancelled
build / coverage (push) Has been cancelled
build / web (push) Has been cancelled
release / ${{matrix.os.name}} (map[name:macos version:macos-latest]) (push) Has been cancelled
release / ${{matrix.os.name}} (map[name:ubuntu version:ubuntu-20.04]) (push) Has been cancelled
release / ${{matrix.os.name}} (map[name:windows version:windows-latest]) (push) Has been cancelled
release / web (push) Has been cancelled
Closes #1460.

This renames the `type` field of `AstStatTypeAlias` to `value` during
the JSON encoding process.

I've chosen to just rename the field in the JSON encoder rather than
rename the actual field since it's a lot further reaching. Another
option would have been to rename what the actual type of an AST node is
written to be something like `tokenType` instead of `type`, but that's a
bigger diff and technically breaking (as opposed to this one which
isn't!)
2024-10-04 16:00:25 -07:00
Andy Friesen
543de6e939
Sync to upstream/release/646 (#1458)
# General Updates

* Fix some cases where documentation symbols would not be available when
mouseovering at certain positions in the code
* Scaffolding to help embedders have more control over how `typeof(x)`
refines types
* Refinements to require-by-string semantics. See
https://github.com/luau-lang/rfcs/pull/56 for details.
* Fix for https://github.com/luau-lang/luau/issues/1405

# New Solver

* Fix many crashes (thanks you for your bug reports!)
* Type functions can now call each other
* Type functions all evaluate in a single VM. This should improve
typechecking performance and reduce memory use.
* `export type function` is now forbidden and fails with a clear error
message
* Type functions that access locals in the surrounding environment are
now properly a parse error
* You can now use `:setindexer(types.never, types.never)` to delete an
indexer from a table type.

# Internal Contributors

Co-authored-by: Aaron Weiss <aaronweiss@roblox.com>
Co-authored-by: Hunter Goldstein <hgoldstein@roblox.com>
Co-authored-by: Varun Saini <vsaini@roblox.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
2024-10-04 11:29:55 -07:00
Andy Friesen
aabaf01484 Merge branch 'upstream' into merge 2024-10-04 09:46:59 -07:00
Andy Friesen
469ba7712f Merge branch 'master' into merge 2024-10-04 09:46:55 -07:00
Andy Friesen
8531df04c9 Sync to upstream/release/646 2024-10-04 09:42:22 -07:00
aaron
02241b6d24
Sync to upstream/release/645 (#1440)
Some checks failed
benchmark / callgrind (map[branch:main name:luau-lang/benchmark-data], ubuntu-22.04) (push) Has been cancelled
build / ${{matrix.os.name}} (map[name:macos version:macos-latest]) (push) Has been cancelled
build / ${{matrix.os.name}} (map[name:macos-arm version:macos-14]) (push) Has been cancelled
build / ${{matrix.os.name}} (map[name:ubuntu version:ubuntu-latest]) (push) Has been cancelled
build / windows (Win32) (push) Has been cancelled
build / windows (x64) (push) Has been cancelled
build / coverage (push) Has been cancelled
build / web (push) Has been cancelled
release / ${{matrix.os.name}} (map[name:macos version:macos-latest]) (push) Has been cancelled
release / ${{matrix.os.name}} (map[name:ubuntu version:ubuntu-20.04]) (push) Has been cancelled
release / ${{matrix.os.name}} (map[name:windows version:windows-latest]) (push) Has been cancelled
release / web (push) Has been cancelled
In this update, we continue to improve the overall stability of the new
type solver. We're also shipping some early bits of two new features,
one of the language and one of the analysis API: user-defined type
functions and an incremental typechecking API.

If you use the new solver and want to use all new fixes included in this
release, you have to reference an additional Luau flag:
```c++
LUAU_DYNAMIC_FASTINT(LuauTypeSolverRelease)
```
And set its value to `645`:
```c++
DFInt::LuauTypeSolverRelease.value = 645; // Or a higher value for future updates
```

## New Solver

* Fix a crash where scopes are incorrectly accessed cross-module after
they've been deallocated by appropriately zeroing out associated scope
pointers for free types, generic types, table types, etc.
* Fix a crash where we were incorrectly caching results for bound types
in generalization.
* Eliminated some unnecessary intermediate allocations in the constraint
solver and type function infrastructure.
* Built some initial groundwork for an incremental typecheck API for use
by language servers.
* Built an initial technical preview for [user-defined type
functions](https://rfcs.luau-lang.org/user-defined-type-functions.html),
more work still to come (including calling type functions from other
type functions), but adventurous folks wanting to experiment with it can
try it out by enabling `FFlag::LuauUserDefinedTypeFunctionsSyntax` and
`FFlag::LuauUserDefinedTypeFunction` in their local environment. Special
thanks to @joonyoo181 who built up all the initial infrastructure for
this during his internship!

## Miscellaneous changes

* Fix a compilation error on Ubuntu (fixes #1437)

---

Internal Contributors:

Co-authored-by: Aaron Weiss <aaronweiss@roblox.com>
Co-authored-by: Hunter Goldstein <hgoldstein@roblox.com>
Co-authored-by: Jeremy Yoo <jyoo@roblox.com>
Co-authored-by: Vighnesh Vijay <vvijay@roblox.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>

---------

Co-authored-by: Alexander McCord <amccord@roblox.com>
Co-authored-by: Andy Friesen <afriesen@roblox.com>
Co-authored-by: Vighnesh <vvijay@roblox.com>
Co-authored-by: Aviral Goel <agoel@roblox.com>
Co-authored-by: David Cope <dcope@roblox.com>
Co-authored-by: Lily Brown <lbrown@roblox.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
Co-authored-by: Junseo Yoo <jyoo@roblox.com>
2024-09-27 11:58:21 -07:00
Aaron Weiss
d7bbe3ff04 fix cmake for user-defined type functions 2024-09-27 10:49:00 -07:00
Aaron Weiss
a3da985449 Merge branch 'upstream' into merge 2024-09-27 10:12:18 -07:00
Aaron Weiss
e8880490d2 Merge branch 'master' into merge 2024-09-27 10:12:15 -07:00
Aaron Weiss
7a7521a7ab Sync to upstream/release/645 2024-09-27 10:11:46 -07:00
aaron
c188715605
Include luau-ast in the releases (#1439)
Some checks failed
benchmark / callgrind (map[branch:main name:luau-lang/benchmark-data], ubuntu-22.04) (push) Has been cancelled
build / ${{matrix.os.name}} (map[name:macos version:macos-latest]) (push) Has been cancelled
build / ${{matrix.os.name}} (map[name:macos-arm version:macos-14]) (push) Has been cancelled
build / ${{matrix.os.name}} (map[name:ubuntu version:ubuntu-latest]) (push) Has been cancelled
build / windows (Win32) (push) Has been cancelled
build / windows (x64) (push) Has been cancelled
build / coverage (push) Has been cancelled
build / web (push) Has been cancelled
release / ${{matrix.os.name}} (map[name:macos version:macos-latest]) (push) Has been cancelled
release / ${{matrix.os.name}} (map[name:ubuntu version:ubuntu-20.04]) (push) Has been cancelled
release / ${{matrix.os.name}} (map[name:windows version:windows-latest]) (push) Has been cancelled
release / web (push) Has been cancelled
2024-09-25 16:36:12 -04:00
vegorov-rbx
946a097e93
Update benchmark.yml to run new solver using the new flag (#1433) 2024-09-20 10:39:39 -07:00
vegorov-rbx
f5dabc2998
Sync to upstream/release/644 (#1432)
In this update we improve overall stability of the new type solver and
address some type inference issues with it.

If you use the new solver and want to use all new fixes included in this
release, you have to reference an additional Luau flag:
```c++
LUAU_DYNAMIC_FASTINT(LuauTypeSolverRelease)
```
And set its value to `644`:
```c++
DFInt::LuauTypeSolverRelease.value = 644; // Or a higher value for future updates
```

## New Solver
* Fixed a debug assertion failure in autocomplete (Fixes #1391)
* Fixed type function distribution issue which transformed `len<>` and
`unm<>` into `not<>` (Fixes #1416)
* Placed a limit on the possible normalized table intersection size as a
temporary measure to avoid hangs and out-of-memory issues for complex
type refinements
* Internal recursion limits are now respected in the subtyping
operations and in autocomplete, to avoid stack overflow crashes
* Fixed false positive errors on assignments to tables whose indexers
are unions of strings
* Fixed memory corruption crashes in subtyping of generic types
containing other generic types in their bounds

---

Internal Contributors:

Co-authored-by: Aaron Weiss <aaronweiss@roblox.com>
Co-authored-by: Andy Friesen <afriesen@roblox.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
2024-09-20 09:53:26 -07:00
Vyacheslav Egorov
45594a571d Fixed the issue 2024-09-20 19:42:14 +03:00
Vyacheslav Egorov
48f3c85cba Maybe more? 2024-09-20 19:11:51 +03:00
Vyacheslav Egorov
0106dfaffa Maybe reduce the base 2024-09-20 18:58:46 +03:00
Vyacheslav Egorov
9655780bd3 Reduce it even more 2024-09-20 18:48:51 +03:00
Vyacheslav Egorov
66ba3608ca Smaller limit under ASAN for autocomplete_subtyping_recursion_limit 2024-09-20 18:43:56 +03:00
Vyacheslav Egorov
0d6b70b80b Merge branch 'upstream' into merge 2024-09-20 17:38:03 +03:00
Vyacheslav Egorov
d66e088af8 Merge branch 'master' into merge 2024-09-20 17:29:25 +03:00
Vyacheslav Egorov
a45eb2c9e0 Sync to upstream/release/644 2024-09-20 17:14:29 +03:00
Vighnesh-V
e8a7acb802
Fix syntax error in release.yml file (#1411)
Validated this with yamllint.
2024-09-13 13:26:35 -07:00
Vighnesh-V
cd1803e35e
upgrade release.yml to upload-artifact@v4 (#1410)
Github has deprecated `v1` and `v2` of `actions/upload-artifact` which
causes occassional CI failures and will affect our ability to make new
releases in the future. This PR updates the version used in
`release.yml`.
2024-09-13 13:09:42 -07:00
Vighnesh-V
b765d7bafd
Sync to upstream/release/643 (#1408)
Pretty small release this week as well.

## New Solver
* We now unconditionally generalize functions with explicit generics
* Bugfixes for how we run builtin tests

## VM
* Fixed running Luau conformance tests in LUA_VECTOR_SIZE == 4
configuration

Internal Contributors:

Co-authored-by: Hunter Goldstein <hgoldstein@roblox.com>
Co-authored-by: James McNellis <jmcnellis@roblox.com>
Co-authored-by: Vighnesh Vijay <vvijay@roblox.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>

---------

Co-authored-by: Aaron Weiss <aaronweiss@roblox.com>
Co-authored-by: Alexander McCord <amccord@roblox.com>
Co-authored-by: Andy Friesen <afriesen@roblox.com>
Co-authored-by: Aviral Goel <agoel@roblox.com>
Co-authored-by: David Cope <dcope@roblox.com>
Co-authored-by: Lily Brown <lbrown@roblox.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
Co-authored-by: Junseo Yoo <jyoo@roblox.com>
2024-09-13 11:48:25 -07:00
karl-police
f2488bdfa4
Fix crash with the index type function, where it would stack overflow due to not waiting for a pending-expansion (#1407)
Fix for https://github.com/luau-lang/luau/issues/1406

While it is good to let ``index`` wait for the pending-expansion. To
re-produce the issue you need more than just this code:
https://i.imgur.com/b3OmUGF.png

It needs this, else it won't crash.

```lua
local function ProblemCauser(key: Keys, value)
    PlayerData[key] = value
end
```

&nbsp;

But regarding "pending things", I'd recommend **generalized functions**
for sanity checks like these, since there will be more cases of similar
issues I believe. But I am 100% sure that eventually this issue here can
maybe be prevented if looking at the Constraints. _(And optimization)_
Not sure if ``index`` needs the table fully completed, or if it is
preferred that the info is available based on **how much info is
available at the current position in the code**.

But if this gets done, I hope that they'll be connected to the Solver
Logger, because I actually refined mine with colors and more info _(yet
need to finish that)_ to understand the Luau Source Code more and to
debug issues.

---------

Co-authored-by: aaron <aweiss@hey.com>
2024-09-13 10:16:30 -07:00
Vighnesh
4df4a1d408 Merge branch 'upstream' into merge 2024-09-13 10:16:25 -07:00
Vighnesh
23e9fa53cd Merge branch 'master' into merge 2024-09-13 10:16:09 -07:00
Vighnesh
cd27a20223 Sync to upstream/release/643 2024-09-13 10:14:29 -07:00
karl-police
5cdea64b7a
Add default "out" folder for CMake Project Visual Studio (#1394)
https://learn.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=msvc-170#ide-integration

Apparently ``/out`` is a default folder when opening the project as a
CMake project in Visual Studio.

&nbsp;

Could it be added to the ``.gitignore`` please.


![image](https://github.com/user-attachments/assets/10add17c-bbfc-4811-8c43-0ed2e84c5b9e)
2024-09-13 09:51:10 -07:00
karl-police
a8047b2e46
keyof - fix LUAU_ASSERT when there's only one key entry (#1388)
Fixes https://github.com/luau-lang/luau/issues/1387

Was suggested by @alexmccord 

I changed ``singletons[0]`` to ``singletons.front()``, unsure if that
makes a huge difference, and then I added the rest of the things needed
for the return type.

Maybe it's also the ideal location since doing it before looping through
``keys`` won't add the string into the type arena.

I put comments next to it based on how I thought it would make sense.

&nbsp;

``LUAU_ASSERT`` seems to trigger when there's only one entry being put
inside a UnionType. It's as if it was put there for quality.

Allow edits by maintainers is enabled.


I tested this with a quick Unit Test something like

```lua
local test: keyof<typeof({a="test"})>
```
2024-09-09 13:51:33 -07:00
Andy Friesen
d9536cecd8
Sync to upstream/release/642 (#1385)
## New Solver

* The type functions `keyof` and `index` now also walk the inheritance
chain when they are used on class types like Roblox instances.

---------

Co-authored-by: Aaron Weiss <aaronweiss@roblox.com>
2024-09-06 13:34:50 -07:00