Skip to content

Instantly share code, notes, and snippets.

View cameronpcampbell's full-sized avatar

Cameron Campbell cameronpcampbell

View GitHub Profile
-- The equality operator `==` is really strict with unions and intersections,
-- where the order of their components needs to be the same.
type function sort_type(input: type)
local input_tag = input.tag
if input_tag == "union" or input_tag == "intersection" then
local components = input:components()
table.sort(components, function(a: type, b: type): boolean
local a_tag, b_tag = a.tag, b.tag