luau-lang / luau

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

In new solver, blocked type introduced unexpectedly in bitwise op heavy code #1428

Open Dekkonot opened 1 week ago

Dekkonot commented 1 week ago

I apologize for the vague title, but I don't know a better way to describe this issue since I haven't been able to isolate it.

I tried the new solver out on a SHA-512 hashing module I wrote a while ago. As a result of being a 64-bit algorithm implemented using 32-bit ones, it's very heavy on bit operations and arithmetic but is otherwise very simple. However, somewhere a type constraint isn't resolving, which results in a blocked type.

Here is the code that's producing the errors: https://gist.github.com/Dekkonot/84c0b056d330801ec2a656cb6a27ca08

Let me know if I can help any, as this is a much worse bug report than I'd like to be leaving.

karl-police commented 1 week ago

I wonder if the type checker ever finishes resolving for it

image

It's still going as I type this.

I wonder if it has to do with

local d1_front, d2_front, d3_front, d4_front = digestFront[1], digestFront[2], digestFront[3], digestFront[4]
local d5_front, d6_front, d7_front, d8_front = digestFront[5], digestFront[6], digestFront[7], digestFront[8]

Since there's a Unit Test that mentions that not working well regarding type checking on the new solver, I forgot where though but it had to do with refinements.

Actually it was for tables.

typeguard_cast_free_table_to_vector