luau-lang / luau

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

std::optional exception on new solver #1449

Open checkraisefold opened 4 weeks ago

checkraisefold commented 4 weeks ago

Exception generated here: https://github.com/luau-lang/luau/blob/master/Analysis/src/Subtyping.cpp#L863-L866 where subTail is a nullopt.

I don't have a repro, but it's coming from OverloadResolver::selectOverload when the ConstraintSolver tries to solve a FunctionCallConstraint. The function prototype being passed to the overload resolver is also very weird/invalid. See image. image

This is on a large file with 2,754 constraints generated at the time of the exception.

checkraisefold commented 4 weeks ago

This busted function appears to be coroutine.wrap for some reason

checkraisefold commented 4 weeks ago

I have found a 100% repro https://raw.githubusercontent.com/evaera/roblox-lua-promise/refs/heads/master/lib/init.lua

Custom modded luau-analyze build, only change is to set LuauTypeSolverRelease to 645

luau-analyze.exe --mode=strict --fflags=LuauSolverV2=true init.lua
aatxe commented 3 weeks ago

I cannot reproduce the crash on that file, unfortunately, on release 645. Do you actually require the whole repository there, and not just the singular file?

checkraisefold commented 2 days ago

I cannot reproduce the crash on that file, unfortunately, on release 645. Do you actually require the whole repository there, and not just the singular file?

I am still able to repro on 649 on a debug build (maybe this doesn't happen on release, think it might be an assertion that is disabled) with the luau-lsp analyze CLI at least, and most likely original luau-analyze as per the original issue. I found this issue when using the whole repository, but the singular file also causes the issue.