1
0
Fork 0
mirror of https://github.com/luau-lang/luau.git synced 2025-04-13 15:20:53 +01:00

Added missing items and fixed confusing function declaration example

This commit is contained in:
Vyacheslav Egorov 2021-05-31 20:51:00 +03:00
parent ba09f58535
commit 9e87d4e081

View file

@ -10,7 +10,7 @@ Luau is our new language that you can read more about at [https://roblox.github.
## Named function type arguments ## Named function type arguments
We've updated Luau syntax to support optional names of arguments inside function types. We've updated Luau syntax to support optional names of arguments inside function types.
The syntax follows the same format as regular function argument declarations: `(a: number, b: string): string` The syntax follows the same format as regular function argument declarations: `(a: number, b: string)`
Names can be provided in any place where function type is used, for example: Names can be provided in any place where function type is used, for example:
@ -28,7 +28,7 @@ local function foo(cb: (name: string) -> ())
Variadic arguments cannot have an extra name, they are already written as ...: number. Variadic arguments cannot have an extra name, they are already written as ...: number.
These names are used for documentation purposes and we also plan to display them in Roblox Studio auto-complete and type hovers. These names are used for documentation purposes and we also plan to display them in Roblox Studio auto-complete and type hovers.
They do not affect how the typechecking of Luau code is performed. They do not affect how the typechecking of Luau scripts is performed.
## Typechecking improvements ## Typechecking improvements
@ -43,9 +43,10 @@ Speaking of typechecking, we've implemented many improvements this month:
* Fixed a bug which caused spurious unknown global errors * Fixed a bug which caused spurious unknown global errors
We've also added new checks to our linter: We've also added new checks to our linter:
* A new pass will report uses of deprecated Roblox APIs * A new check will report uses of deprecated Roblox APIs
* We will warn for global functions that are defined inside local functions * We will warn for global functions that are defined inside local functions
* New warning is generated if array loop starts or ends on index '0', but the array is indexed from '1' * New warning is generated if array loop starts or ends on index '0', but the array is indexed from '1'
* FormatString lint will now check string patterns for `find`/`match` calls via `:` when object type is known to be a string
We also fixed one of the sources for "Free types leaked into this module's public interface" error message and we are working to fix the remaining ones. We also fixed one of the sources for "Free types leaked into this module's public interface" error message and we are working to fix the remaining ones.
@ -57,7 +58,11 @@ We continue to improve our built-in support for auto-complete that will be used
As part of this work we will improve the type information provided by Roblox APIs to match actual arguments and results. As part of this work we will improve the type information provided by Roblox APIs to match actual arguments and results.
## Behavior changes
We've made an improvement for an error message, when a relational comparison fails at runtime, we now specify the comparison direction in the error message (e.g. `attempt to compare nil <= number`)
## Performance improvements ## Performance improvements
* Improved performance of table lookup with an index operator and a string: `t["name"]` * Improved performance of table lookup with an index operator and a string: `t["name"]`
* Fixed an issue with increasing memory usage in Parallel Luau beta * Bytecode compilation is now ~5% faster which can improve server startup time for games with lots of scripts