Commit Graph

1301 Commits

Author SHA1 Message Date
Aaron Weiss
ed05da573a Merge branch 'master' into merge 2024-10-25 09:46:40 -07:00
vegorov-rbx
e491128f95
Sync to upstream/release/648 (#1477)
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
## What's new

* Added `math.map` function to the standard library, based on
https://rfcs.luau-lang.org/function-math-map.html
* `FileResolver` can provide an implementation of
`getRequireSuggestions` to provide auto-complete suggestions for
require-by-string

## New Solver

* In user-defined type functions, `readproperty` and `writeproperty`
will return `nil` instead of erroring if property is not found
* Fixed incorrect scope of variadic arguments in the data-flow graph
* Fixed multiple assertion failures

---

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: Vighnesh Vijay <vvijay@roblox.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
2024-10-18 10:27:15 -07:00
Vyacheslav Egorov
ce9f1eb905 Merge branch 'upstream' into merge 2024-10-18 18:17:08 +03:00
Vyacheslav Egorov
bbd18bf0bd Merge branch 'master' into merge 2024-10-18 18:17:04 +03:00
Vyacheslav Egorov
47e3123863 Sync to upstream/release/648 2024-10-18 18:08:01 +03:00
Vighnesh-V
d7842e08ae
OSS cleanup - Sync/upstream/647 introduced unecessary new lines in Differ.cpp - this cleans it up (#1472)
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-10-14 10:33:24 -07:00
Vighnesh-V
77295c3610
Sync to upstream/release/647 (#1469)
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
# General Updates
Fix an old solver crash that occurs in the presence of cyclic
`requires()`

## New Solver
- Improvements to Luau user-defined type function library
- Avoid asserting on unexpected metatable types
- Properties in user defined type functions should have a consistent
iteration order - in this case it is insertion ordering

# Runtime
- Track VM allocations for telemetry

---
Co-authored-by: Aaron Weiss <aaronweiss@roblox.com>
Co-authored-by: Andy Friesen <afriesen@roblox.com>
Co-authored-by: Hunter Goldstein <hgoldstein@roblox.com>
Co-authored-by: James McNellis <jmcnellis@roblox.com>
Co-authored-by: Varun Saini <vsaini@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-10-11 17:48:30 -07:00
Vighnesh
fb8c190849 replicate changes to cmakelists 2024-10-11 17:16:39 -07:00
Vighnesh
268e0b2ab7 revert differ.h change 2024-10-11 17:13:33 -07:00
Vighnesh
837bba31e4 revert cmake file + update makefile 2024-10-11 16:57:52 -07:00
Vighnesh
5d74685798 unconditially add suppressing flag 2024-10-11 16:54:35 -07:00
Vighnesh
a7324ce8fb what happens if we remove the flag 2024-10-11 16:50:14 -07:00
Vighnesh
03c9fa721e try again? 2024-10-11 16:47:27 -07:00
Vighnesh
b5d3544d18 update build flags 2024-10-11 16:39:31 -07:00
Vighnesh
0276d18314 one more try 2024-10-11 16:30:15 -07:00
Vighnesh
b1fae55636 nit differ 2024-10-11 16:02:48 -07:00
Vighnesh
50e8dd0d71 more macro crimes 2024-10-11 15:47:58 -07:00
Vighnesh
dafee8bbef nest again 2024-10-11 15:37:54 -07:00
Vighnesh
c9ff5d1c0a nest pragma 2024-10-11 15:28:51 -07:00
Vighnesh
848fa0be8e insert new lines 2024-10-11 15:23:33 -07:00
Vighnesh
b76941b678 annotate this optional use 2024-10-11 15:21:25 -07:00
Vighnesh
507832b1f0 default initialize 2024-10-11 15:05:31 -07:00
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