luau-lang / luau

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

Missing type label when using "&" in definition, even though type exists #1182

Open karl-police opened 4 months ago

karl-police commented 4 months ago

Not sure what the equavilient of this box is in Luau's source code. Otherwise I'd have tried to test there.

Usually this box is shown image

But if you try this

local test = {} :: {} & string

It doesn't image

but the autocomplete works fine image

so it is aware of the type, but it doesn't show the label, which is a bit weird

 

The more strange part is this one

type test = string & number
local test = {} :: test

image

It should show "test" or not?

 

type test = () -> (string & number)
local test = {} :: test

Functions do show the return value in the type image

I expected it to show test or string & number