luau-lang / luau

A fast, small, safe, gradually typed embeddable scripting language derived from Lua
https://luau.org
MIT License
3.98k stars 373 forks source link

disallow variadic type packs in parenthesized types when in return position #1322

Open jackdotink opened 2 months ago

jackdotink commented 2 months ago

This PR is a breaking change, but I doubt anyone uses the syntax.

local function a(): (string, ...number) | boolean -- valid syntax, but weird type
local function a(): (string, buffer, ...number) | boolean -- syntax error
local function a(): (...number) | boolean -- syntax error

This PR makes the first example a syntax error, which it should be.

Dekkonot commented 2 months ago

Rename the PR to indicate what it's about please.

jackdotink commented 2 months ago

you're no fun :c